diff options
author | andrew <andrew@FreeBSD.org> | 2015-07-02 15:02:59 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2015-07-02 15:02:59 +0000 |
commit | e48bb98eda2c9411ec3037480c33ce25d5a3fb37 (patch) | |
tree | 2903597deb2c8f1d7a8d0cbec62d8e559b103154 /lib/csu/aarch64 | |
parent | edb38c81905afb7251f87bdb60a5f9669bd2bd88 (diff) | |
download | FreeBSD-src-e48bb98eda2c9411ec3037480c33ce25d5a3fb37.zip FreeBSD-src-e48bb98eda2c9411ec3037480c33ce25d5a3fb37.tar.gz |
Force the dynamic linker to resolve _end early so we pick up the correct
copy.
Sponsored by: ABT Systems Ltd
Diffstat (limited to 'lib/csu/aarch64')
-rw-r--r-- | lib/csu/aarch64/crt1.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/csu/aarch64/crt1.c b/lib/csu/aarch64/crt1.c index de4455e..be59317 100644 --- a/lib/csu/aarch64/crt1.c +++ b/lib/csu/aarch64/crt1.c @@ -51,6 +51,8 @@ extern int eprol; extern int etext; #endif +extern long * _end; + void __start(int, char **, char **, void (*)(void)); /* The entry function. */ @@ -79,8 +81,17 @@ __start(int argc, char *argv[], char *env[], void (*cleanup)(void)) if (&_DYNAMIC != NULL) atexit(cleanup); - else + else { + /* + * Hack to resolve _end so we read the correct symbol. + * Without this it will resolve to the copy in the library + * that firsts requests it. We should fix the toolchain, + * however this is is needed until this can take place. + */ + *(volatile long *)&_end; + _init_tls(); + } #ifdef GCRT atexit(_mcleanup); |