Add linker support for PIE

Modify the dynamic linker so that executables can be loaded
at locations other than 0x00000000.

Modify crtbegin* so that non-PIC compilant "thumb interwork
veneers" are not created by the linker.

Bug: 5323301
Change-Id: Iece0272e2b708c79034f302c20160e1fe9029588
This commit is contained in:
Nick Kralevich
2011-10-20 14:57:56 -07:00
parent 4f05d1c758
commit 6cdefd06c0
3 changed files with 33 additions and 32 deletions

View File

@@ -43,21 +43,17 @@
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
# - address of the "main" function of the program.
#
# - address of the constructor list
#
_start:
mov r0, sp
mov r1, #0
adr r2, 0f
adr r3, 1f
b __libc_init
0: b main
ldr r2, =main
adr r3, 1f
ldr r4, =__libc_init
bx r4
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__

View File

@@ -43,21 +43,17 @@
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
# - address of the "main" function of the program.
#
# - address of the constructor list
#
_start:
mov r0, sp
mov r1, #0
adr r2, 0f
adr r3, 1f
b __libc_init
0: b main
ldr r2, =main
adr r3, 1f
ldr r4, =__libc_init
bx r4
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__