bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/3089] New: explicit input section assignment overriden by *LATER


From: dtaylor at emc dot com
Subject: [Bug ld/3089] New: explicit input section assignment overriden by *LATER* wildcard assignment
Date: 18 Aug 2006 20:43:41 -0000

The following problem was discovered using a cross tool chain --
x86 linux x powerpc eabi.  However, I have reproduced it using
an x86 linux native toolchain.  I do not *believe* that it is
dependent upon any of host triplet, target triplet, build triplet.

Suppose you have a linker script which explicitly assigns
the .data sections from some selected files to .nodata and
*LATER* wildcards .data to go into .data.

You would expect that the early explicit assignments would
be honored.  They, at least sometimes, aren't.

I have a greatly stripped down example using 3 object files
(the original involved over 700 object files).  It can probably
be reduced further.

linker-script:
--------------
SECTIONS {
cs 0x2e000 : {
"foo.o"(.text .rodata .rodata.* .sdata2)
"bar.o"(.text .rodata .rodata.* .sdata2)
} =0x00000000
.data 0x890000 : {
"fubar.o"(.data .sdata)
} =0x00000000
.bss 0xd10000 : {
"fubar.o"(.bss .sbss)
} =0x00000000
.nodata 0xffffff00 : {
"foo.o"(.data .sdata)
"bar.o"(.data .sdata)
} =0x00000000
.nobss 0xffffff80 : {
"foo.o"(.bss .sbss)
"bar.o"(.bss .sbss)
} =0x00000000
$newlib$ (ADDR(cs))+SIZEOF(cs) : {
. = ALIGN(4);
*(.text .rodata .rodata.cst8 .rodata.cst4 .eh_frame .got)
. = ALIGN(16);
} =0x00000000
.data 0x890000 : { *(.data .sdata) }
.debug          0 : { *(.debug) }
.debug_srcinfo  0 : { *(.debug_srcinfo) }
.debug_aranges  0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_sfnames  0 : { *(.debug_sfnames) }
.line           0 : { *(.line) }
.stab           0 : { *(.stab) }
.stabstr        0 : { *(.stabstr) }
/DISCARD/ : { *(.comment .alias .fixup .data.rel) }
}

bar.c:
------
int bar_data = 42;

int
bar_function()
{
  return 42;
}

foo.c:
------
int foo_data = 17;

void
foo_function()
{
}

fubar.c:
--------
int fubar_bss;

int fubar_data = 29;

instructions:
-------------
compile the files (-c) using your favorite gcc
link 'em saying

<some linker> -static -Map bug.map -o bug.elf --script=linker-script

examine using objdump --headers and the file bug.map.

You'll see that

.nodata did not get created; it should have been create with the .data .sdata
contents from foo.o and bar.o.  The contents instead went into .data.

-- 
           Summary: explicit input section assignment overriden by *LATER*
                    wildcard assignment
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: dtaylor at emc dot com
                CC: bug-binutils at gnu dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=3089

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]