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/linker/linker.cpp b/linker/linker.cpp
index 57554fb..8de82d5 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3070,14 +3070,17 @@
#endif
case DT_RELR:
+ case DT_ANDROID_RELR:
relr_ = reinterpret_cast<ElfW(Relr)*>(load_bias + d->d_un.d_ptr);
break;
case DT_RELRSZ:
+ case DT_ANDROID_RELRSZ:
relr_count_ = d->d_un.d_val / sizeof(ElfW(Relr));
break;
case DT_RELRENT:
+ case DT_ANDROID_RELRENT:
if (d->d_un.d_val != sizeof(ElfW(Relr))) {
DL_ERR("invalid DT_RELRENT: %zd", static_cast<size_t>(d->d_un.d_val));
return false;
@@ -3085,7 +3088,8 @@
break;
// Ignored (see DT_RELCOUNT comments for details).
- case DT_RELRCOUNT:
+ // There is no DT_RELRCOUNT specifically because it would only be ignored.
+ case DT_ANDROID_RELRCOUNT:
break;
case DT_INIT: