This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: linker script variables
Alan Modra wrote:
> On Tue, Jan 12, 2010 at 08:41:59AM +0100, Markus Duft wrote:
>> now when looking at the attached linker script, i would think, that the
>
> How did you invoke the linker? From the symptoms I'd guess you didn't
> specify the script using "-T uTachyon.ld" but just added the script as
> one of the linker input files. In that case your script augments the
> standard script. All of your output section statements are merged
> with the standard ones..
>
first of all, thanks for the reply. i checked again, digged a little
deeper, and realized that i was linking with gcc, not ld, so i guess
that the -T option was ignored ...?
however, after changing the makefile accordingly from:
$(LINK.o) $(FREESTANDING_OPTS) $^ -o $@ -T $(TARGET_SCRIPT)
to
ld $^ -o $@ -T $(TARGET_SCRIPT)
the same thing happens...
after thinking of it .... wait a sec... owh... -T is position dependent,
right? ...argh.
hmm. doesn't help either; now tried all of those, but still no luck, damn:
$(LINK.o) $(FREESTANDING_OPTS) $^ -o $@ -T $(TARGET_SCRIPT)
$(LINK.o) -Wl,-T -Wl,$(TARGET_SCRIPT) $(FREESTANDING_OPTS) $^ -o $@
ld $^ -o $@ -T $(TARGET_SCRIPT)
ld -dT $(TARGET_SCRIPT) $^ -o $@
ld -T $(TARGET_SCRIPT) $^ -o $@
the LINK.o definition BTW is the GNU make builtin one...
anyway - the idea was good. at first it got me thinking i made a really
stupid mistake ;)
below is some more --verbose output from ld, which makes me think that
the linker script should be fine now - symbols still show the same
values as before... :*(
ld --verbose -dT ./Platforms/ia32/uTachyon.ld
Platforms/ia32/multiboot_hdr.o Platforms/ia32/multiboot_entry.o
Platforms/ia32/multiboot.o Platforms/ia32/c-console.o
Platforms/ia32/console.o Platforms/ia32/gxx-support.o
Platforms/ia32/uTachyon.ld -o Platforms/ia32/uTachyon
GNU ld (GNU Binutils) 2.18
Supported emulations:
...<omitted platforms>...
opened script file ./Platforms/ia32/uTachyon.ld
using external linker script:
==================================================
ENTRY(uTachyonEntry)
SECTIONS
{
. = 0x00100000;
.text : {
uTachyonCodeStart = .;
*(.text)
}
.rodata ALIGN(0x1000) : {
uTachyonRoDataStart = .;
*(.rodata*)
}
.data ALIGN(0x1000) : {
uTachyonCtors = .;
*(.ctor*)
uTachyonCtorsEnd = .;
uTachyonDtors = .;
*(.dtor*)
uTachyonDtorsEnd = .;
uTachyonDataStart = .;
*(.data)
}
.bss ALIGN(0x1000) : {
uTachyonBssStart = .;
*(COMMON)
*(.bss)
uTachyonBssEnd = .;
}
}
==================================================
attempt to open Platforms/ia32/multiboot_hdr.o succeeded
Platforms/ia32/multiboot_hdr.o
attempt to open Platforms/ia32/multiboot_entry.o succeeded
Platforms/ia32/multiboot_entry.o
attempt to open Platforms/ia32/multiboot.o succeeded
Platforms/ia32/multiboot.o
attempt to open Platforms/ia32/c-console.o succeeded
Platforms/ia32/c-console.o
attempt to open Platforms/ia32/console.o succeeded
Platforms/ia32/console.o
attempt to open Platforms/ia32/gxx-support.o succeeded
Platforms/ia32/gxx-support.o
attempt to open Platforms/ia32/uTachyon.ld succeeded
opened script file Platforms/ia32/uTachyon.ld
that's it....
Cheers, Markus