[committed] aarch64: fix static pie enabled libc when main is in a shared library

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[committed] aarch64: fix static pie enabled libc when main is in a shared library

Szabolcs Nagy-2
In the static pie enabled libc, crt1.o uses the same position independent
code as rcrt1.o, and crt1.o is used instead of Scrt1.o when -no-pie
executables are linked.  When main is not defined in the executable, but
in a shared library crt1.o is currently broken, it assumes main is local.
(glibc has a test for this but i missed it in my previous testing.)

To make both rcrt1.o and crt1.o happy with the same code, a wrapper is
introduced around main: with this crt1.o works with extern main symbol
while rcrt1.o does not depend on GOT relocations. (The change only
affects static pie enabled libc. Further simplification of start.S is
possible in the future by using the same approach for Scrt1.o too.)

2018-01-12  Szabolcs Nagy  <[hidden email]>

        * aarch64/start.S (_start): Use __wrap_main.
        (__wrap_main): New local symbol.

start.diff (1K) Download Attachment