binutils-gdb/ld/testsuite/ld-arm/protected-data.s
Szabolcs Nagy b68a20d667 [ARM] Fix extern protected data handling
Emit *GLOB_DAT instead of *RELATIVE relocs for protected data
in shared objects.

This is needed for the fix of glibc bug 17711:
https://sourceware.org/bugzilla/show_bug.cgi?id=17711

bfd:
	PR ld/18705
	* elf32-arm.c (elf_backend_extern_protected_data): Define.

ld/testsuite:
	PR ld/18705
	* ld-arm/protected-data.d: New.
	* ld-arm/protected-data.s: New.
	* ld-arm/arm-elf.exp: Add new test.
2015-07-27 11:45:27 +01:00

30 lines
360 B
ArmAsm

.syntax unified
.data
.protected var
.global var
.align 2
.type var, %object
.size var, 4
var:
.word 1
.text
.align 2
.global getaddr
.thumb
.thumb_func
.type getaddr, %function
getaddr:
ldr r3, 2f
ldr r2, 2f+4
1:
add r3, pc
ldr r0, [r3, r2]
bx lr
.align 2
2:
.word _GLOBAL_OFFSET_TABLE_-(1b+4)
.word var(GOT)
.size getaddr, .-getaddr