[Top][All Lists]

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

[Bug ld/4590] New: String merging breaks ia64 linker

From: schwab at suse dot de
Subject: [Bug ld/4590] New: String merging breaks ia64 linker
Date: 4 Jun 2007 15:44:20 -0000

Objects created by "ld -r" can contain merge sections that have duplicate
entries.  Linking such an object can result in a bad setup of the GOT
section, if those entries are referenced both by GOT and non-GOT relocations.

$ cat ltoff.s
        .section .rodata.str1.8,"aMS", 1
.LC1:   .string "foo"
.LC2:   .string "foo"
        .section .data.rel.local,"aw"
        .quad .LC2
        .section .rodata,"a"
.LC3:   .string "bar"
        .balign 8
        .space 0x400000
        addl address@hidden(.LC1),r1 ;;
        addl address@hidden(.LC3),r1 ;;
$ gcc -c ltoff.s
$ ld -shared ltoff.o
$ objdump -d

a.out:     file format elf64-ia64-little

Disassembly of section .text:

0000000000000210 <.text>:
 210:   0b 60 60 02 00 24       [MMI]       addl r12=24,r1;;
 216:   c0 c0 04 00 48 00                   addl r12=24,r1
 21c:   00 00 04 00                         nop.i 0x0;;
$ objdump -R

a.out:     file format elf64-ia64-little

OFFSET           TYPE              VALUE 
0000000000410340 REL64LSB          *ABS*+0x0000000000000220
0000000000410360 REL64LSB          *ABS*+0x0000000000000220
0000000000410360 REL64LSB          *ABS*+0x0000000000000228

Note that there are two relocations for the same GOT entry that resolve to
different addresses (the strings "foo" and "bar", resp.)  The insn at
address 216 should have used its own GOT entry.

The problem is in elf64_ia64_relocate_section, adjusting the addends of
the local sym hash for the merge section (through
_bfd_merged_section_offset) creates multiple entries for the same addend.
In the testcase this results in two entries for addend 0 where one wants a
GOT entry, the other one doesn't.

           Summary: String merging breaks ia64 linker
           Product: binutils
           Version: 2.18 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: schwab at suse dot de
                CC: bug-binutils at gnu dot org,hjl at lucon dot org
GCC target triplet: ia64-*-*


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