mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 10:42:45 +00:00
csu: Find the main pointer through the GOT
Use the Global Offset Table to find the location of main in crt1. With
lld the old code would point to main@plt, however ld.bfd fails to link
when main is in a shared library.
Fix this by using the GOT address to find main as it works with both
lld and bfd.
Reviewed by: jrtc27
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45259
(cherry picked from commit 53120fbb68
)
This commit is contained in:
parent
21f3f3e87e
commit
71f04a3609
@ -44,8 +44,8 @@ ENTRY(_start)
|
||||
add x2, x1, x0, lsl #3 /* env is after argv */
|
||||
add x2, x2, #8 /* argv is null terminated */
|
||||
#ifdef PIC
|
||||
adrp x4, main
|
||||
add x4, x4, :lo12:main
|
||||
adrp x4, :got:main
|
||||
ldr x4, [x4, :got_lo12:main]
|
||||
#else
|
||||
ldr x4, =main
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user