bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/7038] New: ld doesn't detect overlap with .bss


From: dean dot saridakis at baesystems dot com
Subject: [Bug ld/7038] New: ld doesn't detect overlap with .bss
Date: 18 Nov 2008 19:51:24 -0000

I reported this on gnu.utils.bug a while back, but never got any bites
(http://groups.google.com/group/gnu.utils.bug/browse_thread/thread/6c67f496bcea3cde/fa5b859ca7bf663c?hl=en&lnk=gst&q=ld#fa5b859ca7bf663c).


Here's the description:

I suspect it's always worked this way, but seems like a bug to me. I'm
using binutils 2.14 targetting powerpc (elf):

GNU ld version 2.16.91 20050610

My basic linker script is:

SECTIONS
{

  .text 0x10000 :
  {
    c_text_start = ABSOLUTE(.);

    start.o(.text)
    *(.text)
    *(.rodata)

    c_text_end = ABSOLUTE(.);
  }

  .data :
  {
    c_data_start = ABSOLUTE(.);

    *(.data);
    *(.sdata);
    *(.sdata2);

    c_data_end = ABSOLUTE(.);
  }

  .bss :
  {
    c_bss_start = ABSOLUTE(.);

    *(.bss)
    *(.sbss)
    *(COMMON)

    c_bss_end = ABSOLUTE(.);

  }

}

Which gives me (objdump):

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000216c  00010000  00010000  00000060  2**5
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         0000002c  0001216c  0001216c  000021cc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          000000a0  000121a0  000121a0  00002200  2**5
                  ALLOC
  3 .stab         00003138  00000000  00000000  00002200  2**2
                  CONTENTS, READONLY, DEBUGGING
  4 .stabstr      00003390  00000000  00000000  00005338  2**0
                  CONTENTS, READONLY, DEBUGGING

If I change the .data section to:

  .data 0xffe0:

I get the overlap error I expect:

powerpc-ibm-eabi-ld: section .data [0000ffe0 -> 0001000b] overlaps
section .text [00010000 -> 0001216b]

However, if I change the .bss section instead:

  .bss 0xffe0:

It links fine and I get:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000216c  00010000  00010000  00000080  2**5
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         0000002c  0001216c  0001216c  000021ec  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          000000a0  0000ffe0  0000ffe0  00000080  2**5
                  ALLOC
  3 .stab         00003138  00000000  00000000  00002218  2**2
                  CONTENTS, READONLY, DEBUGGING
  4 .stabstr      00003390  00000000  00000000  00005350  2**0
                  CONTENTS, READONLY, DEBUGGING

where .bss & .text overlap. This problem exists with other bss-like
sections as well, e.g.,

.section my_stack,"aw",@nobits

-- 
           Summary:  ld doesn't detect overlap with .bss
           Product: binutils
           Version: 2.14
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: dean dot saridakis at baesystems dot com
                CC: bug-binutils at gnu dot org
GCC target triplet: powerpc-ibm-eabi


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

------- 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]