Fix linker self-exec detection
When the linker is invoked on itself, (`linker64 /system/bin/linker64`), the linker prints an error, because self-invocation isn't allowed. The current method for detecting self-invocation fails because the second linker instance can crash in a constructor function before reaching __linker_init. Fix the problem by moving the error check into a constructor function, which finishes initializing libc sufficiently to call async_safe_fatal. The only important thing missing is __libc_sysinfo on 32-bit x86. The aux vector isn't readily accessible, so use the fallback int 0x80. Bug: http://b/123637025 Test: bionic unit tests (32-bit x86) Change-Id: I8be6369e8be3938906628ae1f82be13e6c510119
Loading
Please sign in to comment