Resolve symbols for object files in link script
Nick Clifton
nickc@redhat.com
Wed Oct 4 08:30:00 GMT 2006
Hi Tzu-Chien,
> Hello, everyone:
>
> It seems to me that the order LD resolves symbols is:
>
> (1) the object files listed in the command line
> (2) the object files listed in the link script
>
> If I recalled correctly, each archive is opened only once, unless
> otherwise specified. If libc.a, libm.a, libgcc,a are opened in the
> step (1), the symbol in those archived won't be resolved in step (2).
As Ian pointed out the linker script is scanned at the point that it is
mentioned on the command line, so you could resolve your problem like this:
ld <list of object files> -T<linker script> --start-group <libraries>
--end-group
> I'm porting a
> large software and I have to manually put the object files into
> different sections. GCC __attribute__ is not feasible, because there
> are thousands of functions in each object file.
Is there any way to build these object files into different directories
depending upon which section you want them to inhabit in the executable
? If so then you could use the regexp capabilities of the linker script
to save yourself from manually mentioning each file. eg:
SECTION {
.a : { a/*.o } > ram
.b : { b/*.o } > ram
}
Cheers
Nick
More information about the Binutils
mailing list