Send developers straight to the text relocation docs.
It's been years since we allowed text relocations, but I had a developer
ask me how to fix them at last week's O Developer Day. They'd never seen
our docs, so let's try to fix that for anyone else who's still confused...
Bug: N/A
Test: builds
Change-Id: I9202a7b0a3f024041b646c43c87585f4fab22d09
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 2777d73..f52c2f3 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3251,13 +3251,16 @@
if (has_text_relocations) {
// Fail if app is targeting M or above.
if (get_application_target_sdk_version() >= __ANDROID_API_M__) {
- DL_ERR_AND_LOG("\"%s\" has text relocations", get_realpath());
+ DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
+ "bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-"
+ "Enforced-for-API-level-23)", get_realpath());
return false;
}
// Make segments writable to allow text relocations to work properly. We will later call
// phdr_table_protect_segments() after all of them are applied.
- DL_WARN("\"%s\" has text relocations. This is wasting memory and prevents "
- "security hardening. Please fix.", get_realpath());
+ DL_WARN("\"%s\" has text relocations (https://android.googlesource.com/platform/"
+ "bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-"
+ "for-API-level-23)", get_realpath());
add_dlwarning(get_realpath(), "text relocations");
if (phdr_table_unprotect_segments(phdr, phnum, load_bias) < 0) {
DL_ERR("can't unprotect loadable segments for \"%s\": %s",