Modernize SHT_RELR support.
Until now we've only supported RELR with our own OS-private-use
constants. Add support for the official numbers (while maintaining
support for the historical numbers).
Add tests to ensure we continue to support both indefinitely.
We can't yet flip the build system over to using the official constants
because the old GNU binutils objcopy we still use in most cases (for the
mini-debug section) only supports the historical constants.
Bug: http://b/147452927
Test: treehugger
Change-Id: If214fce7fade4316115947e90b78ab40864b61f2
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index 2ee6c86..29224f5 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -1497,3 +1497,29 @@
defaults: ["bionic_testlib_defaults"],
srcs: ["segment_gap_inner.cpp"],
}
+
+
+// -----------------------------------------------------------------------------
+// Check that we support both the old and new SHT_RELR constants.
+// -----------------------------------------------------------------------------
+
+cc_test_library {
+ name: "librelr-new",
+ ldflags: ["-Wl,--no-use-android-relr-tags"],
+ host_supported: false,
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["relr.cpp"],
+ // Hack to ensure we're using llvm-objcopy because our binutils prebuilt
+ // only supports the old numbers (http://b/141010852).
+ strip: {
+ keep_symbols: true,
+ },
+}
+
+cc_test_library {
+ name: "librelr-old",
+ ldflags: ["-Wl,--use-android-relr-tags"],
+ host_supported: false,
+ defaults: ["bionic_testlib_defaults"],
+ srcs: ["relr.cpp"],
+}