ada: Implement __gnat_get_executable_load_address for Android
Even though Android is a variant of Linux, it doesn't expose
a _r_debug struct so handily as with GLIBC. Program headers
from dl_iterate_phdr show name/addr sequences of pairs such as
The name is not empty for the executable and there's no documentation
saying it would always come second or so, so this provides no obvious
reliable means to discriminate the exe load address.
As a variant of linux, the default link policy for Android authorizes
undefined refs when creating shared libs, with resolution deferred at least
until the lib is loaded. "main" will have to be available then, so resort
to dladdr(&main) to figure out the main module load address from here.
gcc/ada/ChangeLog:
* adaint.c (__gnat_get_executable_load_address): Provide
an implementation based on dladdr(&main) and use it for Android.