diff options
author | Vineet Gupta <Vineet.Gupta1@synopsys.com> | 2016-06-23 17:21:15 +0530 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-06-23 20:48:25 +0200 |
commit | 2c3be84e73fa4013608e9b348386ddff91ae0c8c (patch) | |
tree | c828ba4f11ef6f97e7b67d326c4f79f8558f1588 /libc | |
parent | e58bacb7ec462912e843fc616288995db88b7275 (diff) |
ARC: Enable shared crt1
Currently crt1 takes address of functions (main,_init,_fini) directly
which doesn't generate truely position independent code, but zero based
values instead. e.g.
| __start:
| ...
| add_s r2,sp,0x4
| mov_s r0, main
generates to
| 000156ec <__start>:
| ...
| 156f4: add_s r2,sp,0x4
| 156f6: mov_s r0,0x15f7c
| ...
| 00015f7c <main>:
| 15f7c: push_s blink
This works just fine for the normal (non PIE) dynamic executables since
they are loaded at address 0. However this is not true for PIE
executables. So for Scrt1 we use a true position independent way when
taking function addresses.
Cc: uclibc@uclibc.org <uclibc@uclibc.org>
Cc: devel@uclibc-ng.org <devel@uclibc-ng.org>
Cc: Cupertino Miranda <cmiranda@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'libc')
-rw-r--r-- | libc/sysdeps/linux/arc/crt1.S | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/arc/crt1.S b/libc/sysdeps/linux/arc/crt1.S index 0fe3cf997..178c5b44f 100644 --- a/libc/sysdeps/linux/arc/crt1.S +++ b/libc/sysdeps/linux/arc/crt1.S @@ -41,11 +41,15 @@ __start: mov_s r5, r0 ; rltd_fini add_s r2, sp, 4 ; argv - +#ifdef L_Scrt1 + add r0, pcl, @main@pcl + add r3, pcl, @_init@pcl + add r4, pcl, @_fini@pcl +#else mov_s r0, main mov_s r3, _init mov r4, _fini - +#endif and sp, sp, -8 mov r6, sp |