platform_bionic/libc/arch-common/bionic
Matthew Maurer de30635eb6 Put __*_ARRAY__ symbols before prioritized init/fini funcs
A constructor or destructor function with an integral priority is
placed in an .init_array or .fini_array section with the priority
suffixed to the section name:
 - __attribute__((constructor)) ==> .init_array
 - __attribute__((constructor(42))) ==> .init_array.42

The suffixed init/fini sections appear before the unsuffixed sections,
so the prioritized functions appeared before the __{INIT,FINI}_ARRAY__
symbols and were dropped when the symbols were used.

The (static) linker doesn't recognize priority suffixes on
.preinit_array.

This bug affected .init_array and .fini_array for static executables.
For dynamic executables, only .fini_array was affected, because
.init_array is handled by the dynamic loader instead, which uses
DT_INIT_ARRAY[SZ]. For DSOs, neither is affected, because the two
sections are only handled by the dynamic loader.

This patch also fixes a minor inconsistency where dynamic init/preinit
were passed argc/argv/envp, but static were not.

Bug: http://b/170983066
Test: bionic-unit-tests
Change-Id: I0fffa776e5d9bdb6f8af06b4c1af148236742fef
2020-11-02 17:28:41 -08:00
..
__dso_handle.h Remove an obsolete aarch64 hack. 2017-10-25 10:57:02 -07:00
__dso_handle_so.h Move __dso_handle to RELRO 2019-08-26 20:35:00 -07:00
asm_multiarch.h Properly align init/fini_arrays for crtend.o 2015-05-07 12:56:15 -07:00
atexit.h Fixes for __cxa_finalize 2014-05-05 11:36:57 -07:00
crtbegin.c Put __*_ARRAY__ symbols before prioritized init/fini funcs 2020-11-02 17:28:41 -08:00
crtbegin_so.c Call __emutls_unregister_key on dlclose 2018-06-19 13:22:36 -07:00
crtbrand.S Update crtbegin.c and crt*.S to support Armv8.5-A BTI 2020-09-04 11:28:59 +02:00
crtend.S Merge "Enable arm64 .eh_frame terminator, align it to 4" 2020-10-01 01:08:38 +00:00
crtend_so.S Merge "Enable arm64 .eh_frame terminator, align it to 4" 2020-10-01 01:08:38 +00:00
pthread_atfork.h Stop using the __ANDROID_API_x__ constants. 2019-12-20 13:26:14 -08:00