-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PowerPC32 treatment of absolute symbols
As already done for PowerPC64, fix dynamic relocs for absolute symbols. The patch also tidies the dynamic reloc handling code in check_relocs, removing leftover comments and code from when check_relocs was called as each object file was read in. bfd/ * elf32-ppc.c (ppc_elf_check_relocs): Set isym and ifunc earlier. Rearrange tests for dynamic relocs, handling absolute symbols. (allocate_dynrelocs): Don't allocate dynamic relocs for locally defined absolute symbols. (ppc_elf_size_dynamic_sections): Similarly. (ppc_elf_relocate_section): Similarly. ld/ * testsuite/ld-powerpc/abs32-pie.d, * testsuite/ld-powerpc/abs32-pie.r, * testsuite/ld-powerpc/abs32-reloc.s, * testsuite/ld-powerpc/abs32-shared.d, * testsuite/ld-powerpc/abs32-shared.r, * testsuite/ld-powerpc/abs32-static.d, * testsuite/ld-powerpc/abs32-static.r: New tests. * testsuite/ld-powerpc/powerpc.exp: Run them.
- Loading branch information
Showing
9 changed files
with
205 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#source: abs32-reloc.s | ||
#as: -a32 | ||
#ld: -melf32ppc -pie --hash-style=sysv --defsym a=1 --defsym 'HIDDEN(b=2)' --defsym c=0x12345678 | ||
#objdump: -dr | ||
|
||
.*: file format .* | ||
|
||
Disassembly of section \.text: | ||
|
||
00000138 <_start>: | ||
138: (80 fe ff f0|f0 ff fe 80) lwz r7,-16\(r30\) | ||
13c: (81 1e ff f8|f8 ff 1e 81) lwz r8,-8\(r30\) | ||
140: (81 3e ff ec|ec ff 3e 81) lwz r9,-20\(r30\) | ||
144: (81 5e ff f4|f4 ff 5e 81) lwz r10,-12\(r30\) | ||
|
||
Disassembly of section \.got: | ||
|
||
000101d8 <\.got>: | ||
101d8: (00 00 00 02|02 00 00 00) .* | ||
101dc: (00 00 00 00|00 00 00 00) .* | ||
101e0: (12 34 56 78|78 56 34 12) .* | ||
101e4: (00 00 00 01|01 00 00 00) .* | ||
101e8: (4e 80 00 21|21 00 80 4e) blrl | ||
|
||
000101ec <_GLOBAL_OFFSET_TABLE_>: | ||
101ec: (00 01 01 48|48 01 01 00) 00 00 00 00 00 00 00 00 .* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#source: abs32-reloc.s | ||
#as: -a32 | ||
#ld: -melf32ppc -pie --hash-style=sysv --defsym a=1 --defsym 'HIDDEN(b=2)' --defsym c=0x12345678 | ||
#readelf: -rW | ||
|
||
Relocation section '\.rela\.dyn' at offset .* contains 2 entries: | ||
Offset Info Type Sym\. Value Symbol's Name \+ Addend | ||
000101c8 00000016 R_PPC_RELATIVE 101c8 | ||
000101dc 00000016 R_PPC_RELATIVE 101c8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.globl x | ||
.hidden x | ||
|
||
.data | ||
.p2align 2 | ||
x: | ||
.long x | ||
.long a | ||
.long b | ||
.long c | ||
|
||
.text | ||
.p2align 2 | ||
.globl _start | ||
.type _start,@function | ||
_start: | ||
0: | ||
lwz 7,x@got(30) | ||
lwz 8,a@got(30) | ||
lwz 9,b@got(30) | ||
lwz 10,c@got(30) | ||
.size _start,.-_start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#source: abs32-reloc.s | ||
#as: -a32 | ||
#ld: -melf32ppc -shared --hash-style=sysv --defsym a=1 --defsym 'HIDDEN(b=2)' --defsym c=0x12345678 | ||
#objdump: -dr | ||
|
||
.*: file format .* | ||
|
||
Disassembly of section \.text: | ||
|
||
00000160 <_start>: | ||
160: (80 fe ff f0|f0 ff fe 80) lwz r7,-16\(r30\) | ||
164: (81 1e ff f8|f8 ff 1e 81) lwz r8,-8\(r30\) | ||
168: (81 3e ff ec|ec ff 3e 81) lwz r9,-20\(r30\) | ||
16c: (81 5e ff f4|f4 ff 5e 81) lwz r10,-12\(r30\) | ||
|
||
Disassembly of section \.got: | ||
|
||
000101f0 <\.got>: | ||
101f0: (00 00 00 02|02 00 00 00) .* | ||
.\.\. | ||
10200: (4e 80 00 21|21 00 80 4e) blrl | ||
|
||
00010204 <_GLOBAL_OFFSET_TABLE_>: | ||
10204: (00 01 01 70|70 01 01 00) 00 00 00 00 00 00 00 00 .* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#source: abs32-reloc.s | ||
#as: -a32 | ||
#ld: -melf32ppc -shared --hash-style=sysv --defsym a=1 --defsym 'HIDDEN(b=2)' --defsym c=0x12345678 | ||
#readelf: -rW | ||
|
||
Relocation section '\.rela\.dyn' at offset .* contains 6 entries: | ||
Offset Info Type Sym\. Value Symbol's Name \+ Addend | ||
000101e0 00000016 R_PPC_RELATIVE 101e0 | ||
000101f4 00000016 R_PPC_RELATIVE 101e0 | ||
000101e4 00000401 R_PPC_ADDR32 00000001 a \+ 0 | ||
000101fc 00000414 R_PPC_GLOB_DAT 00000001 a \+ 0 | ||
000101ec 00000301 R_PPC_ADDR32 12345678 c \+ 0 | ||
000101f8 00000314 R_PPC_GLOB_DAT 12345678 c \+ 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#source: abs32-reloc.s | ||
#as: -a32 | ||
#ld: -melf32ppc -static --defsym a=1 --defsym 'HIDDEN(b=2)' --defsym c=0x12345678 | ||
#objdump: -dr | ||
|
||
.*: file format .* | ||
|
||
Disassembly of section \.text: | ||
|
||
01800074 <_start>: | ||
1800074: (80 fe ff f0|f0 ff fe 80) lwz r7,-16\(r30\) | ||
1800078: (81 1e ff f8|f8 ff 1e 81) lwz r8,-8\(r30\) | ||
180007c: (81 3e ff ec|ec ff 3e 81) lwz r9,-20\(r30\) | ||
1800080: (81 5e ff f4|f4 ff 5e 81) lwz r10,-12\(r30\) | ||
|
||
Disassembly of section \.got: | ||
|
||
01810094 <\.got>: | ||
1810094: (00 00 00 02|02 00 00 00) .* | ||
1810098: (01 81 00 84|84 00 81 01) .* | ||
181009c: (12 34 56 78|78 56 34 12) .* | ||
18100a0: (00 00 00 01|01 00 00 00) .* | ||
18100a4: (4e 80 00 21|21 00 80 4e) blrl | ||
|
||
018100a8 <_GLOBAL_OFFSET_TABLE_>: | ||
\.\.\. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#source: abs32-reloc.s | ||
#as: -a32 | ||
#ld: -melf32ppc -static --defsym a=1 --defsym 'HIDDEN(b=2)' --defsym c=0x12345678 | ||
#readelf: -rW | ||
|
||
There are no relocations in this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters