🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50930

Partial Linking Question

#50930
From: D. Erway
Date: Tue, 27 Jul 1993 22:31
52 lines
3198 bytes
I am in process of switching over from motorola style compiler/linker to mit
style. Under the motorola style, I could put various pieces of program in
various linker sections, and then link them all together, specifying base
addresses for various sections.

I am using gcc-2.4.5/gas-2.1.1/binutils-2.2.1.

I try to do this:

/usr/local/sun3/bin/ld -o scan_nvram._tmp_ -dc -Tbss 500c0000 -r scan_nvram.o
mv scan_nvram._tmp_ scan_nvram.o

After this, the symbols in scan_nvram.o are where I want them to be.

Then I link the whole mess together, with a beginning offset for all of it:

/usr/local/sun3/bin/ld -o 901000.o -Ttext 30028000 /usr/users/bios/lib/begin.o
alloc.o all_print.o baud.o bkgnd.o bottch.o boxes.o clean.o clock.o color.o
ctrl.o ctrl_scr.o date.o err_recov.o events.o grid_calc.o inline.o kb_aux.o
keybd.o lang.o loc_init.o machine.o misc.o print.o prll.o process.o r_paint.o
rec1.o ram_init.o screen.o secur.o setup.o sf.o tach.o time.o touch.o trend.o
trlang.o trlang_sp.o units.o vreps.o all_mc.o composite.o grid.o magnon.o
7342.o scan_cal.o scan_eos.o scan_gage.o scan_nvram.o scan_preps.o
scan_reports.o scanner.o screen3.o setscan.o trend_plot.o zone.o zero.o
zero_sub.o hif.o hif_proto.o scan_hif.o defects.o streak.o streak_tsk.o asp.o
-R ./bios.o

However, this relocates the symbols in scan_nvram.o to somewhere else. I can't
quite figure out where. It's not the sum of the 2 offsets. It's not the end of
the bss + 500c0000. It's somewhere in between.

I need to be able to fix the address of this module, and then link it in with
the rest. I tried it without the -r:

/usr/local/sun3/bin/ld -o scan_nvram._tmp_ -dc -Tbss 500c0000 scan_nvram.o

But the results were the same. This is why I am posting this to utils.bug, on
the outside chance that this is a bug.

Now in this particular case the module contains uninitialized data, so I could
link it in with -R, but in general, this should be possible without it.

Any ideas?

	-Don

\-----------------------------------------------------------------------/
| Don Erway			   			 derway@ndc.com	|
| NDC Systems								|
| Monrovia, CA			   Opinions expressed herein apparently	|
| (Somewhere Near Pasadena)	   spontaneously organized  themselves.	|
/-----------------------------------------------------------------------\
Technical Details
Message-ID: <gnusenet234aboINN19b@gap.caltech.edu>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!spool.mu.edu!olivea!grapevine.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,5e30f177f040829a,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: 10f1ff,dab43d2f963caf32
X-Google-Attributes: gid10f1ff,public
X-Google-ArrivalTime: 1993-07-27 23:42:59 PST
To: gnu-utils-bug@cis.ohio-state.edu
From: derway@cco.caltech.edu (D. Erway)
Newsgroups: gnu.gcc.help,gnu.utils.bug
Subject: Partial Linking Question
Date: 27 Jul 1993 22:31:20 GMT
Organization: California Institute of Technology, Pasadena
Message-ID: <gnusenet234aboINN19b@gap.caltech.edu>
Summary: How to force a module to link at absolute address?
Distribution: world
Approved: info-gnu@prep.ai.mit.edu
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!spool.mu.edu!olivea!grapevine.lcs.mit.edu!ai-lab!prep.ai.mit.edu!gnulists
Followup-To: gnu.gcc.help,gnu.utils.bug
Lines: 53