In the following example symbol _start should have been reported as duplicate as
there are two instances of it. But ld does not report this error and the _start
symbol defined in duplicate.o file is overridden.
example

Sampel application "duplicate.c":
  extern int dummy(void)
  {
      volatile int i;

      /* create some .text data to move _start away from the beginning */

      for(i = 0; i < 100; i++)
          ;

      return i;
  }

  extern void _start(void)
  {
      volatile int *p = (volatile int*)0xbf0c0000;

      *p = dummy();
  }

Linker script "duplicate-ld":
  SECTIONS
  {
      .text 0x00000000:
      {
          _start = . ;
          *(.text)
      }
  } 



How to reproduce 

gcc -c -o duplicate.o duplicate.c
ld -o duplicate -T duplicate-ld duplicate.o

-- 
           Summary: ld does not report duplicate symbols defined in script
                    file
           Product: binutils
           Version: 2.17 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: raj dot khem at gmail dot com
                CC: bug-binutils at gnu dot org,hjl at lucon dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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

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


_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to