Fix DL_WARN_documented_change URL
The doc_link argument is really a URL fragment within the
android-changes-for-ndk-developers.md document, not a filename at the
root of the bionic repository.
Test: manual
Bug: none
Change-Id: I1b542e47aca132ce43ba1d50d83db1bf3c7b10c6
diff --git a/linker/linker.cpp b/linker/linker.cpp
index bf75178..ac83cae 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3273,9 +3273,8 @@
// Fail if app is targeting M or above.
int app_target_api_level = get_application_target_sdk_version();
if (app_target_api_level >= 23) {
- 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());
+ DL_ERR_AND_LOG("\"%s\" has text relocations (%s#Text-Relocations-Enforced-for-API-level-23)",
+ get_realpath(), kBionicChangesUrl);
return false;
}
// Make segments writable to allow text relocations to work properly. We will later call
diff --git a/linker/linker.h b/linker/linker.h
index 2da1404..9b6af3b 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -71,6 +71,10 @@
DISALLOW_COPY_AND_ASSIGN(VersionTracker);
};
+static constexpr const char* kBionicChangesUrl =
+ "https://android.googlesource.com/platform/bionic/+/master/"
+ "android-changes-for-ndk-developers.md";
+
soinfo* get_libdl_info(const soinfo& linker_si);
soinfo* find_containing_library(const void* p);
diff --git a/linker/linker_globals.cpp b/linker/linker_globals.cpp
index bcc2a1e..31da02c 100644
--- a/linker/linker_globals.cpp
+++ b/linker/linker_globals.cpp
@@ -50,7 +50,7 @@
return sizeof(__linker_dl_err_buf);
}
-void DL_WARN_documented_change(int api_level, const char* doc_link, const char* fmt, ...) {
+void DL_WARN_documented_change(int api_level, const char* doc_fragment, const char* fmt, ...) {
std::string result{"Warning: "};
va_list ap;
@@ -60,8 +60,9 @@
android::base::StringAppendF(&result,
" and will not work when the app moves to API level %d or later "
- "(https://android.googlesource.com/platform/bionic/+/master/%s) "
- "(allowing for now because this app's target API level is still %d)",
- api_level, doc_link, get_application_target_sdk_version());
+ "(%s#%s) (allowing for now because this app's target API level is "
+ "still %d)",
+ api_level, kBionicChangesUrl, doc_fragment,
+ get_application_target_sdk_version());
DL_WARN("%s", result.c_str());
}