[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gold/16794] New: gold doesn't include the "implicit addend" when pr
From: |
rafael.espindola at gmail dot com |
Subject: |
[Bug gold/16794] New: gold doesn't include the "implicit addend" when processing REL relocations to mergable sections |
Date: |
Tue, 01 Apr 2014 20:59:12 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=16794
Bug ID: 16794
Summary: gold doesn't include the "implicit addend" when
processing REL relocations to mergable sections
Product: binutils
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: gold
Assignee: ian at airs dot com
Reporter: rafael.espindola at gmail dot com
CC: ccoutant at google dot com
Created attachment 7516
--> https://sourceware.org/bugzilla/attachment.cgi?id=7516&action=edit
testcase
The attached testcase has both 32 and 64 bit versions of a test. The file
test.o contains relocations to a mergeable section. In the 32 bit case it has:
00000012 00000509 R_386_GOTOFF 00000000 .rodata.str1.1
0000001c 00000509 R_386_GOTOFF 00000000 .rodata.str1.1
The "implicit addend" are in the two lea instructions:
objdump -d test.o
10: 8d 83 07 00 00 00 lea 0x7(%ebx),%eax
16: 89 44 24 04 mov %eax,0x4(%esp)
1a: 8d 83 00 00 00 00 lea 0x0(%ebx),%eax
On the gold produced output, the distance between the two is still 7 (0x11ac-
0x11a5)
80484e0: 8d 83 5b ee ff ff lea -0x11a5(%ebx),%eax
80484e6: 89 44 24 04 mov %eax,0x4(%esp)
80484ea: 8d 83 54 ee ff ff lea -0x11ac(%ebx),%eax
The the actual section has been modified to merge the strings, so that is no
longer valid.
Using bfd ld, the offset is updated:
8048460: 8d 83 4d ee ff ff lea -0x11b3(%ebx),%eax
8048466: 89 44 24 04 mov %eax,0x4(%esp)
804846a: 8d 83 4c ee ff ff lea -0x11b4(%ebx),%ea
Everything works on 64 bits. I assume that is because it uses RELA relocations.
In 64 bits the test.o file has
000000000003 000500000002 R_X86_64_PC32 0000000000000000 .rodata.str1.1 +
0
00000000000a 000500000002 R_X86_64_PC32 0000000000000000 .rodata.str1.1 +
7
0: 48 8d 3d 00 00 00 00 lea 0x0(%rip),%rdi
7: 48 8d 35 00 00 00 00 lea 0x0(%rip),%rsi
and the final binary is update correctly
400530: 48 8d 3d ad 00 00 00 lea 0xad(%rip),%rdi
400537: 48 8d 35 a7 00 00 00 lea 0xa7(%rip),%rsi
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gold/16794] New: gold doesn't include the "implicit addend" when processing REL relocations to mergable sections,
rafael.espindola at gmail dot com <=