linker: add experimental support for SHT_RELR sections.
This change adds experimental support for SHT_RELR sections, proposed
here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
Definitions for the new ELF section type and dynamic array tags, as well
as the encoding used in the new section are all under discussion and are
subject to change. Use with caution!
Bug: None
Test: Built image for marlin, flashed on device, ran arm and
aarch64 binaries containing '.relr.dyn' sections.
Change-Id: I2953ae932d3c42ae394e71f8fa058013758a1778
diff --git a/libc/include/elf.h b/libc/include/elf.h
index 37450b2..bda11f5 100644
--- a/libc/include/elf.h
+++ b/libc/include/elf.h
@@ -194,6 +194,14 @@
Elf64_Word vna_next;
} Elf64_Vernaux;
+/* Relocation table entry for relative (in section of type SHT_RELR). */
+typedef Elf32_Word Elf32_Relr;
+typedef Elf64_Xword Elf64_Relr;
+#define ELF32_R_JUMP(val) ((val) >> 24)
+#define ELF32_R_BITS(val) ((val) & 0xffffff)
+#define ELF64_R_JUMP(val) ((val) >> 56)
+#define ELF64_R_BITS(val) ((val) & 0xffffffffffffff)
+
/* http://www.sco.com/developers/gabi/latest/ch5.dynamic.html */
#define DF_ORIGIN 0x00000001
#define DF_SYMBOLIC 0x00000002
@@ -242,6 +250,13 @@
#define DT_PREINIT_ARRAY 32
#define DT_PREINIT_ARRAYSZ 33
+/* Experimental support for SHT_RELR sections. For details, see proposal
+ at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg */
+#define DT_RELR 0x6fffe000
+#define DT_RELRSZ 0x6fffe001
+#define DT_RELRENT 0x6fffe003
+#define DT_RELRCOUNT 0x6fffe005
+
/* Android compressed rel/rela sections */
#define DT_ANDROID_REL (DT_LOOS + 2)
#define DT_ANDROID_RELSZ (DT_LOOS + 3)
@@ -494,6 +509,10 @@
#define SHT_LOOS 0x60000000
#define SHT_HIOS 0x6fffffff
+/* Experimental support for SHT_RELR sections. For details, see proposal
+ at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg */
+#define SHT_RELR 0x6fffff00
+
/* http://www.sco.com/developers/gabi/latest/ch4.symtab.html */
#define STN_UNDEF 0