| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/09/08 07:44 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch series introduces a build-time ELF relocation checker tool (vdsocheck host program written in Rust), adjusts Makefiles to run this build-time check on vDSO images, and refactors ELF relocation macro definitions across architecture headers into a unified uapi header (linux/elf-r.h). No runtime kernel executable code, data structures, or logic are modified.",
"WorthFuzzing": false
} |
| 1/1 | 2026/09/08 07:44 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 9747acb9f056fc9dbdeca1bd2df9516d807987b0\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Tue Sep 8 07:44:43 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/Makefile b/Makefile\nindex 4ad67b737af7a..e6e0dd7818ef3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1559,6 +1559,25 @@ vdso_install: export INSTALL_FILES = $(vdso-install-y)\n vdso_install:\n \t$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst\n \n+# ---------------------------------------------------------------------------\n+# vDSO check\n+\n+ifdef CONFIG_RUST_IS_AVAILABLE\n+ifdef CONFIG_VDSO_CHECK\n+\n+# Build the checker early.\n+prepare: vdsocheck\n+\n+# If the architecture builds the vDSO early, make sure to be earlier.\n+PHONY += vdso_prepare\n+vdso_prepare: vdsocheck\n+\n+PHONY += vdsocheck\n+vdsocheck:\n+\t$(Q)$(MAKE) $(build)=lib/vdso/check $@\n+endif\n+endif\n+\n # ---------------------------------------------------------------------------\n # Tools\n \ndiff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h\nindex 9f21e170320fc..ec2d416baa9f7 100644\n--- a/arch/arm/include/asm/elf.h\n+++ b/arch/arm/include/asm/elf.h\n@@ -47,30 +47,6 @@ typedef struct user_fp elf_fpregset_t;\n #define EF_ARM_HASENTRY\t\t0x00000002\t/* All */\n #define EF_ARM_RELEXEC\t\t0x00000001\t/* All */\n \n-#define R_ARM_NONE\t\t0\n-#define R_ARM_PC24\t\t1\n-#define R_ARM_ABS32\t\t2\n-#define R_ARM_REL32\t\t3\n-#define R_ARM_CALL\t\t28\n-#define R_ARM_JUMP24\t\t29\n-#define R_ARM_TARGET1\t\t38\n-#define R_ARM_V4BX\t\t40\n-#define R_ARM_PREL31\t\t42\n-#define R_ARM_MOVW_ABS_NC\t43\n-#define R_ARM_MOVT_ABS\t\t44\n-#define R_ARM_MOVW_PREL_NC\t45\n-#define R_ARM_MOVT_PREL\t\t46\n-#define R_ARM_ALU_PC_G0_NC\t57\n-#define R_ARM_ALU_PC_G1_NC\t59\n-#define R_ARM_LDR_PC_G2\t\t63\n-\n-#define R_ARM_THM_CALL\t\t10\n-#define R_ARM_THM_JUMP24\t30\n-#define R_ARM_THM_MOVW_ABS_NC\t47\n-#define R_ARM_THM_MOVT_ABS\t48\n-#define R_ARM_THM_MOVW_PREL_NC\t49\n-#define R_ARM_THM_MOVT_PREL\t50\n-\n /*\n * These are used to set parameters in the core dumps.\n */\ndiff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile\nindex cf8cd39ab8046..fd34d0ff018a8 100644\n--- a/arch/arm/vdso/Makefile\n+++ b/arch/arm/vdso/Makefile\n@@ -37,7 +37,7 @@ endif\n $(obj)/vdso.o : $(obj)/vdso.so\n \n # Link rule for the .so file\n-$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE\n+$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_vdso_check)\n \n $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE\n@@ -50,7 +50,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE\n \n # Actual build commands\n quiet_cmd_vdsold_and_vdso_check = LD $@\n- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)\n+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)\n \n quiet_cmd_vdsomunge = MUNGE $@\n cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $\u003c $@\ndiff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h\nindex d2779d604c7be..43f3763807a2f 100644\n--- a/arch/arm64/include/asm/elf.h\n+++ b/arch/arm64/include/asm/elf.h\n@@ -13,61 +13,6 @@\n #include \u003casm/ptrace.h\u003e\n #include \u003casm/user.h\u003e\n \n-/*\n- * AArch64 static relocation types.\n- */\n-\n-/* Miscellaneous. */\n-#define R_ARM_NONE\t\t\t0\n-#define R_AARCH64_NONE\t\t\t256\n-\n-/* Data. */\n-#define R_AARCH64_ABS64\t\t\t257\n-#define R_AARCH64_ABS32\t\t\t258\n-#define R_AARCH64_ABS16\t\t\t259\n-#define R_AARCH64_PREL64\t\t260\n-#define R_AARCH64_PREL32\t\t261\n-#define R_AARCH64_PREL16\t\t262\n-\n-/* Instructions. */\n-#define R_AARCH64_MOVW_UABS_G0\t\t263\n-#define R_AARCH64_MOVW_UABS_G0_NC\t264\n-#define R_AARCH64_MOVW_UABS_G1\t\t265\n-#define R_AARCH64_MOVW_UABS_G1_NC\t266\n-#define R_AARCH64_MOVW_UABS_G2\t\t267\n-#define R_AARCH64_MOVW_UABS_G2_NC\t268\n-#define R_AARCH64_MOVW_UABS_G3\t\t269\n-\n-#define R_AARCH64_MOVW_SABS_G0\t\t270\n-#define R_AARCH64_MOVW_SABS_G1\t\t271\n-#define R_AARCH64_MOVW_SABS_G2\t\t272\n-\n-#define R_AARCH64_LD_PREL_LO19\t\t273\n-#define R_AARCH64_ADR_PREL_LO21\t\t274\n-#define R_AARCH64_ADR_PREL_PG_HI21\t275\n-#define R_AARCH64_ADR_PREL_PG_HI21_NC\t276\n-#define R_AARCH64_ADD_ABS_LO12_NC\t277\n-#define R_AARCH64_LDST8_ABS_LO12_NC\t278\n-\n-#define R_AARCH64_TSTBR14\t\t279\n-#define R_AARCH64_CONDBR19\t\t280\n-#define R_AARCH64_JUMP26\t\t282\n-#define R_AARCH64_CALL26\t\t283\n-#define R_AARCH64_LDST16_ABS_LO12_NC\t284\n-#define R_AARCH64_LDST32_ABS_LO12_NC\t285\n-#define R_AARCH64_LDST64_ABS_LO12_NC\t286\n-#define R_AARCH64_LDST128_ABS_LO12_NC\t299\n-\n-#define R_AARCH64_MOVW_PREL_G0\t\t287\n-#define R_AARCH64_MOVW_PREL_G0_NC\t288\n-#define R_AARCH64_MOVW_PREL_G1\t\t289\n-#define R_AARCH64_MOVW_PREL_G1_NC\t290\n-#define R_AARCH64_MOVW_PREL_G2\t\t291\n-#define R_AARCH64_MOVW_PREL_G2_NC\t292\n-#define R_AARCH64_MOVW_PREL_G3\t\t293\n-\n-#define R_AARCH64_RELATIVE\t\t1027\n-\n /*\n * These are used to set parameters in the core dumps.\n */\ndiff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile\nindex 7dec05dd33b70..9fac0e54097dc 100644\n--- a/arch/arm64/kernel/vdso/Makefile\n+++ b/arch/arm64/kernel/vdso/Makefile\n@@ -61,7 +61,7 @@ targets += vdso.lds\n CPPFLAGS_vdso.lds += -P -C -U$(ARCH)\n \n # Link rule for the .so file, .lds has to be first\n-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE\n+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_vdso_check)\n \n # Strip rule for the .so file\n@@ -79,4 +79,4 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE\n \n # Actual build commands\n quiet_cmd_vdsold_and_vdso_check = LD $@\n- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)\n+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)\ndiff --git a/arch/loongarch/include/asm/elf.h b/arch/loongarch/include/asm/elf.h\nindex 912c50cdd6b7c..3cbce7e772fa2 100644\n--- a/arch/loongarch/include/asm/elf.h\n+++ b/arch/loongarch/include/asm/elf.h\n@@ -21,136 +21,6 @@\n #define EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT\t0x6\n #define EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT\t0x7\n \n-/* LoongArch relocation types used by the dynamic linker */\n-#define R_LARCH_NONE\t\t\t\t0\n-#define R_LARCH_32\t\t\t\t1\n-#define R_LARCH_64\t\t\t\t2\n-#define R_LARCH_RELATIVE\t\t\t3\n-#define R_LARCH_COPY\t\t\t\t4\n-#define R_LARCH_JUMP_SLOT\t\t\t5\n-#define R_LARCH_TLS_DTPMOD32\t\t\t6\n-#define R_LARCH_TLS_DTPMOD64\t\t\t7\n-#define R_LARCH_TLS_DTPREL32\t\t\t8\n-#define R_LARCH_TLS_DTPREL64\t\t\t9\n-#define R_LARCH_TLS_TPREL32\t\t\t10\n-#define R_LARCH_TLS_TPREL64\t\t\t11\n-#define R_LARCH_IRELATIVE\t\t\t12\n-#define R_LARCH_MARK_LA\t\t\t\t20\n-#define R_LARCH_MARK_PCREL\t\t\t21\n-#define R_LARCH_SOP_PUSH_PCREL\t\t\t22\n-#define R_LARCH_SOP_PUSH_ABSOLUTE\t\t23\n-#define R_LARCH_SOP_PUSH_DUP\t\t\t24\n-#define R_LARCH_SOP_PUSH_GPREL\t\t\t25\n-#define R_LARCH_SOP_PUSH_TLS_TPREL\t\t26\n-#define R_LARCH_SOP_PUSH_TLS_GOT\t\t27\n-#define R_LARCH_SOP_PUSH_TLS_GD\t\t\t28\n-#define R_LARCH_SOP_PUSH_PLT_PCREL\t\t29\n-#define R_LARCH_SOP_ASSERT\t\t\t30\n-#define R_LARCH_SOP_NOT\t\t\t\t31\n-#define R_LARCH_SOP_SUB\t\t\t\t32\n-#define R_LARCH_SOP_SL\t\t\t\t33\n-#define R_LARCH_SOP_SR\t\t\t\t34\n-#define R_LARCH_SOP_ADD\t\t\t\t35\n-#define R_LARCH_SOP_AND\t\t\t\t36\n-#define R_LARCH_SOP_IF_ELSE\t\t\t37\n-#define R_LARCH_SOP_POP_32_S_10_5\t\t38\n-#define R_LARCH_SOP_POP_32_U_10_12\t\t39\n-#define R_LARCH_SOP_POP_32_S_10_12\t\t40\n-#define R_LARCH_SOP_POP_32_S_10_16\t\t41\n-#define R_LARCH_SOP_POP_32_S_10_16_S2\t\t42\n-#define R_LARCH_SOP_POP_32_S_5_20\t\t43\n-#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2\t44\n-#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2\t45\n-#define R_LARCH_SOP_POP_32_U\t\t\t46\n-#define R_LARCH_ADD8\t\t\t\t47\n-#define R_LARCH_ADD16\t\t\t\t48\n-#define R_LARCH_ADD24\t\t\t\t49\n-#define R_LARCH_ADD32\t\t\t\t50\n-#define R_LARCH_ADD64\t\t\t\t51\n-#define R_LARCH_SUB8\t\t\t\t52\n-#define R_LARCH_SUB16\t\t\t\t53\n-#define R_LARCH_SUB24\t\t\t\t54\n-#define R_LARCH_SUB32\t\t\t\t55\n-#define R_LARCH_SUB64\t\t\t\t56\n-#define R_LARCH_GNU_VTINHERIT\t\t\t57\n-#define R_LARCH_GNU_VTENTRY\t\t\t58\n-#define R_LARCH_B16\t\t\t\t64\n-#define R_LARCH_B21\t\t\t\t65\n-#define R_LARCH_B26\t\t\t\t66\n-#define R_LARCH_ABS_HI20\t\t\t67\n-#define R_LARCH_ABS_LO12\t\t\t68\n-#define R_LARCH_ABS64_LO20\t\t\t69\n-#define R_LARCH_ABS64_HI12\t\t\t70\n-#define R_LARCH_PCALA_HI20\t\t\t71\n-#define R_LARCH_PCALA_LO12\t\t\t72\n-#define R_LARCH_PCALA64_LO20\t\t\t73\n-#define R_LARCH_PCALA64_HI12\t\t\t74\n-#define R_LARCH_GOT_PC_HI20\t\t\t75\n-#define R_LARCH_GOT_PC_LO12\t\t\t76\n-#define R_LARCH_GOT64_PC_LO20\t\t\t77\n-#define R_LARCH_GOT64_PC_HI12\t\t\t78\n-#define R_LARCH_GOT_HI20\t\t\t79\n-#define R_LARCH_GOT_LO12\t\t\t80\n-#define R_LARCH_GOT64_LO20\t\t\t81\n-#define R_LARCH_GOT64_HI12\t\t\t82\n-#define R_LARCH_TLS_LE_HI20\t\t\t83\n-#define R_LARCH_TLS_LE_LO12\t\t\t84\n-#define R_LARCH_TLS_LE64_LO20\t\t\t85\n-#define R_LARCH_TLS_LE64_HI12\t\t\t86\n-#define R_LARCH_TLS_IE_PC_HI20\t\t\t87\n-#define R_LARCH_TLS_IE_PC_LO12\t\t\t88\n-#define R_LARCH_TLS_IE64_PC_LO20\t\t89\n-#define R_LARCH_TLS_IE64_PC_HI12\t\t90\n-#define R_LARCH_TLS_IE_HI20\t\t\t91\n-#define R_LARCH_TLS_IE_LO12\t\t\t92\n-#define R_LARCH_TLS_IE64_LO20\t\t\t93\n-#define R_LARCH_TLS_IE64_HI12\t\t\t94\n-#define R_LARCH_TLS_LD_PC_HI20\t\t\t95\n-#define R_LARCH_TLS_LD_HI20\t\t\t96\n-#define R_LARCH_TLS_GD_PC_HI20\t\t\t97\n-#define R_LARCH_TLS_GD_HI20\t\t\t98\n-#define R_LARCH_32_PCREL\t\t\t99\n-#define R_LARCH_RELAX\t\t\t\t100\n-#define R_LARCH_DELETE\t\t\t\t101\n-#define R_LARCH_ALIGN\t\t\t\t102\n-#define R_LARCH_PCREL20_S2\t\t\t103\n-#define R_LARCH_CFA\t\t\t\t104\n-#define R_LARCH_ADD6\t\t\t\t105\n-#define R_LARCH_SUB6\t\t\t\t106\n-#define R_LARCH_ADD_ULEB128\t\t\t107\n-#define R_LARCH_SUB_ULEB128\t\t\t108\n-#define R_LARCH_64_PCREL\t\t\t109\n-#define R_LARCH_CALL36\t\t\t\t110\n-#define R_LARCH_TLS_DESC_PC_HI20\t\t111\n-#define R_LARCH_TLS_DESC_PC_LO12\t\t112\n-#define R_LARCH_TLS_DESC64_PC_LO20\t\t113\n-#define R_LARCH_TLS_DESC64_PC_HI12\t\t114\n-#define R_LARCH_TLS_DESC_HI20\t\t\t115\n-#define R_LARCH_TLS_DESC_LO12\t\t\t116\n-#define R_LARCH_TLS_DESC64_LO20\t\t\t117\n-#define R_LARCH_TLS_DESC64_HI12\t\t\t118\n-#define R_LARCH_TLS_DESC_LD\t\t\t119\n-#define R_LARCH_TLS_DESC_CALL\t\t\t120\n-#define R_LARCH_TLS_LE_HI20_R\t\t\t121\n-#define R_LARCH_TLS_LE_ADD_R\t\t\t122\n-#define R_LARCH_TLS_LE_LO12_R\t\t\t123\n-#define R_LARCH_TLS_LD_PCREL20_S2\t\t124\n-#define R_LARCH_TLS_GD_PCREL20_S2\t\t125\n-#define R_LARCH_TLS_DESC_PCREL20_S2\t\t126\n-#define R_LARCH_CALL30\t\t\t\t127\n-#define R_LARCH_PCADD_HI20\t\t\t128\n-#define R_LARCH_PCADD_LO12\t\t\t129\n-#define R_LARCH_GOT_PCADD_HI20\t\t\t130\n-#define R_LARCH_GOT_PCADD_LO12\t\t\t131\n-#define R_LARCH_TLS_IE_PCADD_HI20\t\t132\n-#define R_LARCH_TLS_IE_PCADD_LO12\t\t133\n-#define R_LARCH_TLS_LD_PCADD_HI20\t\t134\n-#define R_LARCH_TLS_LD_PCADD_LO12\t\t135\n-#define R_LARCH_TLS_GD_PCADD_HI20\t\t136\n-#define R_LARCH_TLS_GD_PCADD_LO12\t\t137\n-#define R_LARCH_TLS_DESC_PCADD_HI20\t\t138\n-#define R_LARCH_TLS_DESC_PCADD_LO12\t\t139\n-\n #ifndef ELF_ARCH\n \n /* ELF register definitions */\ndiff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile\nindex 9c9181bb40715..b0dc583286642 100644\n--- a/arch/loongarch/vdso/Makefile\n+++ b/arch/loongarch/vdso/Makefile\n@@ -50,7 +50,7 @@ ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \\\n #\n \n quiet_cmd_vdsold_and_vdso_check = LD $@\n- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)\n+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)\n \n quiet_cmd_vdsoas_o_S = AS $@\n cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $\u003c\n@@ -79,7 +79,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)\n \n $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)\n \n-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE\n+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_vdso_check)\n \n $(obj)/vdso.so: OBJCOPYFLAGS := -S\ndiff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h\nindex aaef0eaa68d55..347e12584beeb 100644\n--- a/arch/mips/include/asm/elf.h\n+++ b/arch/mips/include/asm/elf.h\n@@ -70,61 +70,6 @@\n #define DT_MIPS_HIPAGENO\t0x70000014\n #define DT_MIPS_RLD_MAP\t\t0x70000016\n \n-#define R_MIPS_NONE\t\t0\n-#define R_MIPS_16\t\t1\n-#define R_MIPS_32\t\t2\n-#define R_MIPS_REL32\t\t3\n-#define R_MIPS_26\t\t4\n-#define R_MIPS_HI16\t\t5\n-#define R_MIPS_LO16\t\t6\n-#define R_MIPS_GPREL16\t\t7\n-#define R_MIPS_LITERAL\t\t8\n-#define R_MIPS_GOT16\t\t9\n-#define R_MIPS_PC16\t\t10\n-#define R_MIPS_CALL16\t\t11\n-#define R_MIPS_GPREL32\t\t12\n-/* The remaining relocs are defined on Irix, although they are not\n- in the MIPS ELF ABI.\t */\n-#define R_MIPS_UNUSED1\t\t13\n-#define R_MIPS_UNUSED2\t\t14\n-#define R_MIPS_UNUSED3\t\t15\n-#define R_MIPS_SHIFT5\t\t16\n-#define R_MIPS_SHIFT6\t\t17\n-#define R_MIPS_64\t\t18\n-#define R_MIPS_GOT_DISP\t\t19\n-#define R_MIPS_GOT_PAGE\t\t20\n-#define R_MIPS_GOT_OFST\t\t21\n-/*\n- * The following two relocation types are specified in the MIPS ABI\n- * conformance guide version 1.2 but not yet in the psABI.\n- */\n-#define R_MIPS_GOTHI16\t\t22\n-#define R_MIPS_GOTLO16\t\t23\n-#define R_MIPS_SUB\t\t24\n-#define R_MIPS_INSERT_A\t\t25\n-#define R_MIPS_INSERT_B\t\t26\n-#define R_MIPS_DELETE\t\t27\n-#define R_MIPS_HIGHER\t\t28\n-#define R_MIPS_HIGHEST\t\t29\n-/*\n- * The following two relocation types are specified in the MIPS ABI\n- * conformance guide version 1.2 but not yet in the psABI.\n- */\n-#define R_MIPS_CALLHI16\t\t30\n-#define R_MIPS_CALLLO16\t\t31\n-/*\n- * Introduced for MIPSr6.\n- */\n-#define R_MIPS_PC21_S2\t\t60\n-#define R_MIPS_PC26_S2\t\t61\n-/*\n- * This range is reserved for vendor specific relocations.\n- */\n-#define R_MIPS_LOVENDOR\t\t100\n-#define R_MIPS_HIVENDOR\t\t127\n-\n-#define R_MIPS_PC32\t\t248\n-\n #define SHN_MIPS_ACCOMON\t0xff00\t\t/* Allocated common symbols */\n #define SHN_MIPS_TEXT\t\t0xff01\t\t/* Allocated test symbols. */\n #define SHN_MIPS_DATA\t\t0xff02\t\t/* Allocated data symbols. */\ndiff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile\nindex 00d3ba2c482ac..63060057cd213 100644\n--- a/arch/mips/vdso/Makefile\n+++ b/arch/mips/vdso/Makefile\n@@ -66,7 +66,7 @@ quiet_cmd_vdso_mips_check = VDSOCHK $@\n #\n \n quiet_cmd_vdsold_and_vdso_check = LD $@\n- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check); $(cmd_vdso_mips_check)\n+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check); $(cmd_vdso_mips_check)\n \n quiet_cmd_vdsoas_o_S = AS $@\n cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $\u003c\n@@ -103,7 +103,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)\n \n $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)\n \n-$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE\n+$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_vdso_check)\n \n $(obj)/vdso-image.c: $(obj)/vdso.so.dbg.raw $(obj)/vdso.so.raw \\\n@@ -141,7 +141,7 @@ $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32\n $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE\n \t$(call if_changed_dep,cpp_lds_S)\n \n-$(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE\n+$(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_vdso_check)\n \n $(obj)/vdso-o32-image.c: VDSO_NAME := o32\n@@ -181,7 +181,7 @@ $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32\n $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE\n \t$(call if_changed_dep,cpp_lds_S)\n \n-$(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE\n+$(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_vdso_check)\n \n $(obj)/vdso-n32-image.c: VDSO_NAME := n32\ndiff --git a/arch/powerpc/include/uapi/asm/elf.h b/arch/powerpc/include/uapi/asm/elf.h\nindex a5377f494fa31..aba921b8249a2 100644\n--- a/arch/powerpc/include/uapi/asm/elf.h\n+++ b/arch/powerpc/include/uapi/asm/elf.h\n@@ -17,78 +17,6 @@\n #include \u003casm/cputable.h\u003e\n #include \u003casm/auxvec.h\u003e\n \n-/* PowerPC relocations defined by the ABIs */\n-#define R_PPC_NONE\t\t0\n-#define R_PPC_ADDR32\t\t1\t/* 32bit absolute address */\n-#define R_PPC_ADDR24\t\t2\t/* 26bit address, 2 bits ignored. */\n-#define R_PPC_ADDR16\t\t3\t/* 16bit absolute address */\n-#define R_PPC_ADDR16_LO\t\t4\t/* lower 16bit of absolute address */\n-#define R_PPC_ADDR16_HI\t\t5\t/* high 16bit of absolute address */\n-#define R_PPC_ADDR16_HA\t\t6\t/* adjusted high 16bit */\n-#define R_PPC_ADDR14\t\t7\t/* 16bit address, 2 bits ignored */\n-#define R_PPC_ADDR14_BRTAKEN\t8\n-#define R_PPC_ADDR14_BRNTAKEN\t9\n-#define R_PPC_REL24\t\t10\t/* PC relative 26 bit */\n-#define R_PPC_REL14\t\t11\t/* PC relative 16 bit */\n-#define R_PPC_REL14_BRTAKEN\t12\n-#define R_PPC_REL14_BRNTAKEN\t13\n-#define R_PPC_GOT16\t\t14\n-#define R_PPC_GOT16_LO\t\t15\n-#define R_PPC_GOT16_HI\t\t16\n-#define R_PPC_GOT16_HA\t\t17\n-#define R_PPC_PLTREL24\t\t18\n-#define R_PPC_COPY\t\t19\n-#define R_PPC_GLOB_DAT\t\t20\n-#define R_PPC_JMP_SLOT\t\t21\n-#define R_PPC_RELATIVE\t\t22\n-#define R_PPC_LOCAL24PC\t\t23\n-#define R_PPC_UADDR32\t\t24\n-#define R_PPC_UADDR16\t\t25\n-#define R_PPC_REL32\t\t26\n-#define R_PPC_PLT32\t\t27\n-#define R_PPC_PLTREL32\t\t28\n-#define R_PPC_PLT16_LO\t\t29\n-#define R_PPC_PLT16_HI\t\t30\n-#define R_PPC_PLT16_HA\t\t31\n-#define R_PPC_SDAREL16\t\t32\n-#define R_PPC_SECTOFF\t\t33\n-#define R_PPC_SECTOFF_LO\t34\n-#define R_PPC_SECTOFF_HI\t35\n-#define R_PPC_SECTOFF_HA\t36\n-\n-/* PowerPC relocations defined for the TLS access ABI. */\n-#define R_PPC_TLS\t\t67 /* none\t(sym+add)@tls */\n-#define R_PPC_DTPMOD32\t\t68 /* word32\t(sym+add)@dtpmod */\n-#define R_PPC_TPREL16\t\t69 /* half16*\t(sym+add)@tprel */\n-#define R_PPC_TPREL16_LO\t70 /* half16\t(sym+add)@tprel@l */\n-#define R_PPC_TPREL16_HI\t71 /* half16\t(sym+add)@tprel@h */\n-#define R_PPC_TPREL16_HA\t72 /* half16\t(sym+add)@tprel@ha */\n-#define R_PPC_TPREL32\t\t73 /* word32\t(sym+add)@tprel */\n-#define R_PPC_DTPREL16\t\t74 /* half16*\t(sym+add)@dtprel */\n-#define R_PPC_DTPREL16_LO\t75 /* half16\t(sym+add)@dtprel@l */\n-#define R_PPC_DTPREL16_HI\t76 /* half16\t(sym+add)@dtprel@h */\n-#define R_PPC_DTPREL16_HA\t77 /* half16\t(sym+add)@dtprel@ha */\n-#define R_PPC_DTPREL32\t\t78 /* word32\t(sym+add)@dtprel */\n-#define R_PPC_GOT_TLSGD16\t79 /* half16*\t(sym+add)@got@tlsgd */\n-#define R_PPC_GOT_TLSGD16_LO\t80 /* half16\t(sym+add)@got@tlsgd@l */\n-#define R_PPC_GOT_TLSGD16_HI\t81 /* half16\t(sym+add)@got@tlsgd@h */\n-#define R_PPC_GOT_TLSGD16_HA\t82 /* half16\t(sym+add)@got@tlsgd@ha */\n-#define R_PPC_GOT_TLSLD16\t83 /* half16*\t(sym+add)@got@tlsld */\n-#define R_PPC_GOT_TLSLD16_LO\t84 /* half16\t(sym+add)@got@tlsld@l */\n-#define R_PPC_GOT_TLSLD16_HI\t85 /* half16\t(sym+add)@got@tlsld@h */\n-#define R_PPC_GOT_TLSLD16_HA\t86 /* half16\t(sym+add)@got@tlsld@ha */\n-#define R_PPC_GOT_TPREL16\t87 /* half16*\t(sym+add)@got@tprel */\n-#define R_PPC_GOT_TPREL16_LO\t88 /* half16\t(sym+add)@got@tprel@l */\n-#define R_PPC_GOT_TPREL16_HI\t89 /* half16\t(sym+add)@got@tprel@h */\n-#define R_PPC_GOT_TPREL16_HA\t90 /* half16\t(sym+add)@got@tprel@ha */\n-#define R_PPC_GOT_DTPREL16\t91 /* half16*\t(sym+add)@got@dtprel */\n-#define R_PPC_GOT_DTPREL16_LO\t92 /* half16*\t(sym+add)@got@dtprel@l */\n-#define R_PPC_GOT_DTPREL16_HI\t93 /* half16*\t(sym+add)@got@dtprel@h */\n-#define R_PPC_GOT_DTPREL16_HA\t94 /* half16*\t(sym+add)@got@dtprel@ha */\n-\n-/* keep this the last entry. */\n-#define R_PPC_NUM\t\t95\n-\n \n #define ELF_NGREG\t48\t/* includes nip, msr, lr, etc. */\n #define ELF_NFPREG\t33\t/* includes fpscr */\n@@ -166,133 +94,4 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];\n typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG];\n #endif\n \n-/* PowerPC64 relocations defined by the ABIs */\n-#define R_PPC64_NONE R_PPC_NONE\n-#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */\n-#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */\n-#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */\n-#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */\n-#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */\n-#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */\n-#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */\n-#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN\n-#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN\n-#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */\n-#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */\n-#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN\n-#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN\n-#define R_PPC64_GOT16 R_PPC_GOT16\n-#define R_PPC64_GOT16_LO R_PPC_GOT16_LO\n-#define R_PPC64_GOT16_HI R_PPC_GOT16_HI\n-#define R_PPC64_GOT16_HA R_PPC_GOT16_HA\n-\n-#define R_PPC64_COPY R_PPC_COPY\n-#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT\n-#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT\n-#define R_PPC64_RELATIVE R_PPC_RELATIVE\n-\n-#define R_PPC64_UADDR32 R_PPC_UADDR32\n-#define R_PPC64_UADDR16 R_PPC_UADDR16\n-#define R_PPC64_REL32 R_PPC_REL32\n-#define R_PPC64_PLT32 R_PPC_PLT32\n-#define R_PPC64_PLTREL32 R_PPC_PLTREL32\n-#define R_PPC64_PLT16_LO R_PPC_PLT16_LO\n-#define R_PPC64_PLT16_HI R_PPC_PLT16_HI\n-#define R_PPC64_PLT16_HA R_PPC_PLT16_HA\n-\n-#define R_PPC64_SECTOFF R_PPC_SECTOFF\n-#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO\n-#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI\n-#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA\n-#define R_PPC64_ADDR30 37 /* word30 (S + A - P) \u003e\u003e 2. */\n-#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */\n-#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */\n-#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */\n-#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */\n-#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */\n-#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */\n-#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */\n-#define R_PPC64_PLT64 45 /* doubleword64 L + A. */\n-#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */\n-#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */\n-#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */\n-#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */\n-#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */\n-#define R_PPC64_TOC 51 /* doubleword64 .TOC. */\n-#define R_PPC64_PLTGOT16 52 /* half16* M + A. */\n-#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */\n-#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */\n-#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */\n-\n-#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) \u003e\u003e 2. */\n-#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) \u003e\u003e 2. */\n-#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) \u003e\u003e 2. */\n-#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) \u003e\u003e 2. */\n-#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) \u003e\u003e 2. */\n-#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) \u003e\u003e 2. */\n-#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) \u003e\u003e 2. */\n-#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) \u003e\u003e 2. */\n-#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) \u003e\u003e 2. */\n-#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) \u003e\u003e 2. */\n-#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) \u003e\u003e 2. */\n-\n-/* PowerPC64 relocations defined for the TLS access ABI. */\n-#define R_PPC64_TLS\t\t67 /* none\t(sym+add)@tls */\n-#define R_PPC64_DTPMOD64\t68 /* doubleword64 (sym+add)@dtpmod */\n-#define R_PPC64_TPREL16\t\t69 /* half16*\t(sym+add)@tprel */\n-#define R_PPC64_TPREL16_LO\t70 /* half16\t(sym+add)@tprel@l */\n-#define R_PPC64_TPREL16_HI\t71 /* half16\t(sym+add)@tprel@h */\n-#define R_PPC64_TPREL16_HA\t72 /* half16\t(sym+add)@tprel@ha */\n-#define R_PPC64_TPREL64\t\t73 /* doubleword64 (sym+add)@tprel */\n-#define R_PPC64_DTPREL16\t74 /* half16*\t(sym+add)@dtprel */\n-#define R_PPC64_DTPREL16_LO\t75 /* half16\t(sym+add)@dtprel@l */\n-#define R_PPC64_DTPREL16_HI\t76 /* half16\t(sym+add)@dtprel@h */\n-#define R_PPC64_DTPREL16_HA\t77 /* half16\t(sym+add)@dtprel@ha */\n-#define R_PPC64_DTPREL64\t78 /* doubleword64 (sym+add)@dtprel */\n-#define R_PPC64_GOT_TLSGD16\t79 /* half16*\t(sym+add)@got@tlsgd */\n-#define R_PPC64_GOT_TLSGD16_LO\t80 /* half16\t(sym+add)@got@tlsgd@l */\n-#define R_PPC64_GOT_TLSGD16_HI\t81 /* half16\t(sym+add)@got@tlsgd@h */\n-#define R_PPC64_GOT_TLSGD16_HA\t82 /* half16\t(sym+add)@got@tlsgd@ha */\n-#define R_PPC64_GOT_TLSLD16\t83 /* half16*\t(sym+add)@got@tlsld */\n-#define R_PPC64_GOT_TLSLD16_LO\t84 /* half16\t(sym+add)@got@tlsld@l */\n-#define R_PPC64_GOT_TLSLD16_HI\t85 /* half16\t(sym+add)@got@tlsld@h */\n-#define R_PPC64_GOT_TLSLD16_HA\t86 /* half16\t(sym+add)@got@tlsld@ha */\n-#define R_PPC64_GOT_TPREL16_DS\t87 /* half16ds*\t(sym+add)@got@tprel */\n-#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */\n-#define R_PPC64_GOT_TPREL16_HI\t89 /* half16\t(sym+add)@got@tprel@h */\n-#define R_PPC64_GOT_TPREL16_HA\t90 /* half16\t(sym+add)@got@tprel@ha */\n-#define R_PPC64_GOT_DTPREL16_DS\t91 /* half16ds*\t(sym+add)@got@dtprel */\n-#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */\n-#define R_PPC64_GOT_DTPREL16_HI\t93 /* half16\t(sym+add)@got@dtprel@h */\n-#define R_PPC64_GOT_DTPREL16_HA\t94 /* half16\t(sym+add)@got@dtprel@ha */\n-#define R_PPC64_TPREL16_DS\t95 /* half16ds*\t(sym+add)@tprel */\n-#define R_PPC64_TPREL16_LO_DS\t96 /* half16ds\t(sym+add)@tprel@l */\n-#define R_PPC64_TPREL16_HIGHER\t97 /* half16\t(sym+add)@tprel@higher */\n-#define R_PPC64_TPREL16_HIGHERA\t98 /* half16\t(sym+add)@tprel@highera */\n-#define R_PPC64_TPREL16_HIGHEST\t99 /* half16\t(sym+add)@tprel@highest */\n-#define R_PPC64_TPREL16_HIGHESTA 100 /* half16\t(sym+add)@tprel@highesta */\n-#define R_PPC64_DTPREL16_DS\t101 /* half16ds* (sym+add)@dtprel */\n-#define R_PPC64_DTPREL16_LO_DS\t102 /* half16ds\t(sym+add)@dtprel@l */\n-#define R_PPC64_DTPREL16_HIGHER\t103 /* half16\t(sym+add)@dtprel@higher */\n-#define R_PPC64_DTPREL16_HIGHERA 104 /* half16\t(sym+add)@dtprel@highera */\n-#define R_PPC64_DTPREL16_HIGHEST 105 /* half16\t(sym+add)@dtprel@highest */\n-#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16\t(sym+add)@dtprel@highesta */\n-#define R_PPC64_TLSGD\t\t107\n-#define R_PPC64_TLSLD\t\t108\n-#define R_PPC64_TOCSAVE\t\t109\n-\n-#define R_PPC64_REL24_NOTOC\t116\n-#define R_PPC64_ENTRY\t\t118\n-\n-#define R_PPC64_PCREL34\t\t132\n-#define R_PPC64_GOT_PCREL34\t133\n-\n-#define R_PPC64_REL16\t\t249\n-#define R_PPC64_REL16_LO\t250\n-#define R_PPC64_REL16_HI\t251\n-#define R_PPC64_REL16_HA\t252\n-\n-/* Keep this the last entry. */\n-#define R_PPC64_NUM\t\t253\n-\n #endif /* _UAPI_ASM_POWERPC_ELF_H */\ndiff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile\nindex 368759f817084..ca20b91b4373c 100644\n--- a/arch/powerpc/kernel/vdso/Makefile\n+++ b/arch/powerpc/kernel/vdso/Makefile\n@@ -81,9 +81,9 @@ targets += vdso64.lds\n CPPFLAGS_vdso64.lds += -P -C\n \n # link rule for the .so file, .lds has to be first\n-$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE\n+$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o $(vdsocheck) FORCE\n \t$(call if_changed,vdso32ld_and_check)\n-$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o FORCE\n+$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o $(vdsocheck) FORCE\n \t$(call if_changed,vdso64ld_and_check)\n \n # assembly rules for the .S files\ndiff --git a/arch/riscv/include/uapi/asm/elf.h b/arch/riscv/include/uapi/asm/elf.h\nindex 11a71b8533d57..05cf74a4a5357 100644\n--- a/arch/riscv/include/uapi/asm/elf.h\n+++ b/arch/riscv/include/uapi/asm/elf.h\n@@ -32,70 +32,4 @@ typedef union __riscv_fp_state elf_fpregset_t;\n #define ELF_RISCV_R_TYPE(r_info)\tELF32_R_TYPE(r_info)\n #endif\n \n-/*\n- * RISC-V relocation types\n- */\n-\n-/* Relocation types used by the dynamic linker */\n-#define R_RISCV_NONE\t\t0\n-#define R_RISCV_32\t\t1\n-#define R_RISCV_64\t\t2\n-#define R_RISCV_RELATIVE\t3\n-#define R_RISCV_COPY\t\t4\n-#define R_RISCV_JUMP_SLOT\t5\n-#define R_RISCV_TLS_DTPMOD32\t6\n-#define R_RISCV_TLS_DTPMOD64\t7\n-#define R_RISCV_TLS_DTPREL32\t8\n-#define R_RISCV_TLS_DTPREL64\t9\n-#define R_RISCV_TLS_TPREL32\t10\n-#define R_RISCV_TLS_TPREL64\t11\n-#define R_RISCV_IRELATIVE\t58\n-\n-/* Relocation types not used by the dynamic linker */\n-#define R_RISCV_BRANCH\t\t16\n-#define R_RISCV_JAL\t\t17\n-#define R_RISCV_CALL\t\t18\n-#define R_RISCV_CALL_PLT\t19\n-#define R_RISCV_GOT_HI20\t20\n-#define R_RISCV_TLS_GOT_HI20\t21\n-#define R_RISCV_TLS_GD_HI20\t22\n-#define R_RISCV_PCREL_HI20\t23\n-#define R_RISCV_PCREL_LO12_I\t24\n-#define R_RISCV_PCREL_LO12_S\t25\n-#define R_RISCV_HI20\t\t26\n-#define R_RISCV_LO12_I\t\t27\n-#define R_RISCV_LO12_S\t\t28\n-#define R_RISCV_TPREL_HI20\t29\n-#define R_RISCV_TPREL_LO12_I\t30\n-#define R_RISCV_TPREL_LO12_S\t31\n-#define R_RISCV_TPREL_ADD\t32\n-#define R_RISCV_ADD8\t\t33\n-#define R_RISCV_ADD16\t\t34\n-#define R_RISCV_ADD32\t\t35\n-#define R_RISCV_ADD64\t\t36\n-#define R_RISCV_SUB8\t\t37\n-#define R_RISCV_SUB16\t\t38\n-#define R_RISCV_SUB32\t\t39\n-#define R_RISCV_SUB64\t\t40\n-#define R_RISCV_GNU_VTINHERIT\t41\n-#define R_RISCV_GNU_VTENTRY\t42\n-#define R_RISCV_ALIGN\t\t43\n-#define R_RISCV_RVC_BRANCH\t44\n-#define R_RISCV_RVC_JUMP\t45\n-#define R_RISCV_GPREL_I\t\t47\n-#define R_RISCV_GPREL_S\t\t48\n-#define R_RISCV_TPREL_I\t\t49\n-#define R_RISCV_TPREL_S\t\t50\n-#define R_RISCV_RELAX\t\t51\n-#define R_RISCV_SUB6\t\t52\n-#define R_RISCV_SET6\t\t53\n-#define R_RISCV_SET8\t\t54\n-#define R_RISCV_SET16\t\t55\n-#define R_RISCV_SET32\t\t56\n-#define R_RISCV_32_PCREL\t57\n-#define R_RISCV_PLT32\t\t59\n-#define R_RISCV_SET_ULEB128\t60\n-#define R_RISCV_SUB_ULEB128\t61\n-\n-\n #endif /* _UAPI_ASM_RISCV_ELF_H */\ndiff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile\nindex 8dbf2532a5730..7e707fdff26c1 100644\n--- a/arch/riscv/kernel/vdso/Makefile\n+++ b/arch/riscv/kernel/vdso/Makefile\n@@ -74,7 +74,7 @@ endif\n $(obj)/$(vdso_o): $(obj)/$(vdso_so)\n \n # link rule for the .so file, .lds has to be first\n-$(obj)/$(vdso_so_dbg): $(obj)/$(vdso_lds) $(obj-vdso) FORCE\n+$(obj)/$(vdso_so_dbg): $(obj)/$(vdso_lds) $(obj-vdso) $(vdsocheck) FORCE\n \t$(call if_changed,vdsold_and_check)\n LDFLAGS_$(vdso_so_dbg) = -shared -soname=linux-vdso.so.1 \\\n \t--build-id=sha1 --eh-frame-hdr\n@@ -96,7 +96,7 @@ include/generated/$(vdso_offsets): $(obj)/$(vdso_so_dbg) FORCE\n # The DSO images are built using a special linker script\n # Make sure only to export the intended __vdso_xxx symbol offsets.\n quiet_cmd_vdsold_and_check = VDSOLD $@\n- cmd_vdsold_and_check = $(LD) $(CFI_FULL) $(ld_flags) -T $(filter-out FORCE,$^) -o $@.tmp \u0026\u0026 \\\n+ cmd_vdsold_and_check = $(LD) $(CFI_FULL) $(ld_flags) -T $(filter-out FORCE $(vdsocheck),$^) -o $@.tmp \u0026\u0026 \\\n $(OBJCOPY) $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ \u0026\u0026 \\\n rm $@.tmp \u0026\u0026 \\\n $(cmd_vdso_check)\ndiff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h\nindex bb63fa4d20bb8..c3fa168f0c300 100644\n--- a/arch/s390/include/asm/elf.h\n+++ b/arch/s390/include/asm/elf.h\n@@ -8,89 +8,6 @@\n #ifndef __ASMS390_ELF_H\n #define __ASMS390_ELF_H\n \n-/* s390 relocations defined by the ABIs */\n-#define R_390_NONE\t\t0\t/* No reloc. */\n-#define R_390_8\t\t\t1\t/* Direct 8 bit. */\n-#define R_390_12\t\t2\t/* Direct 12 bit. */\n-#define R_390_16\t\t3\t/* Direct 16 bit. */\n-#define R_390_32\t\t4\t/* Direct 32 bit. */\n-#define R_390_PC32\t\t5\t/* PC relative 32 bit.\t*/\n-#define R_390_GOT12\t\t6\t/* 12 bit GOT offset. */\n-#define R_390_GOT32\t\t7\t/* 32 bit GOT offset. */\n-#define R_390_PLT32\t\t8\t/* 32 bit PC relative PLT address. */\n-#define R_390_COPY\t\t9\t/* Copy symbol at runtime. */\n-#define R_390_GLOB_DAT\t\t10\t/* Create GOT entry. */\n-#define R_390_JMP_SLOT\t\t11\t/* Create PLT entry. */\n-#define R_390_RELATIVE\t\t12\t/* Adjust by program base. */\n-#define R_390_GOTOFF32\t\t13\t/* 32 bit offset to GOT.\t */\n-#define R_390_GOTPC\t\t14\t/* 32 bit PC rel. offset to GOT. */\n-#define R_390_GOT16\t\t15\t/* 16 bit GOT offset. */\n-#define R_390_PC16\t\t16\t/* PC relative 16 bit.\t*/\n-#define R_390_PC16DBL\t\t17\t/* PC relative 16 bit shifted by 1. */\n-#define R_390_PLT16DBL\t\t18\t/* 16 bit PC rel. PLT shifted by 1. */\n-#define R_390_PC32DBL\t\t19\t/* PC relative 32 bit shifted by 1. */\n-#define R_390_PLT32DBL\t\t20\t/* 32 bit PC rel. PLT shifted by 1. */\n-#define R_390_GOTPCDBL\t\t21\t/* 32 bit PC rel. GOT shifted by 1. */\n-#define R_390_64\t\t22\t/* Direct 64 bit. */\n-#define R_390_PC64\t\t23\t/* PC relative 64 bit.\t*/\n-#define R_390_GOT64\t\t24\t/* 64 bit GOT offset. */\n-#define R_390_PLT64\t\t25\t/* 64 bit PC relative PLT address. */\n-#define R_390_GOTENT\t\t26\t/* 32 bit PC rel. to GOT entry \u003e\u003e 1. */\n-#define R_390_GOTOFF16\t\t27\t/* 16 bit offset to GOT. */\n-#define R_390_GOTOFF64\t\t28\t/* 64 bit offset to GOT. */\n-#define R_390_GOTPLT12\t\t29\t/* 12 bit offset to jump slot.\t*/\n-#define R_390_GOTPLT16\t\t30\t/* 16 bit offset to jump slot.\t*/\n-#define R_390_GOTPLT32\t\t31\t/* 32 bit offset to jump slot.\t*/\n-#define R_390_GOTPLT64\t\t32\t/* 64 bit offset to jump slot.\t*/\n-#define R_390_GOTPLTENT\t\t33\t/* 32 bit rel. offset to jump slot. */\n-#define R_390_PLTOFF16\t\t34\t/* 16 bit offset from GOT to PLT. */\n-#define R_390_PLTOFF32\t\t35\t/* 32 bit offset from GOT to PLT. */\n-#define R_390_PLTOFF64\t\t36\t/* 16 bit offset from GOT to PLT. */\n-#define R_390_TLS_LOAD\t\t37\t/* Tag for load insn in TLS code. */\n-#define R_390_TLS_GDCALL\t38\t/* Tag for function call in general\n- dynamic TLS code. */\n-#define R_390_TLS_LDCALL\t39\t/* Tag for function call in local\n- dynamic TLS code. */\n-#define R_390_TLS_GD32\t\t40\t/* Direct 32 bit for general dynamic\n- thread local data. */\n-#define R_390_TLS_GD64\t\t41\t/* Direct 64 bit for general dynamic\n- thread local data. */\n-#define R_390_TLS_GOTIE12\t42\t/* 12 bit GOT offset for static TLS\n- block offset. */\n-#define R_390_TLS_GOTIE32\t43\t/* 32 bit GOT offset for static TLS\n- block offset. */\n-#define R_390_TLS_GOTIE64\t44\t/* 64 bit GOT offset for static TLS\n- block offset. */\n-#define R_390_TLS_LDM32\t\t45\t/* Direct 32 bit for local dynamic\n- thread local data in LD code. */\n-#define R_390_TLS_LDM64\t\t46\t/* Direct 64 bit for local dynamic\n- thread local data in LD code. */\n-#define R_390_TLS_IE32\t\t47\t/* 32 bit address of GOT entry for\n- negated static TLS block offset. */\n-#define R_390_TLS_IE64\t\t48\t/* 64 bit address of GOT entry for\n- negated static TLS block offset. */\n-#define R_390_TLS_IEENT\t\t49\t/* 32 bit rel. offset to GOT entry for\n- negated static TLS block offset. */\n-#define R_390_TLS_LE32\t\t50\t/* 32 bit negated offset relative to\n- static TLS block. */\n-#define R_390_TLS_LE64\t\t51\t/* 64 bit negated offset relative to\n- static TLS block. */\n-#define R_390_TLS_LDO32\t\t52\t/* 32 bit offset relative to TLS\n- block. */\n-#define R_390_TLS_LDO64\t\t53\t/* 64 bit offset relative to TLS\n- block. */\n-#define R_390_TLS_DTPMOD\t54\t/* ID of module containing symbol. */\n-#define R_390_TLS_DTPOFF\t55\t/* Offset in TLS block. */\n-#define R_390_TLS_TPOFF\t\t56\t/* Negate offset in static TLS\n- block. */\n-#define R_390_20\t\t57\t/* Direct 20 bit. */\n-#define R_390_GOT20\t\t58\t/* 20 bit GOT offset. */\n-#define R_390_GOTPLT20\t\t59\t/* 20 bit offset to jump slot. */\n-#define R_390_TLS_GOTIE20\t60\t/* 20 bit GOT offset for static TLS\n-\t\t\t\t\t block offset. */\n-/* Keep this the last entry. */\n-#define R_390_NUM\t61\n-\n /*\n * HWCAP flags - for AT_HWCAP\n *\ndiff --git a/arch/s390/kernel/vdso/Makefile b/arch/s390/kernel/vdso/Makefile\nindex 35c834b895ecb..509ef3f1e2ebf 100644\n--- a/arch/s390/kernel/vdso/Makefile\n+++ b/arch/s390/kernel/vdso/Makefile\n@@ -44,10 +44,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)\n $(obj)/vdso_wrapper.o : $(obj)/vdso.so\n \n quiet_cmd_vdso_and_check = VDSO $@\n- cmd_vdso_and_check = $(cmd_ld); $(cmd_vdso_check)\n+ cmd_vdso_and_check = $(cmd_ld_vdso); $(cmd_vdso_check)\n \n # link rule for the .so file, .lds has to be first\n-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvdso) FORCE\n+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvdso) $(vdsocheck) FORCE\n \t$(call if_changed,vdso_and_check)\n \n # strip rule for the .so file\ndiff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h\nindex 37a6016c9ccdf..02736284f7afb 100644\n--- a/arch/sparc/include/asm/elf_32.h\n+++ b/arch/sparc/include/asm/elf_32.h\n@@ -13,49 +13,6 @@\n */\n #define STT_REGISTER\t\t13\n \n-/*\n- * Sparc ELF relocation types\n- */\n-#define\tR_SPARC_NONE\t\t0\n-#define\tR_SPARC_8\t\t1\n-#define\tR_SPARC_16\t\t2\n-#define\tR_SPARC_32\t\t3\n-#define\tR_SPARC_DISP8\t\t4\n-#define\tR_SPARC_DISP16\t\t5\n-#define\tR_SPARC_DISP32\t\t6\n-#define\tR_SPARC_WDISP30\t\t7\n-#define\tR_SPARC_WDISP22\t\t8\n-#define\tR_SPARC_HI22\t\t9\n-#define\tR_SPARC_22\t\t10\n-#define\tR_SPARC_13\t\t11\n-#define\tR_SPARC_LO10\t\t12\n-#define\tR_SPARC_GOT10\t\t13\n-#define\tR_SPARC_GOT13\t\t14\n-#define\tR_SPARC_GOT22\t\t15\n-#define\tR_SPARC_PC10\t\t16\n-#define\tR_SPARC_PC22\t\t17\n-#define\tR_SPARC_WPLT30\t\t18\n-#define\tR_SPARC_COPY\t\t19\n-#define\tR_SPARC_GLOB_DAT\t20\n-#define\tR_SPARC_JMP_SLOT\t21\n-#define\tR_SPARC_RELATIVE\t22\n-#define\tR_SPARC_UA32\t\t23\n-#define R_SPARC_PLT32\t\t24\n-#define R_SPARC_HIPLT22\t\t25\n-#define R_SPARC_LOPLT10\t\t26\n-#define R_SPARC_PCPLT32\t\t27\n-#define R_SPARC_PCPLT22\t\t28\n-#define R_SPARC_PCPLT10\t\t29\n-#define R_SPARC_10\t\t30\n-#define R_SPARC_11\t\t31\n-#define R_SPARC_64\t\t32\n-#define R_SPARC_OLO10\t\t33\n-#define R_SPARC_WDISP16\t\t40\n-#define R_SPARC_WDISP19\t\t41\n-#define R_SPARC_7\t\t43\n-#define R_SPARC_5\t\t44\n-#define R_SPARC_6\t\t45\n-\n /* Bits present in AT_HWCAP, primarily for Sparc32. */\n \n #define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */\ndiff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h\nindex 694ed081cf8d9..3be9e2d3a94af 100644\n--- a/arch/sparc/include/asm/elf_64.h\n+++ b/arch/sparc/include/asm/elf_64.h\n@@ -16,50 +16,6 @@\n */\n #define STT_REGISTER\t\t13\n \n-/*\n- * Sparc ELF relocation types\n- */\n-#define\tR_SPARC_NONE\t\t0\n-#define\tR_SPARC_8\t\t1\n-#define\tR_SPARC_16\t\t2\n-#define\tR_SPARC_32\t\t3\n-#define\tR_SPARC_DISP8\t\t4\n-#define\tR_SPARC_DISP16\t\t5\n-#define\tR_SPARC_DISP32\t\t6\n-#define\tR_SPARC_WDISP30\t\t7\n-#define\tR_SPARC_WDISP22\t\t8\n-#define\tR_SPARC_HI22\t\t9\n-#define\tR_SPARC_22\t\t10\n-#define\tR_SPARC_13\t\t11\n-#define\tR_SPARC_LO10\t\t12\n-#define\tR_SPARC_GOT10\t\t13\n-#define\tR_SPARC_GOT13\t\t14\n-#define\tR_SPARC_GOT22\t\t15\n-#define\tR_SPARC_PC10\t\t16\n-#define\tR_SPARC_PC22\t\t17\n-#define\tR_SPARC_WPLT30\t\t18\n-#define\tR_SPARC_COPY\t\t19\n-#define\tR_SPARC_GLOB_DAT\t20\n-#define\tR_SPARC_JMP_SLOT\t21\n-#define\tR_SPARC_RELATIVE\t22\n-#define\tR_SPARC_UA32\t\t23\n-#define R_SPARC_PLT32\t\t24\n-#define R_SPARC_HIPLT22\t\t25\n-#define R_SPARC_LOPLT10\t\t26\n-#define R_SPARC_PCPLT32\t\t27\n-#define R_SPARC_PCPLT22\t\t28\n-#define R_SPARC_PCPLT10\t\t29\n-#define R_SPARC_10\t\t30\n-#define R_SPARC_11\t\t31\n-#define R_SPARC_64\t\t32\n-#define R_SPARC_OLO10\t\t33\n-#define R_SPARC_WDISP16\t\t40\n-#define R_SPARC_WDISP19\t\t41\n-#define R_SPARC_7\t\t43\n-#define R_SPARC_5\t\t44\n-#define R_SPARC_6\t\t45\n-#define R_SPARC_UA64\t\t54\n-\n /* Bits present in AT_HWCAP, primarily for Sparc32. */\n #define HWCAP_SPARC_FLUSH 0x00000001\n #define HWCAP_SPARC_STBAR 0x00000002\ndiff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile\nindex 83fb2aca59cb9..8bb235c3a6180 100644\n--- a/arch/sparc/vdso/Makefile\n+++ b/arch/sparc/vdso/Makefile\n@@ -28,7 +28,7 @@ CPPFLAGS_vdso.lds += -P -C\n VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 \\\n \t\t\t-z max-page-size=8192\n \n-$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE\n+$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) $(vdsocheck) FORCE\n \t$(call if_changed,vdso)\n \n HOST_EXTRACFLAGS += -I$(srctree)/tools/include\n@@ -99,7 +99,8 @@ $(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)\n $(obj)/vdso32.so.dbg: FORCE \\\n \t\t\t$(obj)/vdso32/vdso32.lds \\\n \t\t\t$(obj)/vdso32/vclock_gettime.o \\\n-\t\t\t$(obj)/vdso32/vdso-note.o\n+\t\t\t$(obj)/vdso32/vdso-note.o \\\n+\t\t\t$(vdsocheck)\n \t\t$(call\tif_changed,vdso)\n \n #\ndiff --git a/arch/x86/entry/vdso/common/Makefile.include b/arch/x86/entry/vdso/common/Makefile.include\nindex 687b3d89b40d5..510d5e79857e6 100644\n--- a/arch/x86/entry/vdso/common/Makefile.include\n+++ b/arch/x86/entry/vdso/common/Makefile.include\n@@ -71,7 +71,7 @@ quiet_cmd_vdso = VDSO $@\n quiet_cmd_vdso_and_check = VDSO $@\n cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check)\n \n-$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds FORCE\n+$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds $(vdsocheck) FORCE\n \t$(call if_changed,vdso_and_check)\n \n $(obj)/%.so: OBJCOPYFLAGS := -S --remove-section __ex_table\ndiff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h\nindex 4133c790e71a9..ad84c0f604592 100644\n--- a/arch/x86/include/asm/elf.h\n+++ b/arch/x86/include/asm/elf.h\n@@ -22,19 +22,6 @@ typedef struct user_i387_struct elf_fpregset_t;\n \n #ifdef __i386__\n \n-#define R_386_NONE\t0\n-#define R_386_32\t1\n-#define R_386_PC32\t2\n-#define R_386_GOT32\t3\n-#define R_386_PLT32\t4\n-#define R_386_COPY\t5\n-#define R_386_GLOB_DAT\t6\n-#define R_386_JMP_SLOT\t7\n-#define R_386_RELATIVE\t8\n-#define R_386_GOTOFF\t9\n-#define R_386_GOTPC\t10\n-#define R_386_NUM\t11\n-\n /*\n * These are used to set parameters in the core dumps.\n */\n@@ -44,26 +31,6 @@ typedef struct user_i387_struct elf_fpregset_t;\n \n #else\n \n-/* x86-64 relocation types */\n-#define R_X86_64_NONE\t\t0\t/* No reloc */\n-#define R_X86_64_64\t\t1\t/* Direct 64 bit */\n-#define R_X86_64_PC32\t\t2\t/* PC relative 32 bit signed */\n-#define R_X86_64_GOT32\t\t3\t/* 32 bit GOT entry */\n-#define R_X86_64_PLT32\t\t4\t/* 32 bit PLT address */\n-#define R_X86_64_COPY\t\t5\t/* Copy symbol at runtime */\n-#define R_X86_64_GLOB_DAT\t6\t/* Create GOT entry */\n-#define R_X86_64_JUMP_SLOT\t7\t/* Create PLT entry */\n-#define R_X86_64_RELATIVE\t8\t/* Adjust by program base */\n-#define R_X86_64_GOTPCREL\t9\t/* 32 bit signed pc relative\n-\t\t\t\t\t offset to GOT */\n-#define R_X86_64_32\t\t10\t/* Direct 32 bit zero extended */\n-#define R_X86_64_32S\t\t11\t/* Direct 32 bit sign extended */\n-#define R_X86_64_16\t\t12\t/* Direct 16 bit zero extended */\n-#define R_X86_64_PC16\t\t13\t/* 16 bit sign extended pc relative */\n-#define R_X86_64_8\t\t14\t/* Direct 8 bit sign extended */\n-#define R_X86_64_PC8\t\t15\t/* 8 bit sign extended pc relative */\n-#define R_X86_64_PC64\t\t24\t/* Place relative 64-bit signed */\n-\n /*\n * These are used to set parameters in the core dumps.\n */\ndiff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h\nindex 22d0111b543b3..b768497d5ee19 100644\n--- a/arch/x86/um/asm/elf.h\n+++ b/arch/x86/um/asm/elf.h\n@@ -12,19 +12,6 @@\n \n #ifdef CONFIG_X86_32\n \n-#define R_386_NONE\t0\n-#define R_386_32\t1\n-#define R_386_PC32\t2\n-#define R_386_GOT32\t3\n-#define R_386_PLT32\t4\n-#define R_386_COPY\t5\n-#define R_386_GLOB_DAT\t6\n-#define R_386_JMP_SLOT\t7\n-#define R_386_RELATIVE\t8\n-#define R_386_GOTOFF\t9\n-#define R_386_GOTPC\t10\n-#define R_386_NUM\t11\n-\n /*\n * This is used to ensure we don't load something for the wrong architecture.\n */\n@@ -72,26 +59,6 @@\n \n #else\n \n-/* x86-64 relocation types, taken from asm-x86_64/elf.h */\n-#define R_X86_64_NONE\t\t0\t/* No reloc */\n-#define R_X86_64_64\t\t1\t/* Direct 64 bit */\n-#define R_X86_64_PC32\t\t2\t/* PC relative 32 bit signed */\n-#define R_X86_64_GOT32\t\t3\t/* 32 bit GOT entry */\n-#define R_X86_64_PLT32\t\t4\t/* 32 bit PLT address */\n-#define R_X86_64_COPY\t\t5\t/* Copy symbol at runtime */\n-#define R_X86_64_GLOB_DAT\t6\t/* Create GOT entry */\n-#define R_X86_64_JUMP_SLOT\t7\t/* Create PLT entry */\n-#define R_X86_64_RELATIVE\t8\t/* Adjust by program base */\n-#define R_X86_64_GOTPCREL\t9\t/* 32 bit signed pc relative\n-\t\t\t\t\t offset to GOT */\n-#define R_X86_64_32\t\t10\t/* Direct 32 bit zero extended */\n-#define R_X86_64_32S\t\t11\t/* Direct 32 bit sign extended */\n-#define R_X86_64_16\t\t12\t/* Direct 16 bit zero extended */\n-#define R_X86_64_PC16\t\t13\t/* 16 bit sign extended pc relative */\n-#define R_X86_64_8\t\t14\t/* Direct 8 bit sign extended */\n-#define R_X86_64_PC8\t\t15\t/* 8 bit sign extended pc relative */\n-#define R_X86_64_PC64\t\t24\t/* Place relative 64-bit signed */\n-\n /*\n * This is used to ensure we don't load something for the wrong architecture.\n */\ndiff --git a/include/uapi/linux/elf-r.h b/include/uapi/linux/elf-r.h\nnew file mode 100644\nindex 0000000000000..a6a4d7643c5d7\n--- /dev/null\n+++ b/include/uapi/linux/elf-r.h\n@@ -0,0 +1,705 @@\n+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n+#ifndef _UAPI_LINUX_ELF_R_H\n+#define _UAPI_LINUX_ELF_R_H\n+\n+/* i386 relocation types */\n+#define R_386_NONE\t0\n+#define R_386_32\t1\n+#define R_386_PC32\t2\n+#define R_386_GOT32\t3\n+#define R_386_PLT32\t4\n+#define R_386_COPY\t5\n+#define R_386_GLOB_DAT\t6\n+#define R_386_JMP_SLOT\t7\n+#define R_386_RELATIVE\t8\n+#define R_386_GOTOFF\t9\n+#define R_386_GOTPC\t10\n+#define R_386_NUM\t11\n+\n+/* x86-64 relocation types */\n+#define R_X86_64_NONE\t\t0\t/* No reloc */\n+#define R_X86_64_64\t\t1\t/* Direct 64 bit */\n+#define R_X86_64_PC32\t\t2\t/* PC relative 32 bit signed */\n+#define R_X86_64_GOT32\t\t3\t/* 32 bit GOT entry */\n+#define R_X86_64_PLT32\t\t4\t/* 32 bit PLT address */\n+#define R_X86_64_COPY\t\t5\t/* Copy symbol at runtime */\n+#define R_X86_64_GLOB_DAT\t6\t/* Create GOT entry */\n+#define R_X86_64_JUMP_SLOT\t7\t/* Create PLT entry */\n+#define R_X86_64_RELATIVE\t8\t/* Adjust by program base */\n+#define R_X86_64_GOTPCREL\t9\t/* 32 bit signed pc relative\n+\t\t\t\t\t offset to GOT */\n+#define R_X86_64_32\t\t10\t/* Direct 32 bit zero extended */\n+#define R_X86_64_32S\t\t11\t/* Direct 32 bit sign extended */\n+#define R_X86_64_16\t\t12\t/* Direct 16 bit zero extended */\n+#define R_X86_64_PC16\t\t13\t/* 16 bit sign extended pc relative */\n+#define R_X86_64_8\t\t14\t/* Direct 8 bit sign extended */\n+#define R_X86_64_PC8\t\t15\t/* 8 bit sign extended pc relative */\n+#define R_X86_64_PC64\t\t24\t/* Place relative 64-bit signed */\n+\n+/* arm relocation types */\n+#define R_ARM_NONE\t\t0\n+#define R_ARM_PC24\t\t1\n+#define R_ARM_ABS32\t\t2\n+#define R_ARM_REL32\t\t3\n+#define R_ARM_CALL\t\t28\n+#define R_ARM_JUMP24\t\t29\n+#define R_ARM_TARGET1\t\t38\n+#define R_ARM_V4BX\t\t40\n+#define R_ARM_PREL31\t\t42\n+#define R_ARM_MOVW_ABS_NC\t43\n+#define R_ARM_MOVT_ABS\t\t44\n+#define R_ARM_MOVW_PREL_NC\t45\n+#define R_ARM_MOVT_PREL\t\t46\n+#define R_ARM_ALU_PC_G0_NC\t57\n+#define R_ARM_ALU_PC_G1_NC\t59\n+#define R_ARM_LDR_PC_G2\t\t63\n+\n+#define R_ARM_THM_CALL\t\t10\n+#define R_ARM_THM_JUMP24\t30\n+#define R_ARM_THM_MOVW_ABS_NC\t47\n+#define R_ARM_THM_MOVT_ABS\t48\n+#define R_ARM_THM_MOVW_PREL_NC\t49\n+#define R_ARM_THM_MOVT_PREL\t50\n+\n+/* AArch64 static relocation types */\n+\n+/* Miscellaneous. */\n+#define R_AARCH64_NONE\t\t\t256\n+\n+/* Data. */\n+#define R_AARCH64_ABS64\t\t\t257\n+#define R_AARCH64_ABS32\t\t\t258\n+#define R_AARCH64_ABS16\t\t\t259\n+#define R_AARCH64_PREL64\t\t260\n+#define R_AARCH64_PREL32\t\t261\n+#define R_AARCH64_PREL16\t\t262\n+\n+/* Instructions. */\n+#define R_AARCH64_MOVW_UABS_G0\t\t263\n+#define R_AARCH64_MOVW_UABS_G0_NC\t264\n+#define R_AARCH64_MOVW_UABS_G1\t\t265\n+#define R_AARCH64_MOVW_UABS_G1_NC\t266\n+#define R_AARCH64_MOVW_UABS_G2\t\t267\n+#define R_AARCH64_MOVW_UABS_G2_NC\t268\n+#define R_AARCH64_MOVW_UABS_G3\t\t269\n+\n+#define R_AARCH64_MOVW_SABS_G0\t\t270\n+#define R_AARCH64_MOVW_SABS_G1\t\t271\n+#define R_AARCH64_MOVW_SABS_G2\t\t272\n+\n+#define R_AARCH64_LD_PREL_LO19\t\t273\n+#define R_AARCH64_ADR_PREL_LO21\t\t274\n+#define R_AARCH64_ADR_PREL_PG_HI21\t275\n+#define R_AARCH64_ADR_PREL_PG_HI21_NC\t276\n+#define R_AARCH64_ADD_ABS_LO12_NC\t277\n+#define R_AARCH64_LDST8_ABS_LO12_NC\t278\n+\n+#define R_AARCH64_TSTBR14\t\t279\n+#define R_AARCH64_CONDBR19\t\t280\n+#define R_AARCH64_JUMP26\t\t282\n+#define R_AARCH64_CALL26\t\t283\n+#define R_AARCH64_LDST16_ABS_LO12_NC\t284\n+#define R_AARCH64_LDST32_ABS_LO12_NC\t285\n+#define R_AARCH64_LDST64_ABS_LO12_NC\t286\n+#define R_AARCH64_LDST128_ABS_LO12_NC\t299\n+\n+#define R_AARCH64_MOVW_PREL_G0\t\t287\n+#define R_AARCH64_MOVW_PREL_G0_NC\t288\n+#define R_AARCH64_MOVW_PREL_G1\t\t289\n+#define R_AARCH64_MOVW_PREL_G1_NC\t290\n+#define R_AARCH64_MOVW_PREL_G2\t\t291\n+#define R_AARCH64_MOVW_PREL_G2_NC\t292\n+#define R_AARCH64_MOVW_PREL_G3\t\t293\n+\n+#define R_AARCH64_RELATIVE\t\t1027\n+\n+/* PowerPC relocations defined by the ABIs */\n+#define R_PPC_NONE\t\t0\n+#define R_PPC_ADDR32\t\t1\t/* 32bit absolute address */\n+#define R_PPC_ADDR24\t\t2\t/* 26bit address, 2 bits ignored. */\n+#define R_PPC_ADDR16\t\t3\t/* 16bit absolute address */\n+#define R_PPC_ADDR16_LO\t\t4\t/* lower 16bit of absolute address */\n+#define R_PPC_ADDR16_HI\t\t5\t/* high 16bit of absolute address */\n+#define R_PPC_ADDR16_HA\t\t6\t/* adjusted high 16bit */\n+#define R_PPC_ADDR14\t\t7\t/* 16bit address, 2 bits ignored */\n+#define R_PPC_ADDR14_BRTAKEN\t8\n+#define R_PPC_ADDR14_BRNTAKEN\t9\n+#define R_PPC_REL24\t\t10\t/* PC relative 26 bit */\n+#define R_PPC_REL14\t\t11\t/* PC relative 16 bit */\n+#define R_PPC_REL14_BRTAKEN\t12\n+#define R_PPC_REL14_BRNTAKEN\t13\n+#define R_PPC_GOT16\t\t14\n+#define R_PPC_GOT16_LO\t\t15\n+#define R_PPC_GOT16_HI\t\t16\n+#define R_PPC_GOT16_HA\t\t17\n+#define R_PPC_PLTREL24\t\t18\n+#define R_PPC_COPY\t\t19\n+#define R_PPC_GLOB_DAT\t\t20\n+#define R_PPC_JMP_SLOT\t\t21\n+#define R_PPC_RELATIVE\t\t22\n+#define R_PPC_LOCAL24PC\t\t23\n+#define R_PPC_UADDR32\t\t24\n+#define R_PPC_UADDR16\t\t25\n+#define R_PPC_REL32\t\t26\n+#define R_PPC_PLT32\t\t27\n+#define R_PPC_PLTREL32\t\t28\n+#define R_PPC_PLT16_LO\t\t29\n+#define R_PPC_PLT16_HI\t\t30\n+#define R_PPC_PLT16_HA\t\t31\n+#define R_PPC_SDAREL16\t\t32\n+#define R_PPC_SECTOFF\t\t33\n+#define R_PPC_SECTOFF_LO\t34\n+#define R_PPC_SECTOFF_HI\t35\n+#define R_PPC_SECTOFF_HA\t36\n+\n+/* PowerPC relocations defined for the TLS access ABI. */\n+#define R_PPC_TLS\t\t67 /* none\t(sym+add)@tls */\n+#define R_PPC_DTPMOD32\t\t68 /* word32\t(sym+add)@dtpmod */\n+#define R_PPC_TPREL16\t\t69 /* half16*\t(sym+add)@tprel */\n+#define R_PPC_TPREL16_LO\t70 /* half16\t(sym+add)@tprel@l */\n+#define R_PPC_TPREL16_HI\t71 /* half16\t(sym+add)@tprel@h */\n+#define R_PPC_TPREL16_HA\t72 /* half16\t(sym+add)@tprel@ha */\n+#define R_PPC_TPREL32\t\t73 /* word32\t(sym+add)@tprel */\n+#define R_PPC_DTPREL16\t\t74 /* half16*\t(sym+add)@dtprel */\n+#define R_PPC_DTPREL16_LO\t75 /* half16\t(sym+add)@dtprel@l */\n+#define R_PPC_DTPREL16_HI\t76 /* half16\t(sym+add)@dtprel@h */\n+#define R_PPC_DTPREL16_HA\t77 /* half16\t(sym+add)@dtprel@ha */\n+#define R_PPC_DTPREL32\t\t78 /* word32\t(sym+add)@dtprel */\n+#define R_PPC_GOT_TLSGD16\t79 /* half16*\t(sym+add)@got@tlsgd */\n+#define R_PPC_GOT_TLSGD16_LO\t80 /* half16\t(sym+add)@got@tlsgd@l */\n+#define R_PPC_GOT_TLSGD16_HI\t81 /* half16\t(sym+add)@got@tlsgd@h */\n+#define R_PPC_GOT_TLSGD16_HA\t82 /* half16\t(sym+add)@got@tlsgd@ha */\n+#define R_PPC_GOT_TLSLD16\t83 /* half16*\t(sym+add)@got@tlsld */\n+#define R_PPC_GOT_TLSLD16_LO\t84 /* half16\t(sym+add)@got@tlsld@l */\n+#define R_PPC_GOT_TLSLD16_HI\t85 /* half16\t(sym+add)@got@tlsld@h */\n+#define R_PPC_GOT_TLSLD16_HA\t86 /* half16\t(sym+add)@got@tlsld@ha */\n+#define R_PPC_GOT_TPREL16\t87 /* half16*\t(sym+add)@got@tprel */\n+#define R_PPC_GOT_TPREL16_LO\t88 /* half16\t(sym+add)@got@tprel@l */\n+#define R_PPC_GOT_TPREL16_HI\t89 /* half16\t(sym+add)@got@tprel@h */\n+#define R_PPC_GOT_TPREL16_HA\t90 /* half16\t(sym+add)@got@tprel@ha */\n+#define R_PPC_GOT_DTPREL16\t91 /* half16*\t(sym+add)@got@dtprel */\n+#define R_PPC_GOT_DTPREL16_LO\t92 /* half16*\t(sym+add)@got@dtprel@l */\n+#define R_PPC_GOT_DTPREL16_HI\t93 /* half16*\t(sym+add)@got@dtprel@h */\n+#define R_PPC_GOT_DTPREL16_HA\t94 /* half16*\t(sym+add)@got@dtprel@ha */\n+\n+#define R_PPC_REL16\t\t249\n+#define R_PPC_REL16_LO\t\t250\n+#define R_PPC_REL16_HI\t\t251\n+#define R_PPC_REL16_HA\t\t252\n+\n+/* keep this the last entry. */\n+#define R_PPC_NUM\t\t253\n+\n+/* PowerPC64 relocations defined by the ABIs */\n+#define R_PPC64_NONE R_PPC_NONE\n+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */\n+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */\n+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */\n+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */\n+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */\n+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */\n+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */\n+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN\n+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN\n+#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */\n+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */\n+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN\n+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN\n+#define R_PPC64_GOT16 R_PPC_GOT16\n+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO\n+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI\n+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA\n+\n+#define R_PPC64_COPY R_PPC_COPY\n+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT\n+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT\n+#define R_PPC64_RELATIVE R_PPC_RELATIVE\n+\n+#define R_PPC64_UADDR32 R_PPC_UADDR32\n+#define R_PPC64_UADDR16 R_PPC_UADDR16\n+#define R_PPC64_REL32 R_PPC_REL32\n+#define R_PPC64_PLT32 R_PPC_PLT32\n+#define R_PPC64_PLTREL32 R_PPC_PLTREL32\n+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO\n+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI\n+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA\n+\n+#define R_PPC64_SECTOFF R_PPC_SECTOFF\n+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO\n+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI\n+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA\n+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) \u003e\u003e 2. */\n+#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */\n+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */\n+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */\n+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */\n+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */\n+#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */\n+#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */\n+#define R_PPC64_PLT64 45 /* doubleword64 L + A. */\n+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */\n+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */\n+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */\n+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */\n+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */\n+#define R_PPC64_TOC 51 /* doubleword64 .TOC. */\n+#define R_PPC64_PLTGOT16 52 /* half16* M + A. */\n+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */\n+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */\n+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */\n+\n+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) \u003e\u003e 2. */\n+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) \u003e\u003e 2. */\n+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) \u003e\u003e 2. */\n+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) \u003e\u003e 2. */\n+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) \u003e\u003e 2. */\n+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) \u003e\u003e 2. */\n+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) \u003e\u003e 2. */\n+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) \u003e\u003e 2. */\n+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) \u003e\u003e 2. */\n+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) \u003e\u003e 2. */\n+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) \u003e\u003e 2. */\n+\n+/* PowerPC64 relocations defined for the TLS access ABI. */\n+#define R_PPC64_TLS\t\t67 /* none\t(sym+add)@tls */\n+#define R_PPC64_DTPMOD64\t68 /* doubleword64 (sym+add)@dtpmod */\n+#define R_PPC64_TPREL16\t\t69 /* half16*\t(sym+add)@tprel */\n+#define R_PPC64_TPREL16_LO\t70 /* half16\t(sym+add)@tprel@l */\n+#define R_PPC64_TPREL16_HI\t71 /* half16\t(sym+add)@tprel@h */\n+#define R_PPC64_TPREL16_HA\t72 /* half16\t(sym+add)@tprel@ha */\n+#define R_PPC64_TPREL64\t\t73 /* doubleword64 (sym+add)@tprel */\n+#define R_PPC64_DTPREL16\t74 /* half16*\t(sym+add)@dtprel */\n+#define R_PPC64_DTPREL16_LO\t75 /* half16\t(sym+add)@dtprel@l */\n+#define R_PPC64_DTPREL16_HI\t76 /* half16\t(sym+add)@dtprel@h */\n+#define R_PPC64_DTPREL16_HA\t77 /* half16\t(sym+add)@dtprel@ha */\n+#define R_PPC64_DTPREL64\t78 /* doubleword64 (sym+add)@dtprel */\n+#define R_PPC64_GOT_TLSGD16\t79 /* half16*\t(sym+add)@got@tlsgd */\n+#define R_PPC64_GOT_TLSGD16_LO\t80 /* half16\t(sym+add)@got@tlsgd@l */\n+#define R_PPC64_GOT_TLSGD16_HI\t81 /* half16\t(sym+add)@got@tlsgd@h */\n+#define R_PPC64_GOT_TLSGD16_HA\t82 /* half16\t(sym+add)@got@tlsgd@ha */\n+#define R_PPC64_GOT_TLSLD16\t83 /* half16*\t(sym+add)@got@tlsld */\n+#define R_PPC64_GOT_TLSLD16_LO\t84 /* half16\t(sym+add)@got@tlsld@l */\n+#define R_PPC64_GOT_TLSLD16_HI\t85 /* half16\t(sym+add)@got@tlsld@h */\n+#define R_PPC64_GOT_TLSLD16_HA\t86 /* half16\t(sym+add)@got@tlsld@ha */\n+#define R_PPC64_GOT_TPREL16_DS\t87 /* half16ds*\t(sym+add)@got@tprel */\n+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */\n+#define R_PPC64_GOT_TPREL16_HI\t89 /* half16\t(sym+add)@got@tprel@h */\n+#define R_PPC64_GOT_TPREL16_HA\t90 /* half16\t(sym+add)@got@tprel@ha */\n+#define R_PPC64_GOT_DTPREL16_DS\t91 /* half16ds*\t(sym+add)@got@dtprel */\n+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */\n+#define R_PPC64_GOT_DTPREL16_HI\t93 /* half16\t(sym+add)@got@dtprel@h */\n+#define R_PPC64_GOT_DTPREL16_HA\t94 /* half16\t(sym+add)@got@dtprel@ha */\n+#define R_PPC64_TPREL16_DS\t95 /* half16ds*\t(sym+add)@tprel */\n+#define R_PPC64_TPREL16_LO_DS\t96 /* half16ds\t(sym+add)@tprel@l */\n+#define R_PPC64_TPREL16_HIGHER\t97 /* half16\t(sym+add)@tprel@higher */\n+#define R_PPC64_TPREL16_HIGHERA\t98 /* half16\t(sym+add)@tprel@highera */\n+#define R_PPC64_TPREL16_HIGHEST\t99 /* half16\t(sym+add)@tprel@highest */\n+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16\t(sym+add)@tprel@highesta */\n+#define R_PPC64_DTPREL16_DS\t101 /* half16ds* (sym+add)@dtprel */\n+#define R_PPC64_DTPREL16_LO_DS\t102 /* half16ds\t(sym+add)@dtprel@l */\n+#define R_PPC64_DTPREL16_HIGHER\t103 /* half16\t(sym+add)@dtprel@higher */\n+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16\t(sym+add)@dtprel@highera */\n+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16\t(sym+add)@dtprel@highest */\n+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16\t(sym+add)@dtprel@highesta */\n+#define R_PPC64_TLSGD\t\t107\n+#define R_PPC64_TLSLD\t\t108\n+#define R_PPC64_TOCSAVE\t\t109\n+\n+#define R_PPC64_REL24_NOTOC\t116\n+#define R_PPC64_ENTRY\t\t118\n+\n+#define R_PPC64_PCREL34\t\t132\n+#define R_PPC64_GOT_PCREL34\t133\n+\n+#define R_PPC64_REL16\t\t249\n+#define R_PPC64_REL16_LO\t250\n+#define R_PPC64_REL16_HI\t251\n+#define R_PPC64_REL16_HA\t252\n+\n+/* Keep this the last entry. */\n+#define R_PPC64_NUM\t\t253\n+\n+\n+/*\n+ * RISC-V relocation types\n+ */\n+\n+/* Relocation types used by the dynamic linker */\n+#define R_RISCV_NONE\t\t0\n+#define R_RISCV_32\t\t1\n+#define R_RISCV_64\t\t2\n+#define R_RISCV_RELATIVE\t3\n+#define R_RISCV_COPY\t\t4\n+#define R_RISCV_JUMP_SLOT\t5\n+#define R_RISCV_TLS_DTPMOD32\t6\n+#define R_RISCV_TLS_DTPMOD64\t7\n+#define R_RISCV_TLS_DTPREL32\t8\n+#define R_RISCV_TLS_DTPREL64\t9\n+#define R_RISCV_TLS_TPREL32\t10\n+#define R_RISCV_TLS_TPREL64\t11\n+#define R_RISCV_IRELATIVE\t58\n+\n+/* Relocation types not used by the dynamic linker */\n+#define R_RISCV_BRANCH\t\t16\n+#define R_RISCV_JAL\t\t17\n+#define R_RISCV_CALL\t\t18\n+#define R_RISCV_CALL_PLT\t19\n+#define R_RISCV_GOT_HI20\t20\n+#define R_RISCV_TLS_GOT_HI20\t21\n+#define R_RISCV_TLS_GD_HI20\t22\n+#define R_RISCV_PCREL_HI20\t23\n+#define R_RISCV_PCREL_LO12_I\t24\n+#define R_RISCV_PCREL_LO12_S\t25\n+#define R_RISCV_HI20\t\t26\n+#define R_RISCV_LO12_I\t\t27\n+#define R_RISCV_LO12_S\t\t28\n+#define R_RISCV_TPREL_HI20\t29\n+#define R_RISCV_TPREL_LO12_I\t30\n+#define R_RISCV_TPREL_LO12_S\t31\n+#define R_RISCV_TPREL_ADD\t32\n+#define R_RISCV_ADD8\t\t33\n+#define R_RISCV_ADD16\t\t34\n+#define R_RISCV_ADD32\t\t35\n+#define R_RISCV_ADD64\t\t36\n+#define R_RISCV_SUB8\t\t37\n+#define R_RISCV_SUB16\t\t38\n+#define R_RISCV_SUB32\t\t39\n+#define R_RISCV_SUB64\t\t40\n+#define R_RISCV_GNU_VTINHERIT\t41\n+#define R_RISCV_GNU_VTENTRY\t42\n+#define R_RISCV_ALIGN\t\t43\n+#define R_RISCV_RVC_BRANCH\t44\n+#define R_RISCV_RVC_JUMP\t45\n+#define R_RISCV_GPREL_I\t\t47\n+#define R_RISCV_GPREL_S\t\t48\n+#define R_RISCV_TPREL_I\t\t49\n+#define R_RISCV_TPREL_S\t\t50\n+#define R_RISCV_RELAX\t\t51\n+#define R_RISCV_SUB6\t\t52\n+#define R_RISCV_SET6\t\t53\n+#define R_RISCV_SET8\t\t54\n+#define R_RISCV_SET16\t\t55\n+#define R_RISCV_SET32\t\t56\n+#define R_RISCV_32_PCREL\t57\n+#define R_RISCV_PLT32\t\t59\n+#define R_RISCV_SET_ULEB128\t60\n+#define R_RISCV_SUB_ULEB128\t61\n+\n+/* LoongArch relocation types used by the dynamic linker */\n+#define R_LARCH_NONE\t\t\t\t0\n+#define R_LARCH_32\t\t\t\t1\n+#define R_LARCH_64\t\t\t\t2\n+#define R_LARCH_RELATIVE\t\t\t3\n+#define R_LARCH_COPY\t\t\t\t4\n+#define R_LARCH_JUMP_SLOT\t\t\t5\n+#define R_LARCH_TLS_DTPMOD32\t\t\t6\n+#define R_LARCH_TLS_DTPMOD64\t\t\t7\n+#define R_LARCH_TLS_DTPREL32\t\t\t8\n+#define R_LARCH_TLS_DTPREL64\t\t\t9\n+#define R_LARCH_TLS_TPREL32\t\t\t10\n+#define R_LARCH_TLS_TPREL64\t\t\t11\n+#define R_LARCH_IRELATIVE\t\t\t12\n+#define R_LARCH_MARK_LA\t\t\t\t20\n+#define R_LARCH_MARK_PCREL\t\t\t21\n+#define R_LARCH_SOP_PUSH_PCREL\t\t\t22\n+#define R_LARCH_SOP_PUSH_ABSOLUTE\t\t23\n+#define R_LARCH_SOP_PUSH_DUP\t\t\t24\n+#define R_LARCH_SOP_PUSH_GPREL\t\t\t25\n+#define R_LARCH_SOP_PUSH_TLS_TPREL\t\t26\n+#define R_LARCH_SOP_PUSH_TLS_GOT\t\t27\n+#define R_LARCH_SOP_PUSH_TLS_GD\t\t\t28\n+#define R_LARCH_SOP_PUSH_PLT_PCREL\t\t29\n+#define R_LARCH_SOP_ASSERT\t\t\t30\n+#define R_LARCH_SOP_NOT\t\t\t\t31\n+#define R_LARCH_SOP_SUB\t\t\t\t32\n+#define R_LARCH_SOP_SL\t\t\t\t33\n+#define R_LARCH_SOP_SR\t\t\t\t34\n+#define R_LARCH_SOP_ADD\t\t\t\t35\n+#define R_LARCH_SOP_AND\t\t\t\t36\n+#define R_LARCH_SOP_IF_ELSE\t\t\t37\n+#define R_LARCH_SOP_POP_32_S_10_5\t\t38\n+#define R_LARCH_SOP_POP_32_U_10_12\t\t39\n+#define R_LARCH_SOP_POP_32_S_10_12\t\t40\n+#define R_LARCH_SOP_POP_32_S_10_16\t\t41\n+#define R_LARCH_SOP_POP_32_S_10_16_S2\t\t42\n+#define R_LARCH_SOP_POP_32_S_5_20\t\t43\n+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2\t44\n+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2\t45\n+#define R_LARCH_SOP_POP_32_U\t\t\t46\n+#define R_LARCH_ADD8\t\t\t\t47\n+#define R_LARCH_ADD16\t\t\t\t48\n+#define R_LARCH_ADD24\t\t\t\t49\n+#define R_LARCH_ADD32\t\t\t\t50\n+#define R_LARCH_ADD64\t\t\t\t51\n+#define R_LARCH_SUB8\t\t\t\t52\n+#define R_LARCH_SUB16\t\t\t\t53\n+#define R_LARCH_SUB24\t\t\t\t54\n+#define R_LARCH_SUB32\t\t\t\t55\n+#define R_LARCH_SUB64\t\t\t\t56\n+#define R_LARCH_GNU_VTINHERIT\t\t\t57\n+#define R_LARCH_GNU_VTENTRY\t\t\t58\n+#define R_LARCH_B16\t\t\t\t64\n+#define R_LARCH_B21\t\t\t\t65\n+#define R_LARCH_B26\t\t\t\t66\n+#define R_LARCH_ABS_HI20\t\t\t67\n+#define R_LARCH_ABS_LO12\t\t\t68\n+#define R_LARCH_ABS64_LO20\t\t\t69\n+#define R_LARCH_ABS64_HI12\t\t\t70\n+#define R_LARCH_PCALA_HI20\t\t\t71\n+#define R_LARCH_PCALA_LO12\t\t\t72\n+#define R_LARCH_PCALA64_LO20\t\t\t73\n+#define R_LARCH_PCALA64_HI12\t\t\t74\n+#define R_LARCH_GOT_PC_HI20\t\t\t75\n+#define R_LARCH_GOT_PC_LO12\t\t\t76\n+#define R_LARCH_GOT64_PC_LO20\t\t\t77\n+#define R_LARCH_GOT64_PC_HI12\t\t\t78\n+#define R_LARCH_GOT_HI20\t\t\t79\n+#define R_LARCH_GOT_LO12\t\t\t80\n+#define R_LARCH_GOT64_LO20\t\t\t81\n+#define R_LARCH_GOT64_HI12\t\t\t82\n+#define R_LARCH_TLS_LE_HI20\t\t\t83\n+#define R_LARCH_TLS_LE_LO12\t\t\t84\n+#define R_LARCH_TLS_LE64_LO20\t\t\t85\n+#define R_LARCH_TLS_LE64_HI12\t\t\t86\n+#define R_LARCH_TLS_IE_PC_HI20\t\t\t87\n+#define R_LARCH_TLS_IE_PC_LO12\t\t\t88\n+#define R_LARCH_TLS_IE64_PC_LO20\t\t89\n+#define R_LARCH_TLS_IE64_PC_HI12\t\t90\n+#define R_LARCH_TLS_IE_HI20\t\t\t91\n+#define R_LARCH_TLS_IE_LO12\t\t\t92\n+#define R_LARCH_TLS_IE64_LO20\t\t\t93\n+#define R_LARCH_TLS_IE64_HI12\t\t\t94\n+#define R_LARCH_TLS_LD_PC_HI20\t\t\t95\n+#define R_LARCH_TLS_LD_HI20\t\t\t96\n+#define R_LARCH_TLS_GD_PC_HI20\t\t\t97\n+#define R_LARCH_TLS_GD_HI20\t\t\t98\n+#define R_LARCH_32_PCREL\t\t\t99\n+#define R_LARCH_RELAX\t\t\t\t100\n+#define R_LARCH_DELETE\t\t\t\t101\n+#define R_LARCH_ALIGN\t\t\t\t102\n+#define R_LARCH_PCREL20_S2\t\t\t103\n+#define R_LARCH_CFA\t\t\t\t104\n+#define R_LARCH_ADD6\t\t\t\t105\n+#define R_LARCH_SUB6\t\t\t\t106\n+#define R_LARCH_ADD_ULEB128\t\t\t107\n+#define R_LARCH_SUB_ULEB128\t\t\t108\n+#define R_LARCH_64_PCREL\t\t\t109\n+#define R_LARCH_CALL36\t\t\t\t110\n+#define R_LARCH_TLS_DESC_PC_HI20\t\t111\n+#define R_LARCH_TLS_DESC_PC_LO12\t\t112\n+#define R_LARCH_TLS_DESC64_PC_LO20\t\t113\n+#define R_LARCH_TLS_DESC64_PC_HI12\t\t114\n+#define R_LARCH_TLS_DESC_HI20\t\t\t115\n+#define R_LARCH_TLS_DESC_LO12\t\t\t116\n+#define R_LARCH_TLS_DESC64_LO20\t\t\t117\n+#define R_LARCH_TLS_DESC64_HI12\t\t\t118\n+#define R_LARCH_TLS_DESC_LD\t\t\t119\n+#define R_LARCH_TLS_DESC_CALL\t\t\t120\n+#define R_LARCH_TLS_LE_HI20_R\t\t\t121\n+#define R_LARCH_TLS_LE_ADD_R\t\t\t122\n+#define R_LARCH_TLS_LE_LO12_R\t\t\t123\n+#define R_LARCH_TLS_LD_PCREL20_S2\t\t124\n+#define R_LARCH_TLS_GD_PCREL20_S2\t\t125\n+#define R_LARCH_TLS_DESC_PCREL20_S2\t\t126\n+#define R_LARCH_CALL30\t\t\t\t127\n+#define R_LARCH_PCADD_HI20\t\t\t128\n+#define R_LARCH_PCADD_LO12\t\t\t129\n+#define R_LARCH_GOT_PCADD_HI20\t\t\t130\n+#define R_LARCH_GOT_PCADD_LO12\t\t\t131\n+#define R_LARCH_TLS_IE_PCADD_HI20\t\t132\n+#define R_LARCH_TLS_IE_PCADD_LO12\t\t133\n+#define R_LARCH_TLS_LD_PCADD_HI20\t\t134\n+#define R_LARCH_TLS_LD_PCADD_LO12\t\t135\n+#define R_LARCH_TLS_GD_PCADD_HI20\t\t136\n+#define R_LARCH_TLS_GD_PCADD_LO12\t\t137\n+#define R_LARCH_TLS_DESC_PCADD_HI20\t\t138\n+#define R_LARCH_TLS_DESC_PCADD_LO12\t\t139\n+\n+/* s390 relocations defined by the ABIs */\n+#define R_390_NONE\t\t0\t/* No reloc. */\n+#define R_390_8\t\t\t1\t/* Direct 8 bit. */\n+#define R_390_12\t\t2\t/* Direct 12 bit. */\n+#define R_390_16\t\t3\t/* Direct 16 bit. */\n+#define R_390_32\t\t4\t/* Direct 32 bit. */\n+#define R_390_PC32\t\t5\t/* PC relative 32 bit.\t*/\n+#define R_390_GOT12\t\t6\t/* 12 bit GOT offset. */\n+#define R_390_GOT32\t\t7\t/* 32 bit GOT offset. */\n+#define R_390_PLT32\t\t8\t/* 32 bit PC relative PLT address. */\n+#define R_390_COPY\t\t9\t/* Copy symbol at runtime. */\n+#define R_390_GLOB_DAT\t\t10\t/* Create GOT entry. */\n+#define R_390_JMP_SLOT\t\t11\t/* Create PLT entry. */\n+#define R_390_RELATIVE\t\t12\t/* Adjust by program base. */\n+#define R_390_GOTOFF32\t\t13\t/* 32 bit offset to GOT.\t */\n+#define R_390_GOTPC\t\t14\t/* 32 bit PC rel. offset to GOT. */\n+#define R_390_GOT16\t\t15\t/* 16 bit GOT offset. */\n+#define R_390_PC16\t\t16\t/* PC relative 16 bit.\t*/\n+#define R_390_PC16DBL\t\t17\t/* PC relative 16 bit shifted by 1. */\n+#define R_390_PLT16DBL\t\t18\t/* 16 bit PC rel. PLT shifted by 1. */\n+#define R_390_PC32DBL\t\t19\t/* PC relative 32 bit shifted by 1. */\n+#define R_390_PLT32DBL\t\t20\t/* 32 bit PC rel. PLT shifted by 1. */\n+#define R_390_GOTPCDBL\t\t21\t/* 32 bit PC rel. GOT shifted by 1. */\n+#define R_390_64\t\t22\t/* Direct 64 bit. */\n+#define R_390_PC64\t\t23\t/* PC relative 64 bit.\t*/\n+#define R_390_GOT64\t\t24\t/* 64 bit GOT offset. */\n+#define R_390_PLT64\t\t25\t/* 64 bit PC relative PLT address. */\n+#define R_390_GOTENT\t\t26\t/* 32 bit PC rel. to GOT entry \u003e\u003e 1. */\n+#define R_390_GOTOFF16\t\t27\t/* 16 bit offset to GOT. */\n+#define R_390_GOTOFF64\t\t28\t/* 64 bit offset to GOT. */\n+#define R_390_GOTPLT12\t\t29\t/* 12 bit offset to jump slot.\t*/\n+#define R_390_GOTPLT16\t\t30\t/* 16 bit offset to jump slot.\t*/\n+#define R_390_GOTPLT32\t\t31\t/* 32 bit offset to jump slot.\t*/\n+#define R_390_GOTPLT64\t\t32\t/* 64 bit offset to jump slot.\t*/\n+#define R_390_GOTPLTENT\t\t33\t/* 32 bit rel. offset to jump slot. */\n+#define R_390_PLTOFF16\t\t34\t/* 16 bit offset from GOT to PLT. */\n+#define R_390_PLTOFF32\t\t35\t/* 32 bit offset from GOT to PLT. */\n+#define R_390_PLTOFF64\t\t36\t/* 16 bit offset from GOT to PLT. */\n+#define R_390_TLS_LOAD\t\t37\t/* Tag for load insn in TLS code. */\n+#define R_390_TLS_GDCALL\t38\t/* Tag for function call in general\n+ dynamic TLS code. */\n+#define R_390_TLS_LDCALL\t39\t/* Tag for function call in local\n+ dynamic TLS code. */\n+#define R_390_TLS_GD32\t\t40\t/* Direct 32 bit for general dynamic\n+ thread local data. */\n+#define R_390_TLS_GD64\t\t41\t/* Direct 64 bit for general dynamic\n+ thread local data. */\n+#define R_390_TLS_GOTIE12\t42\t/* 12 bit GOT offset for static TLS\n+ block offset. */\n+#define R_390_TLS_GOTIE32\t43\t/* 32 bit GOT offset for static TLS\n+ block offset. */\n+#define R_390_TLS_GOTIE64\t44\t/* 64 bit GOT offset for static TLS\n+ block offset. */\n+#define R_390_TLS_LDM32\t\t45\t/* Direct 32 bit for local dynamic\n+ thread local data in LD code. */\n+#define R_390_TLS_LDM64\t\t46\t/* Direct 64 bit for local dynamic\n+ thread local data in LD code. */\n+#define R_390_TLS_IE32\t\t47\t/* 32 bit address of GOT entry for\n+ negated static TLS block offset. */\n+#define R_390_TLS_IE64\t\t48\t/* 64 bit address of GOT entry for\n+ negated static TLS block offset. */\n+#define R_390_TLS_IEENT\t\t49\t/* 32 bit rel. offset to GOT entry for\n+ negated static TLS block offset. */\n+#define R_390_TLS_LE32\t\t50\t/* 32 bit negated offset relative to\n+ static TLS block. */\n+#define R_390_TLS_LE64\t\t51\t/* 64 bit negated offset relative to\n+ static TLS block. */\n+#define R_390_TLS_LDO32\t\t52\t/* 32 bit offset relative to TLS\n+ block. */\n+#define R_390_TLS_LDO64\t\t53\t/* 64 bit offset relative to TLS\n+ block. */\n+#define R_390_TLS_DTPMOD\t54\t/* ID of module containing symbol. */\n+#define R_390_TLS_DTPOFF\t55\t/* Offset in TLS block. */\n+#define R_390_TLS_TPOFF\t\t56\t/* Negate offset in static TLS\n+ block. */\n+#define R_390_20\t\t57\t/* Direct 20 bit. */\n+#define R_390_GOT20\t\t58\t/* 20 bit GOT offset. */\n+#define R_390_GOTPLT20\t\t59\t/* 20 bit offset to jump slot. */\n+#define R_390_TLS_GOTIE20\t60\t/* 20 bit GOT offset for static TLS\n+\t\t\t\t\t block offset. */\n+/* Keep this the last entry. */\n+#define R_390_NUM\t61\n+\n+/* MIPS relocations defined by the ABIs */\n+#define R_MIPS_NONE\t\t0\n+#define R_MIPS_16\t\t1\n+#define R_MIPS_32\t\t2\n+#define R_MIPS_REL32\t\t3\n+#define R_MIPS_26\t\t4\n+#define R_MIPS_HI16\t\t5\n+#define R_MIPS_LO16\t\t6\n+#define R_MIPS_GPREL16\t\t7\n+#define R_MIPS_LITERAL\t\t8\n+#define R_MIPS_GOT16\t\t9\n+#define R_MIPS_PC16\t\t10\n+#define R_MIPS_CALL16\t\t11\n+#define R_MIPS_GPREL32\t\t12\n+/* The remaining relocs are defined on Irix, although they are not\n+ in the MIPS ELF ABI.\t */\n+#define R_MIPS_UNUSED1\t\t13\n+#define R_MIPS_UNUSED2\t\t14\n+#define R_MIPS_UNUSED3\t\t15\n+#define R_MIPS_SHIFT5\t\t16\n+#define R_MIPS_SHIFT6\t\t17\n+#define R_MIPS_64\t\t18\n+#define R_MIPS_GOT_DISP\t\t19\n+#define R_MIPS_GOT_PAGE\t\t20\n+#define R_MIPS_GOT_OFST\t\t21\n+/*\n+ * The following two relocation types are specified in the MIPS ABI\n+ * conformance guide version 1.2 but not yet in the psABI.\n+ */\n+#define R_MIPS_GOTHI16\t\t22\n+#define R_MIPS_GOTLO16\t\t23\n+#define R_MIPS_SUB\t\t24\n+#define R_MIPS_INSERT_A\t\t25\n+#define R_MIPS_INSERT_B\t\t26\n+#define R_MIPS_DELETE\t\t27\n+#define R_MIPS_HIGHER\t\t28\n+#define R_MIPS_HIGHEST\t\t29\n+/*\n+ * The following two relocation types are specified in the MIPS ABI\n+ * conformance guide version 1.2 but not yet in the psABI.\n+ */\n+#define R_MIPS_CALLHI16\t\t30\n+#define R_MIPS_CALLLO16\t\t31\n+/*\n+ * Introduced for MIPSr6.\n+ */\n+#define R_MIPS_PC21_S2\t\t60\n+#define R_MIPS_PC26_S2\t\t61\n+#define R_MIPS_PC18_S3\t\t62\n+#define R_MIPS_PC19_S2\t\t63\n+#define R_MIPS_PCHI16\t\t64\n+#define R_MIPS_PCLO16\t\t65\n+/*\n+ * This range is reserved for vendor specific relocations.\n+ */\n+#define R_MIPS_LOVENDOR\t\t100\n+#define R_MIPS_HIVENDOR\t\t127\n+\n+#define R_MIPS_PC32\t\t248\n+\n+/*\n+ * Sparc ELF relocation types\n+ */\n+#define\tR_SPARC_NONE\t\t0\n+#define\tR_SPARC_8\t\t1\n+#define\tR_SPARC_16\t\t2\n+#define\tR_SPARC_32\t\t3\n+#define\tR_SPARC_DISP8\t\t4\n+#define\tR_SPARC_DISP16\t\t5\n+#define\tR_SPARC_DISP32\t\t6\n+#define\tR_SPARC_WDISP30\t\t7\n+#define\tR_SPARC_WDISP22\t\t8\n+#define\tR_SPARC_HI22\t\t9\n+#define\tR_SPARC_22\t\t10\n+#define\tR_SPARC_13\t\t11\n+#define\tR_SPARC_LO10\t\t12\n+#define\tR_SPARC_GOT10\t\t13\n+#define\tR_SPARC_GOT13\t\t14\n+#define\tR_SPARC_GOT22\t\t15\n+#define\tR_SPARC_PC10\t\t16\n+#define\tR_SPARC_PC22\t\t17\n+#define\tR_SPARC_WPLT30\t\t18\n+#define\tR_SPARC_COPY\t\t19\n+#define\tR_SPARC_GLOB_DAT\t20\n+#define\tR_SPARC_JMP_SLOT\t21\n+#define\tR_SPARC_RELATIVE\t22\n+#define\tR_SPARC_UA32\t\t23\n+#define R_SPARC_PLT32\t\t24\n+#define R_SPARC_HIPLT22\t\t25\n+#define R_SPARC_LOPLT10\t\t26\n+#define R_SPARC_PCPLT32\t\t27\n+#define R_SPARC_PCPLT22\t\t28\n+#define R_SPARC_PCPLT10\t\t29\n+#define R_SPARC_10\t\t30\n+#define R_SPARC_11\t\t31\n+#define R_SPARC_64\t\t32\n+#define R_SPARC_OLO10\t\t33\n+#define R_SPARC_WDISP16\t\t40\n+#define R_SPARC_WDISP19\t\t41\n+#define R_SPARC_7\t\t43\n+#define R_SPARC_5\t\t44\n+#define R_SPARC_6\t\t45\n+#define R_SPARC_UA64\t\t54\n+\n+#endif /* _UAPI_LINUX_ELF_R_H */\ndiff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h\nindex ee30dcd80901f..b3e312255552b 100644\n--- a/include/uapi/linux/elf.h\n+++ b/include/uapi/linux/elf.h\n@@ -4,6 +4,7 @@\n \n #include \u003clinux/types.h\u003e\n #include \u003clinux/elf-em.h\u003e\n+#include \u003clinux/elf-r.h\u003e\n \n /* 32-bit ELF base types. */\n typedef __u32\tElf32_Addr;\ndiff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig\nindex 597f5f0f96819..12a640c78b72f 100644\n--- a/lib/vdso/Kconfig\n+++ b/lib/vdso/Kconfig\n@@ -6,6 +6,7 @@ config VDSO_DATASTORE\n config GENERIC_GETTIMEOFDAY\n \tbool\n \tselect VDSO_DATASTORE\n+\tselect VDSO_CHECK\n \thelp\n \t This is a generic implementation of gettimeofday vdso.\n \t Each architecture that enables this feature has to\n@@ -21,5 +22,11 @@ config GENERIC_VDSO_OVERFLOW_PROTECT\n config VDSO_GETRANDOM\n \tbool\n \tselect VDSO_DATASTORE\n+\tselect VDSO_CHECK\n \thelp\n \t Selected by architectures that support vDSO getrandom().\n+\n+config VDSO_CHECK\n+\tbool\n+\thelp\n+\t Selected for architectures that are supported by the 'vdsocheck' progam.\ndiff --git a/lib/vdso/Makefile b/lib/vdso/Makefile\nindex ac304def42d6d..9932b43d5bac0 100644\n--- a/lib/vdso/Makefile\n+++ b/lib/vdso/Makefile\n@@ -1,3 +1,5 @@\n # SPDX-License-Identifier: GPL-2.0-only\n \n obj-$(CONFIG_VDSO_DATASTORE) += datastore.o\n+\n+obj-y += check/\ndiff --git a/lib/vdso/Makefile.include b/lib/vdso/Makefile.include\nindex cedbf15f80874..5528e548f02e9 100644\n--- a/lib/vdso/Makefile.include\n+++ b/lib/vdso/Makefile.include\n@@ -6,6 +6,12 @@ GENERIC_VDSO_DIR := $(dir $(GENERIC_VDSO_MK_PATH))\n c-gettimeofday-$(CONFIG_GENERIC_GETTIMEOFDAY) := $(addprefix $(GENERIC_VDSO_DIR), gettimeofday.c)\n c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrandom.c)\n \n+ifeq ($(CONFIG_RUST_IS_AVAILABLE)$(CONFIG_VDSO_CHECK),yy)\n+vdsocheck := lib/vdso/check/vdsocheck\n+else\n+vdsocheck :=\n+endif\n+\n # This cmd checks that the vdso library does not contain dynamic relocations.\n # It has to be called after the linking of the vdso library and requires it\n # as a parameter.\n@@ -13,6 +19,14 @@ c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrand\n # As a workaround for some GNU ld ports which produce unneeded R_*_NONE\n # dynamic relocations, ignore R_*_NONE.\n quiet_cmd_vdso_check = VDSOCHK $@\n+ifneq ($(vdsocheck),)\n+ cmd_vdso_check = $(vdsocheck) $(filter %.o, $(real-prereqs)) $@\n+else\n cmd_vdso_check = if $(READELF) -rW $@ | grep -v _NONE | grep -q \" R_\\w*_\"; \\\n \t\t then (echo \u003e\u00262 \"$@: dynamic relocations are not supported\"; \\\n \t\t\t rm -f $@; /bin/false); fi\n+endif\n+\n+# Variant of cmd_ld which does not try to link the vdsocheck tool.\n+quiet_cmd_ld_vdso = VDSOLD $@\n+ cmd_ld_vdso = $(LD) $(ld_flags) $(filter-out $(vdsocheck), $(real-prereqs)) -o $@\ndiff --git a/lib/vdso/check/.gitignore b/lib/vdso/check/.gitignore\nnew file mode 100644\nindex 0000000000000..751be38f11f21\n--- /dev/null\n+++ b/lib/vdso/check/.gitignore\n@@ -0,0 +1,3 @@\n+/bindings.rs\n+/libbindings.rlib\n+/vdsocheck\ndiff --git a/lib/vdso/check/Makefile b/lib/vdso/check/Makefile\nnew file mode 100644\nindex 0000000000000..98de42c6c0ebe\n--- /dev/null\n+++ b/lib/vdso/check/Makefile\n@@ -0,0 +1,34 @@\n+# SPDX-License-Identifier: GPL-2.0-only\n+\n+quiet_cmd_host_bindgen = HOSTBINDGEN $@\n+ cmd_host_bindgen = $(BINDGEN) $\u003c -o $@ --depfile $(depfile) -- $(HOSTBINDGEN_FLAGS)\n+\n+quiet_cmd_host_rustlib = HOSTRUSTC L $@\n+ cmd_host_rustlib = \\\n+\t$(HOSTRUSTC) $(hostrust_flags) \\\n+\t\t--emit=dep-info=$(depfile) --emit=link=$@ \\\n+\t\t--crate-type rlib \\\n+\t\t--crate-name $(patsubst %.rlib,%,$(notdir $@)) $\u003c\n+\n+uapi-directory := $(srctree)/tools/include/uapi\n+\n+# bindings.rs will be generated in the build directory, but rustc can not use\n+# source code from both the source and build directory together.\n+# Compile the binding code into a library first.\n+$(obj)/bindings.rs: HOSTBINDGEN_FLAGS := -I$(uapi-directory)\n+$(obj)/bindings.rs: $(uapi-directory)/linux/elf.h FORCE\n+\t$(call if_changed_dep,host_bindgen)\n+\n+HOSTRUSTFLAGS_libbindings := -Amissing_docs -Anon-camel-case-types\n+$(obj)/libbindings.rlib: $(obj)/bindings.rs FORCE\n+\t$(call if_changed_dep,host_rustlib)\n+\n+targets += bindings.rs libbindings.rlib\n+\n+hostprogs += vdsocheck\n+vdsocheck-rust := y\n+HOSTRUSTFLAGS_vdsocheck := --extern=bindings=$(obj)/libbindings.rlib\n+$(obj)/vdsocheck: $(obj)/libbindings.rlib\n+\n+PHONY += vdsocheck\n+vdsocheck: $(obj)/vdsocheck\ndiff --git a/lib/vdso/check/elf.rs b/lib/vdso/check/elf.rs\nnew file mode 100644\nindex 0000000000000..520285d6fd10a\n--- /dev/null\n+++ b/lib/vdso/check/elf.rs\n@@ -0,0 +1,498 @@\n+// SPDX-License-Identifier: GPL-2.0\n+\n+#![allow(unreachable_pub)]\n+\n+use core::fmt;\n+use core::iter::Iterator;\n+use core::result::Result;\n+use core::str;\n+\n+use ::bindings;\n+\n+#[derive(Debug, Copy, Clone)]\n+enum ByteOrder {\n+ LittleEndian,\n+ BigEndian,\n+}\n+\n+trait ToCpu {\n+ fn to_cpu(self, byteorder: ByteOrder) -\u003e Self;\n+}\n+\n+macro_rules! declare_to_cpu {\n+ ($t:ty) =\u003e {\n+ impl ToCpu for $t {\n+ fn to_cpu(self, byteorder: ByteOrder) -\u003e Self {\n+ match byteorder {\n+ ByteOrder::LittleEndian =\u003e Self::from_le(self),\n+ ByteOrder::BigEndian =\u003e Self::from_be(self),\n+ }\n+ }\n+ }\n+ };\n+}\n+\n+declare_to_cpu!(u16);\n+declare_to_cpu!(u32);\n+declare_to_cpu!(u64);\n+\n+#[derive(Debug, Copy, Clone)]\n+enum Class {\n+ Elf32,\n+ Elf64,\n+}\n+\n+enum ClassAlternative\u003cT32, T64\u003e {\n+ Elf32(T32),\n+ Elf64(T64),\n+}\n+\n+#[derive(Debug)]\n+pub enum ParseError {\n+ InvalidFileMagic([u8; 4]),\n+ InvalidFileClass(u32),\n+ InvalidFileByteOrder(u32),\n+ InvalidSectionSize,\n+ MissingStringTable,\n+ StrtabIndexOutOfRange,\n+ IndexOutOfRange,\n+ StrtabInvalidData(str::Utf8Error),\n+}\n+\n+pub type ParseResult\u003cT\u003e = Result\u003cT, ParseError\u003e;\n+\n+impl fmt::Display for ParseError {\n+ fn fmt(\u0026self, f: \u0026mut fmt::Formatter\u003c'_\u003e) -\u003e fmt::Result {\n+ match self {\n+ ParseError::InvalidFileMagic(m) =\u003e write!(f, \"Invalid ELF magic {:?}\", m),\n+ ParseError::InvalidFileClass(c) =\u003e write!(f, \"Invalid ELF class {}\", c),\n+ ParseError::InvalidFileByteOrder(b) =\u003e write!(f, \"Invalid ELF byteorder {}\", b),\n+ ParseError::InvalidSectionSize =\u003e write!(f, \"Invalid ELF section size\"),\n+ ParseError::MissingStringTable =\u003e write!(f, \"Missing string table\"),\n+ ParseError::IndexOutOfRange =\u003e write!(f, \"Index out of range\"),\n+ ParseError::StrtabIndexOutOfRange =\u003e write!(f, \"String table index out of range\"),\n+ ParseError::StrtabInvalidData(e) =\u003e write!(f, \"Invalid data in string table: {}\", e),\n+ }\n+ }\n+}\n+\n+fn read_from_bytes\u003cT: Copy\u003e(data: \u0026[u8]) -\u003e ParseResult\u003cT\u003e {\n+ if data.len() \u003c core::mem::size_of::\u003cT\u003e() {\n+ Err(ParseError::IndexOutOfRange)?\n+ }\n+ let ptr = data.as_ptr() as *const T;\n+ // SAFETY: `T` is `Copy` by the type constraints.\n+ // `ptr` is valid as it is derived from the slice `data` above.\n+ // `self.data.len()` being large enough is guaranteed by the runtime check above.\n+ Ok(unsafe { ptr.read_unaligned() })\n+}\n+\n+fn get_data_subslice(data: \u0026[u8], offset: u64, size: u64) -\u003e ParseResult\u003c\u0026[u8]\u003e {\n+ let start: usize = offset.try_into().map_err(|_| ParseError::IndexOutOfRange)?;\n+ let size: usize = size.try_into().map_err(|_| ParseError::IndexOutOfRange)?;\n+ let end = start.checked_add(size).ok_or(ParseError::IndexOutOfRange)?;\n+\n+ Ok(\u0026data[start..end])\n+}\n+\n+/// Representation of a complete ELF file.\n+#[derive(Debug)]\n+pub struct File\u003c'a\u003e {\n+ byteorder: ByteOrder,\n+ class: Class,\n+ pub type_: u16,\n+ pub machine: u16,\n+ pub data: \u0026'a [u8],\n+ section_headers: SectionInfo\u003c'a\u003e,\n+ section_names: StrtabSection\u003c'a\u003e,\n+}\n+\n+impl\u003c'a\u003e File\u003c'a\u003e {\n+ pub fn new_from_bytes(data: \u0026'a [u8]) -\u003e Result\u003cSelf, ParseError\u003e {\n+ const ELF_MAGIC: [u8; 4] = [\n+ bindings::ELFMAG0 as u8,\n+ bindings::ELFMAG1 as u8,\n+ bindings::ELFMAG2 as u8,\n+ bindings::ELFMAG3 as u8,\n+ ];\n+ let ehdr: bindings::elf32_hdr = read_from_bytes(data)?;\n+\n+ let magic = [\n+ ehdr.e_ident[bindings::EI_MAG0 as usize],\n+ ehdr.e_ident[bindings::EI_MAG1 as usize],\n+ ehdr.e_ident[bindings::EI_MAG2 as usize],\n+ ehdr.e_ident[bindings::EI_MAG3 as usize],\n+ ];\n+\n+ if magic != ELF_MAGIC {\n+ return Err(ParseError::InvalidFileMagic(magic));\n+ }\n+\n+ let class = match ehdr.e_ident[bindings::EI_CLASS as usize] as u32 {\n+ bindings::ELFCLASS32 =\u003e Class::Elf32,\n+ bindings::ELFCLASS64 =\u003e Class::Elf64,\n+ c =\u003e return Err(ParseError::InvalidFileClass(c)),\n+ };\n+\n+ let byteorder = match ehdr.e_ident[bindings::EI_DATA as usize] as u32 {\n+ bindings::ELFDATA2LSB =\u003e ByteOrder::LittleEndian,\n+ bindings::ELFDATA2MSB =\u003e ByteOrder::BigEndian,\n+ b =\u003e return Err(ParseError::InvalidFileByteOrder(b)),\n+ };\n+\n+ let (type_, machine, shnum, shoff, shentsize, shstrndx) = match class {\n+ Class::Elf32 =\u003e {\n+ let ehdr: bindings::elf32_hdr = read_from_bytes(data)?;\n+ (\n+ ehdr.e_type.to_cpu(byteorder),\n+ ehdr.e_machine.to_cpu(byteorder),\n+ ehdr.e_shnum.to_cpu(byteorder),\n+ ehdr.e_shoff.to_cpu(byteorder).into(),\n+ ehdr.e_shentsize.to_cpu(byteorder),\n+ ehdr.e_shstrndx.to_cpu(byteorder),\n+ )\n+ }\n+ Class::Elf64 =\u003e {\n+ let ehdr: bindings::elf64_hdr = read_from_bytes(data)?;\n+ (\n+ ehdr.e_type.to_cpu(byteorder),\n+ ehdr.e_machine.to_cpu(byteorder),\n+ ehdr.e_shnum.to_cpu(byteorder),\n+ ehdr.e_shoff.to_cpu(byteorder),\n+ ehdr.e_shentsize.to_cpu(byteorder),\n+ ehdr.e_shstrndx.to_cpu(byteorder),\n+ )\n+ }\n+ };\n+\n+ let section_headers = SectionInfo {\n+ byteorder,\n+ class,\n+ entsize: shentsize.into(),\n+ data: get_data_subslice(data, shoff, u64::from(shnum) * u64::from(shentsize))?,\n+ name: \"\u003csection headers\u003e\",\n+ };\n+\n+ let string_table = SectionHeaderIterator::new(\u0026section_headers, data)?\n+ .nth(shstrndx.into())\n+ .ok_or(ParseError::MissingStringTable)??;\n+\n+ let section_names = StrtabSection(SectionInfo {\n+ name: \"\u003csection header names\u003e\",\n+ byteorder,\n+ class,\n+ data: string_table.data,\n+ entsize: string_table.entsize,\n+ });\n+\n+ Ok(File {\n+ byteorder,\n+ class,\n+ type_,\n+ machine,\n+ section_headers,\n+ section_names,\n+ data,\n+ })\n+ }\n+\n+ pub fn sections(\u0026self) -\u003e ParseResult\u003cSectionIterator\u003c'_\u003e\u003e {\n+ Ok(SectionIterator {\n+ file: self,\n+ section_headers: SectionHeaderIterator::new(\u0026self.section_headers, self.data)?,\n+ })\n+ }\n+}\n+\n+/// High-level representation of an ELF section.\n+#[derive(Clone, Debug)]\n+pub struct SectionInfo\u003c'a\u003e {\n+ byteorder: ByteOrder,\n+ class: Class,\n+ pub name: \u0026'a str,\n+ entsize: u64,\n+ pub data: \u0026'a [u8],\n+}\n+\n+/// Typed high-level iterator over all sections in a `File`.\n+#[derive(Debug)]\n+pub enum Section\u003c'a\u003e {\n+ Null(SectionInfo\u003c'a\u003e),\n+ Rel(RelSection\u003c'a\u003e),\n+ Rela(RelaSection\u003c'a\u003e),\n+ Strtab(StrtabSection\u003c'a\u003e),\n+ Unknown(SectionInfo\u003c'a\u003e),\n+}\n+\n+impl\u003c'a\u003e Section\u003c'a\u003e {\n+ pub fn info(\u0026'a self) -\u003e \u0026'a SectionInfo\u003c'a\u003e {\n+ match self {\n+ Section::Null(info) | Section::Unknown(info) =\u003e info,\n+ Section::Rel(rel) =\u003e \u0026rel.0,\n+ Section::Rela(rela) =\u003e \u0026rela.0,\n+ Section::Strtab(strtab) =\u003e \u0026strtab.0,\n+ }\n+ }\n+}\n+\n+pub struct SectionIterator\u003c'a\u003e {\n+ file: \u0026'a File\u003c'a\u003e,\n+ section_headers: SectionHeaderIterator\u003c'a, 'a\u003e,\n+}\n+\n+impl\u003c'a\u003e Iterator for SectionIterator\u003c'a\u003e {\n+ type Item = ParseResult\u003cSection\u003c'a\u003e\u003e;\n+\n+ fn next(\u0026mut self) -\u003e Option\u003cSelf::Item\u003e {\n+ self.section_headers.next().map(|header| {\n+ let header = header?;\n+ let info = SectionInfo {\n+ byteorder: self.file.byteorder,\n+ class: self.file.class,\n+ name: self.file.section_names.entry(header.name)?,\n+ entsize: header.entsize,\n+ data: header.data,\n+ };\n+\n+ Ok(match header.type_ {\n+ bindings::SHT_NULL =\u003e Section::Null(info),\n+ bindings::SHT_RELA =\u003e Section::Rela(RelaSection(info)),\n+ bindings::SHT_REL =\u003e Section::Rel(RelSection(info)),\n+ bindings::SHT_STRTAB =\u003e Section::Strtab(StrtabSection(info)),\n+ _ =\u003e Section::Unknown(info),\n+ })\n+ })\n+ }\n+}\n+\n+/// Iterator over a section of data containing instances of type `T`.\n+struct SectionEntityIterator\u003c'a, T: Copy\u003e {\n+ data: \u0026'a [u8],\n+ byteorder: ByteOrder,\n+ _phantom: core::marker::PhantomData\u003cT\u003e,\n+}\n+\n+impl\u003c'a, T: Copy\u003e SectionEntityIterator\u003c'a, T\u003e {\n+ const ENTITY_SIZE: usize = core::mem::size_of::\u003cT\u003e();\n+\n+ fn new(section: \u0026'a SectionInfo\u003c'a\u003e) -\u003e ParseResult\u003cSelf\u003e {\n+ let data = section.data;\n+\n+ if section.entsize != Self::ENTITY_SIZE as u64 {\n+ return Err(ParseError::InvalidSectionSize);\n+ }\n+\n+ if !data.len().is_multiple_of(Self::ENTITY_SIZE) {\n+ return Err(ParseError::InvalidSectionSize);\n+ }\n+\n+ Ok(Self {\n+ data,\n+ byteorder: section.byteorder,\n+ _phantom: core::marker::PhantomData,\n+ })\n+ }\n+}\n+\n+impl\u003c'a, T: Copy\u003e Iterator for SectionEntityIterator\u003c'a, T\u003e {\n+ type Item = T;\n+\n+ fn next(\u0026mut self) -\u003e Option\u003cSelf::Item\u003e {\n+ if self.data.len() != 0 {\n+ let ptr = self.data.as_ptr() as *const T;\n+ // SAFETY: `T` is `Copy` by the type constraints.\n+ // `ptr` is valid as it is derived from the slice `data` above.\n+ // `self.data.len()` being a multiple of `Self::ENTITY_SIZE` is\n+ // guaranteed by `SectionEntityIterator::new`.\n+ let entity: T = unsafe { ptr.read_unaligned() };\n+ self.data = \u0026self.data[Self::ENTITY_SIZE..];\n+ Some(entity)\n+ } else {\n+ None\n+ }\n+ }\n+}\n+\n+/// Class-independent representation of an entry in a section header table.\n+#[derive(Debug)]\n+struct SectionHeader\u003c'a\u003e {\n+ name: u32,\n+ type_: u32,\n+ entsize: u64,\n+ data: \u0026'a [u8],\n+}\n+\n+/// Iterator over the section header table.\n+struct SectionHeaderIterator\u003c'f: 'a, 'a\u003e(\n+ ClassAlternative\u003c\n+ SectionEntityIterator\u003c'a, bindings::elf32_shdr\u003e,\n+ SectionEntityIterator\u003c'a, bindings::elf64_shdr\u003e,\n+ \u003e,\n+ \u0026'f [u8],\n+);\n+\n+impl\u003c'f: 'a, 'a\u003e SectionHeaderIterator\u003c'f, 'a\u003e {\n+ fn new(section: \u0026'a SectionInfo\u003c'a\u003e, file_data: \u0026'f [u8]) -\u003e ParseResult\u003cSelf\u003e {\n+ Ok(Self(\n+ match section.class {\n+ Class::Elf32 =\u003e ClassAlternative::Elf32(SectionEntityIterator::new(section)?),\n+ Class::Elf64 =\u003e ClassAlternative::Elf64(SectionEntityIterator::new(section)?),\n+ },\n+ file_data,\n+ ))\n+ }\n+}\n+\n+impl\u003c'f: 'a, 'a\u003e Iterator for SectionHeaderIterator\u003c'f, 'a\u003e {\n+ type Item = ParseResult\u003cSectionHeader\u003c'f\u003e\u003e;\n+\n+ fn next(\u0026mut self) -\u003e Option\u003cSelf::Item\u003e {\n+ let file_data = self.1;\n+\n+ match \u0026mut self.0 {\n+ ClassAlternative::Elf32(iter) =\u003e iter.next().map(|n| {\n+ Ok(SectionHeader {\n+ name: n.sh_name.to_cpu(iter.byteorder).into(),\n+ type_: n.sh_type.to_cpu(iter.byteorder).into(),\n+ entsize: n.sh_entsize.to_cpu(iter.byteorder).into(),\n+ data: get_data_subslice(\n+ file_data,\n+ n.sh_offset.to_cpu(iter.byteorder).into(),\n+ n.sh_size.to_cpu(iter.byteorder).into(),\n+ )?,\n+ })\n+ }),\n+ ClassAlternative::Elf64(iter) =\u003e iter.next().map(|n| {\n+ Ok(SectionHeader {\n+ name: n.sh_name.to_cpu(iter.byteorder).into(),\n+ type_: n.sh_type.to_cpu(iter.byteorder).into(),\n+ entsize: n.sh_entsize.to_cpu(iter.byteorder).into(),\n+ data: get_data_subslice(\n+ file_data,\n+ n.sh_offset.to_cpu(iter.byteorder).into(),\n+ n.sh_size.to_cpu(iter.byteorder).into(),\n+ )?,\n+ })\n+ }),\n+ }\n+ }\n+}\n+\n+/// High-level interface to a SHT_STRTAB string table.\n+#[derive(Debug)]\n+pub struct StrtabSection\u003c'a\u003e(SectionInfo\u003c'a\u003e);\n+\n+impl\u003c'a\u003e StrtabSection\u003c'a\u003e {\n+ pub fn entry(\u0026'a self, index: u32) -\u003e ParseResult\u003c\u0026'a str\u003e {\n+ let data = self.0.data;\n+ let index = index as usize;\n+\n+ if index \u003e= data.len() {\n+ Err(ParseError::StrtabIndexOutOfRange)\n+ } else {\n+ let len = data[index..]\n+ .iter()\n+ .position(|b| *b == 0x00)\n+ .ok_or(ParseError::StrtabIndexOutOfRange)?;\n+ let s = str::from_utf8(\u0026data[index..index + len])\n+ .map_err(|e| ParseError::StrtabInvalidData(e))?;\n+ Ok(s)\n+ }\n+ }\n+}\n+\n+/// High-level interface to a SHT_REL relocation table.\n+#[derive(Debug)]\n+pub struct RelSection\u003c'a\u003e(SectionInfo\u003c'a\u003e);\n+\n+impl\u003c'a\u003e RelSection\u003c'a\u003e {\n+ pub fn entries(\u0026'a self) -\u003e ParseResult\u003cRelSectionIterator\u003c'a\u003e\u003e {\n+ RelSectionIterator::new(\u0026self.0)\n+ }\n+}\n+\n+#[derive(Debug)]\n+pub struct Rel {\n+ pub type_: u32,\n+}\n+\n+pub struct RelSectionIterator\u003c'a\u003e(\n+ ClassAlternative\u003c\n+ SectionEntityIterator\u003c'a, bindings::elf32_rel\u003e,\n+ SectionEntityIterator\u003c'a, bindings::elf64_rel\u003e,\n+ \u003e,\n+);\n+\n+impl\u003c'a\u003e RelSectionIterator\u003c'a\u003e {\n+ fn new(section: \u0026'a SectionInfo\u003c'a\u003e) -\u003e ParseResult\u003cSelf\u003e {\n+ Ok(Self(match section.class {\n+ Class::Elf32 =\u003e ClassAlternative::Elf32(SectionEntityIterator::new(section)?),\n+ Class::Elf64 =\u003e ClassAlternative::Elf64(SectionEntityIterator::new(section)?),\n+ }))\n+ }\n+}\n+\n+impl\u003c'a\u003e Iterator for RelSectionIterator\u003c'a\u003e {\n+ type Item = Rel;\n+\n+ fn next(\u0026mut self) -\u003e Option\u003cSelf::Item\u003e {\n+ match \u0026mut self.0 {\n+ ClassAlternative::Elf32(iter) =\u003e iter.next().map(|n| {\n+ let type_ = n.r_info.to_cpu(iter.byteorder) \u0026 0xff;\n+ Self::Item { type_ }\n+ }),\n+ ClassAlternative::Elf64(iter) =\u003e iter.next().map(|n| {\n+ let type_ = n.r_info.to_cpu(iter.byteorder) as u32;\n+ Self::Item { type_ }\n+ }),\n+ }\n+ }\n+}\n+\n+/// High-level interface to a SHT_RELA relocation table.\n+#[derive(Debug)]\n+pub struct RelaSection\u003c'a\u003e(SectionInfo\u003c'a\u003e);\n+\n+impl\u003c'a\u003e RelaSection\u003c'a\u003e {\n+ pub fn entries(\u0026'a self) -\u003e ParseResult\u003cRelaSectionIterator\u003c'a\u003e\u003e {\n+ RelaSectionIterator::new(\u0026self.0)\n+ }\n+}\n+\n+#[derive(Debug)]\n+pub struct Rela {\n+ pub type_: u32,\n+}\n+\n+pub struct RelaSectionIterator\u003c'a\u003e(\n+ ClassAlternative\u003c\n+ SectionEntityIterator\u003c'a, bindings::elf32_rela\u003e,\n+ SectionEntityIterator\u003c'a, bindings::elf64_rela\u003e,\n+ \u003e,\n+);\n+\n+impl\u003c'a\u003e RelaSectionIterator\u003c'a\u003e {\n+ fn new(section: \u0026'a SectionInfo\u003c'a\u003e) -\u003e ParseResult\u003cSelf\u003e {\n+ Ok(Self(match section.class {\n+ Class::Elf32 =\u003e ClassAlternative::Elf32(SectionEntityIterator::new(section)?),\n+ Class::Elf64 =\u003e ClassAlternative::Elf64(SectionEntityIterator::new(section)?),\n+ }))\n+ }\n+}\n+\n+impl\u003c'a\u003e Iterator for RelaSectionIterator\u003c'a\u003e {\n+ type Item = Rela;\n+\n+ fn next(\u0026mut self) -\u003e Option\u003cSelf::Item\u003e {\n+ match \u0026mut self.0 {\n+ ClassAlternative::Elf32(iter) =\u003e iter.next().map(|n| {\n+ let type_ = n.r_info.to_cpu(iter.byteorder) \u0026 0xff;\n+ Self::Item { type_ }\n+ }),\n+ ClassAlternative::Elf64(iter) =\u003e iter.next().map(|n| {\n+ let type_ = n.r_info.to_cpu(iter.byteorder) as u32;\n+ Self::Item { type_ }\n+ }),\n+ }\n+ }\n+}\ndiff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs\nnew file mode 100644\nindex 0000000000000..0d3b47bf57e1f\n--- /dev/null\n+++ b/lib/vdso/check/vdsocheck.rs\n@@ -0,0 +1,299 @@\n+// SPDX-License-Identifier: GPL-2.0\n+\n+//! vDSO build-time validation\n+//!\n+//! Check that the vDSO library does not contain dynamic relocations.\n+\n+use std::default::Default;\n+use std::fmt;\n+use std::fs;\n+use std::option::Option;\n+use std::process;\n+\n+use ::bindings;\n+\n+mod elf;\n+\n+#[derive(Default)]\n+struct AllowedRelocations\u003c'a\u003e {\n+ ignored_object_file_sections: \u0026'a [\u0026'a str],\n+ in_object_file: \u0026'a [u32],\n+}\n+\n+impl\u003c'a\u003e AllowedRelocations\u003c'a\u003e {\n+ fn is_ignored_section(\u0026self, section: \u0026elf::Section\u003c'_\u003e) -\u003e bool {\n+ let name = section.info().name;\n+\n+ if name.starts_with(\".rel.debug_\") || name.starts_with(\".rela.debug_\") {\n+ true\n+ } else {\n+ self.ignored_object_file_sections.contains(\u0026name)\n+ }\n+ }\n+}\n+\n+fn allowed_relocations_for_machine(machine: u16) -\u003e Option\u003cAllowedRelocations\u003c'static\u003e\u003e {\n+ match machine as u32 {\n+ bindings::EM_386 =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_386_PC32,\n+ bindings::R_386_GOTOFF,\n+ bindings::R_386_GOTPC,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_X86_64 =\u003e AllowedRelocations {\n+ in_object_file: \u0026[bindings::R_X86_64_PC32, bindings::R_X86_64_PLT32],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_ARM =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_ARM_NONE,\n+ bindings::R_ARM_REL32,\n+ bindings::R_ARM_PREL31,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_AARCH64 =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_AARCH64_PREL64,\n+ bindings::R_AARCH64_PREL32,\n+ bindings::R_AARCH64_PREL16,\n+ bindings::R_AARCH64_LD_PREL_LO19,\n+ bindings::R_AARCH64_ADR_PREL_LO21,\n+ bindings::R_AARCH64_CALL26,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_PPC =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_PPC_REL24,\n+ bindings::R_PPC_REL14,\n+ bindings::R_PPC_REL32,\n+ bindings::R_PPC_REL16,\n+ bindings::R_PPC_REL16_LO,\n+ bindings::R_PPC_REL16_HI,\n+ bindings::R_PPC_REL16_HA,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_PPC64 =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_PPC64_REL24,\n+ bindings::R_PPC64_REL14,\n+ bindings::R_PPC64_REL32,\n+ bindings::R_PPC64_REL64,\n+ bindings::R_PPC64_REL16,\n+ bindings::R_PPC64_REL16_LO,\n+ bindings::R_PPC64_REL16_HI,\n+ bindings::R_PPC64_REL16_HA,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_RISCV =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_RISCV_BRANCH,\n+ bindings::R_RISCV_JAL,\n+ bindings::R_RISCV_CALL,\n+ bindings::R_RISCV_CALL_PLT,\n+ bindings::R_RISCV_PCREL_HI20,\n+ bindings::R_RISCV_PCREL_LO12_I,\n+ bindings::R_RISCV_PCREL_LO12_S,\n+ bindings::R_RISCV_ADD8,\n+ bindings::R_RISCV_ADD16,\n+ bindings::R_RISCV_ADD32,\n+ bindings::R_RISCV_ADD64,\n+ bindings::R_RISCV_SUB8,\n+ bindings::R_RISCV_SUB16,\n+ bindings::R_RISCV_SUB32,\n+ bindings::R_RISCV_SUB64,\n+ bindings::R_RISCV_ALIGN,\n+ bindings::R_RISCV_RVC_BRANCH,\n+ bindings::R_RISCV_RVC_JUMP,\n+ bindings::R_RISCV_RELAX,\n+ bindings::R_RISCV_32_PCREL,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_LOONGARCH =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_LARCH_ADD8,\n+ bindings::R_LARCH_ADD16,\n+ bindings::R_LARCH_ADD24,\n+ bindings::R_LARCH_ADD32,\n+ bindings::R_LARCH_ADD64,\n+ bindings::R_LARCH_SUB8,\n+ bindings::R_LARCH_SUB16,\n+ bindings::R_LARCH_SUB24,\n+ bindings::R_LARCH_SUB32,\n+ bindings::R_LARCH_SUB64,\n+ bindings::R_LARCH_B16,\n+ bindings::R_LARCH_B21,\n+ bindings::R_LARCH_B26,\n+ bindings::R_LARCH_PCALA_HI20,\n+ bindings::R_LARCH_PCALA_LO12,\n+ bindings::R_LARCH_PCALA64_LO20,\n+ bindings::R_LARCH_PCALA64_HI12,\n+ bindings::R_LARCH_32_PCREL,\n+ bindings::R_LARCH_PCADD_HI20,\n+ bindings::R_LARCH_PCADD_LO12,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_S390 =\u003e AllowedRelocations {\n+ in_object_file: \u0026[\n+ bindings::R_390_PC32,\n+ bindings::R_390_PC32DBL,\n+ bindings::R_390_PLT32DBL,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_MIPS =\u003e AllowedRelocations {\n+ ignored_object_file_sections: \u0026[\".rel.pdr\", \".rela.pdr\"],\n+ in_object_file: \u0026[\n+ bindings::R_MIPS_PC16,\n+ bindings::R_MIPS_PC21_S2,\n+ bindings::R_MIPS_PC26_S2,\n+ bindings::R_MIPS_PC18_S3,\n+ bindings::R_MIPS_PC19_S2,\n+ bindings::R_MIPS_PCHI16,\n+ bindings::R_MIPS_PCLO16,\n+ bindings::R_MIPS_PC32,\n+ ],\n+ ..Default::default()\n+ }\n+ .into(),\n+ bindings::EM_SPARC | bindings::EM_SPARC32PLUS | bindings::EM_SPARCV9 =\u003e {\n+ AllowedRelocations {\n+ in_object_file: \u0026[bindings::R_SPARC_DISP32],\n+ ..Default::default()\n+ }\n+ .into()\n+ }\n+ _ =\u003e None,\n+ }\n+}\n+\n+#[derive(Debug)]\n+enum ValidationError\u003c'a\u003e {\n+ ParseError(elf::ParseError),\n+ UnsupportedArchitecture(u16),\n+ UnrecognizedElfFileType(u32),\n+ UnexpectedSection(elf::Section\u003c'a\u003e),\n+ InvalidRelocation(elf::Section\u003c'a\u003e, u32),\n+}\n+\n+impl\u003c'a\u003e From\u003celf::ParseError\u003e for ValidationError\u003c'a\u003e {\n+ fn from(parse_error: elf::ParseError) -\u003e Self {\n+ Self::ParseError(parse_error)\n+ }\n+}\n+\n+impl fmt::Display for ValidationError\u003c'_\u003e {\n+ fn fmt(\u0026self, f: \u0026mut fmt::Formatter\u003c'_\u003e) -\u003e fmt::Result {\n+ match self {\n+ ValidationError::ParseError(e) =\u003e write!(f, \"Parsing error: {}\", e),\n+ ValidationError::UnsupportedArchitecture(n) =\u003e {\n+ write!(f, \"Unsupported ELF architecture {}\", n)\n+ }\n+ ValidationError::UnrecognizedElfFileType(t) =\u003e {\n+ write!(f, \"Unrecognized ELF file type {}\", t)\n+ }\n+ ValidationError::UnexpectedSection(ref s) =\u003e {\n+ write!(f, \"Unexpected section '{}'\", s.info().name)\n+ }\n+ ValidationError::InvalidRelocation(ref s, t) =\u003e {\n+ write!(f, \"Invalid relocation {} in section '{}'\", t, s.info().name)\n+ }\n+ }\n+ }\n+}\n+\n+type ValidationResult\u003c'a\u003e = Result\u003c(), ValidationError\u003c'a\u003e\u003e;\n+\n+fn validate_linked_dso\u003c'a\u003e(file: \u0026'a elf::File\u003c'a\u003e) -\u003e ValidationResult\u003c'a\u003e {\n+ for section in file.sections()? {\n+ let section = section?;\n+\n+ /* No relocations are allowed */\n+ match section {\n+ elf::Section::Rel(_) | elf::Section::Rela(_) =\u003e {\n+ return Err(ValidationError::UnexpectedSection(section))\n+ }\n+ _ =\u003e {}\n+ }\n+ }\n+\n+ Ok(())\n+}\n+\n+fn validate_object_file\u003c'a\u003e(file: \u0026'a elf::File\u003c'a\u003e) -\u003e ValidationResult\u003c'a\u003e {\n+ let allowed_relocs = allowed_relocations_for_machine(file.machine)\n+ .ok_or(ValidationError::UnsupportedArchitecture(file.machine))?;\n+\n+ for section in file.sections()? {\n+ let section = section?;\n+\n+ if allowed_relocs.is_ignored_section(\u0026section) {\n+ continue;\n+ }\n+\n+ match section {\n+ elf::Section::Rel(ref rel) =\u003e {\n+ for entry in rel.entries()? {\n+ if !allowed_relocs.in_object_file.contains(\u0026entry.type_) {\n+ return Err(ValidationError::InvalidRelocation(section, entry.type_));\n+ }\n+ }\n+ }\n+ elf::Section::Rela(ref rela) =\u003e {\n+ for entry in rela.entries()? {\n+ if !allowed_relocs.in_object_file.contains(\u0026entry.type_) {\n+ return Err(ValidationError::InvalidRelocation(section, entry.type_));\n+ }\n+ }\n+ }\n+ _ =\u003e {}\n+ };\n+ }\n+\n+ Ok(())\n+}\n+\n+fn main() {\n+ let mut args = std::env::args_os();\n+\n+ let program_name = args.next().unwrap_or(\"vdsocheck\".into());\n+\n+ for path in args {\n+ let data = fs::read(\u0026path).unwrap_or_else(|err| {\n+ println!(\"{}: {}: {}\", program_name.display(), path.display(), err);\n+ process::exit(1);\n+ });\n+\n+ let file = elf::File::new_from_bytes(\u0026data).unwrap_or_else(|err| {\n+ println!(\"{}: {}: {}\", program_name.display(), path.display(), err);\n+ process::exit(2);\n+ });\n+\n+ let result = match file.type_ as u32 {\n+ bindings::ET_DYN =\u003e validate_linked_dso(\u0026file),\n+ bindings::ET_REL =\u003e validate_object_file(\u0026file),\n+ t =\u003e Err(ValidationError::UnrecognizedElfFileType(t)),\n+ };\n+\n+ result.unwrap_or_else(|err| {\n+ println!(\"{}: {}: {}\", program_name.display(), path.display(), err);\n+ process::exit(3);\n+ });\n+ }\n+}\ndiff --git a/tools/include/uapi/linux/elf-em.h b/tools/include/uapi/linux/elf-em.h\nnew file mode 100644\nindex 0000000000000..ef38c2bc5ab7a\n--- /dev/null\n+++ b/tools/include/uapi/linux/elf-em.h\n@@ -0,0 +1,71 @@\n+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n+#ifndef _LINUX_ELF_EM_H\n+#define _LINUX_ELF_EM_H\n+\n+/* These constants define the various ELF target machines */\n+#define EM_NONE\t\t0\n+#define EM_M32\t\t1\n+#define EM_SPARC\t2\n+#define EM_386\t\t3\n+#define EM_68K\t\t4\n+#define EM_88K\t\t5\n+#define EM_486\t\t6\t/* Perhaps disused */\n+#define EM_860\t\t7\n+#define EM_MIPS\t\t8\t/* MIPS R3000 (officially, big-endian only) */\n+\t\t\t\t/* Next two are historical and binaries and\n+\t\t\t\t modules of these types will be rejected by\n+\t\t\t\t Linux. */\n+#define EM_MIPS_RS3_LE\t10\t/* MIPS R3000 little-endian */\n+#define EM_MIPS_RS4_BE\t10\t/* MIPS R4000 big-endian */\n+\n+#define EM_PARISC\t15\t/* HPPA */\n+#define EM_SPARC32PLUS\t18\t/* Sun's \"v8plus\" */\n+#define EM_PPC\t\t20\t/* PowerPC */\n+#define EM_PPC64\t21\t /* PowerPC64 */\n+#define EM_SPU\t\t23\t/* Cell BE SPU */\n+#define EM_ARM\t\t40\t/* ARM 32 bit */\n+#define EM_SH\t\t42\t/* SuperH */\n+#define EM_SPARCV9\t43\t/* SPARC v9 64-bit */\n+#define EM_H8_300\t46\t/* Renesas H8/300 */\n+#define EM_IA_64\t50\t/* HP/Intel IA-64 */\n+#define EM_X86_64\t62\t/* AMD x86-64 */\n+#define EM_S390\t\t22\t/* IBM S/390 */\n+#define EM_CRIS\t\t76\t/* Axis Communications 32-bit embedded processor */\n+#define EM_M32R\t\t88\t/* Renesas M32R */\n+#define EM_MN10300\t89\t/* Panasonic/MEI MN10300, AM33 */\n+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */\n+#define EM_ARCOMPACT\t93\t/* ARCompact processor */\n+#define EM_XTENSA\t94\t/* Tensilica Xtensa Architecture */\n+#define EM_BLACKFIN 106 /* ADI Blackfin Processor */\n+#define EM_UNICORE\t110\t/* UniCore-32 */\n+#define EM_ALTERA_NIOS2\t113\t/* Altera Nios II soft-core processor */\n+#define EM_TI_C6000\t140\t/* TI C6X DSPs */\n+#define EM_HEXAGON\t164\t/* QUALCOMM Hexagon */\n+#define EM_NDS32\t167\t/* Andes Technology compact code size\n+\t\t\t\t embedded RISC processor family */\n+#define EM_AARCH64\t183\t/* ARM 64 bit */\n+#define EM_TILEPRO\t188\t/* Tilera TILEPro */\n+#define EM_MICROBLAZE\t189\t/* Xilinx MicroBlaze */\n+#define EM_TILEGX\t191\t/* Tilera TILE-Gx */\n+#define EM_ARCV2\t195\t/* ARCv2 Cores */\n+#define EM_RISCV\t243\t/* RISC-V */\n+#define EM_BPF\t\t247\t/* Linux BPF - in-kernel virtual machine */\n+#define EM_CSKY\t\t252\t/* C-SKY */\n+#define EM_LOONGARCH\t258\t/* LoongArch */\n+#define EM_FRV\t\t0x5441\t/* Fujitsu FR-V */\n+\n+/*\n+ * This is an interim value that we will use until the committee comes\n+ * up with a final number.\n+ */\n+#define EM_ALPHA\t0x9026\n+\n+/* Bogus old m32r magic number, used by old tools. */\n+#define EM_CYGNUS_M32R\t0x9041\n+/* This is the old interim value for S/390 architecture */\n+#define EM_S390_OLD\t0xA390\n+/* Also Panasonic/MEI MN10300, AM33 */\n+#define EM_CYGNUS_MN10300 0xbeef\n+\n+\n+#endif /* _LINUX_ELF_EM_H */\ndiff --git a/tools/include/uapi/linux/elf-r.h b/tools/include/uapi/linux/elf-r.h\nnew file mode 100644\nindex 0000000000000..a6a4d7643c5d7\n--- /dev/null\n+++ b/tools/include/uapi/linux/elf-r.h\n@@ -0,0 +1,705 @@\n+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n+#ifndef _UAPI_LINUX_ELF_R_H\n+#define _UAPI_LINUX_ELF_R_H\n+\n+/* i386 relocation types */\n+#define R_386_NONE\t0\n+#define R_386_32\t1\n+#define R_386_PC32\t2\n+#define R_386_GOT32\t3\n+#define R_386_PLT32\t4\n+#define R_386_COPY\t5\n+#define R_386_GLOB_DAT\t6\n+#define R_386_JMP_SLOT\t7\n+#define R_386_RELATIVE\t8\n+#define R_386_GOTOFF\t9\n+#define R_386_GOTPC\t10\n+#define R_386_NUM\t11\n+\n+/* x86-64 relocation types */\n+#define R_X86_64_NONE\t\t0\t/* No reloc */\n+#define R_X86_64_64\t\t1\t/* Direct 64 bit */\n+#define R_X86_64_PC32\t\t2\t/* PC relative 32 bit signed */\n+#define R_X86_64_GOT32\t\t3\t/* 32 bit GOT entry */\n+#define R_X86_64_PLT32\t\t4\t/* 32 bit PLT address */\n+#define R_X86_64_COPY\t\t5\t/* Copy symbol at runtime */\n+#define R_X86_64_GLOB_DAT\t6\t/* Create GOT entry */\n+#define R_X86_64_JUMP_SLOT\t7\t/* Create PLT entry */\n+#define R_X86_64_RELATIVE\t8\t/* Adjust by program base */\n+#define R_X86_64_GOTPCREL\t9\t/* 32 bit signed pc relative\n+\t\t\t\t\t offset to GOT */\n+#define R_X86_64_32\t\t10\t/* Direct 32 bit zero extended */\n+#define R_X86_64_32S\t\t11\t/* Direct 32 bit sign extended */\n+#define R_X86_64_16\t\t12\t/* Direct 16 bit zero extended */\n+#define R_X86_64_PC16\t\t13\t/* 16 bit sign extended pc relative */\n+#define R_X86_64_8\t\t14\t/* Direct 8 bit sign extended */\n+#define R_X86_64_PC8\t\t15\t/* 8 bit sign extended pc relative */\n+#define R_X86_64_PC64\t\t24\t/* Place relative 64-bit signed */\n+\n+/* arm relocation types */\n+#define R_ARM_NONE\t\t0\n+#define R_ARM_PC24\t\t1\n+#define R_ARM_ABS32\t\t2\n+#define R_ARM_REL32\t\t3\n+#define R_ARM_CALL\t\t28\n+#define R_ARM_JUMP24\t\t29\n+#define R_ARM_TARGET1\t\t38\n+#define R_ARM_V4BX\t\t40\n+#define R_ARM_PREL31\t\t42\n+#define R_ARM_MOVW_ABS_NC\t43\n+#define R_ARM_MOVT_ABS\t\t44\n+#define R_ARM_MOVW_PREL_NC\t45\n+#define R_ARM_MOVT_PREL\t\t46\n+#define R_ARM_ALU_PC_G0_NC\t57\n+#define R_ARM_ALU_PC_G1_NC\t59\n+#define R_ARM_LDR_PC_G2\t\t63\n+\n+#define R_ARM_THM_CALL\t\t10\n+#define R_ARM_THM_JUMP24\t30\n+#define R_ARM_THM_MOVW_ABS_NC\t47\n+#define R_ARM_THM_MOVT_ABS\t48\n+#define R_ARM_THM_MOVW_PREL_NC\t49\n+#define R_ARM_THM_MOVT_PREL\t50\n+\n+/* AArch64 static relocation types */\n+\n+/* Miscellaneous. */\n+#define R_AARCH64_NONE\t\t\t256\n+\n+/* Data. */\n+#define R_AARCH64_ABS64\t\t\t257\n+#define R_AARCH64_ABS32\t\t\t258\n+#define R_AARCH64_ABS16\t\t\t259\n+#define R_AARCH64_PREL64\t\t260\n+#define R_AARCH64_PREL32\t\t261\n+#define R_AARCH64_PREL16\t\t262\n+\n+/* Instructions. */\n+#define R_AARCH64_MOVW_UABS_G0\t\t263\n+#define R_AARCH64_MOVW_UABS_G0_NC\t264\n+#define R_AARCH64_MOVW_UABS_G1\t\t265\n+#define R_AARCH64_MOVW_UABS_G1_NC\t266\n+#define R_AARCH64_MOVW_UABS_G2\t\t267\n+#define R_AARCH64_MOVW_UABS_G2_NC\t268\n+#define R_AARCH64_MOVW_UABS_G3\t\t269\n+\n+#define R_AARCH64_MOVW_SABS_G0\t\t270\n+#define R_AARCH64_MOVW_SABS_G1\t\t271\n+#define R_AARCH64_MOVW_SABS_G2\t\t272\n+\n+#define R_AARCH64_LD_PREL_LO19\t\t273\n+#define R_AARCH64_ADR_PREL_LO21\t\t274\n+#define R_AARCH64_ADR_PREL_PG_HI21\t275\n+#define R_AARCH64_ADR_PREL_PG_HI21_NC\t276\n+#define R_AARCH64_ADD_ABS_LO12_NC\t277\n+#define R_AARCH64_LDST8_ABS_LO12_NC\t278\n+\n+#define R_AARCH64_TSTBR14\t\t279\n+#define R_AARCH64_CONDBR19\t\t280\n+#define R_AARCH64_JUMP26\t\t282\n+#define R_AARCH64_CALL26\t\t283\n+#define R_AARCH64_LDST16_ABS_LO12_NC\t284\n+#define R_AARCH64_LDST32_ABS_LO12_NC\t285\n+#define R_AARCH64_LDST64_ABS_LO12_NC\t286\n+#define R_AARCH64_LDST128_ABS_LO12_NC\t299\n+\n+#define R_AARCH64_MOVW_PREL_G0\t\t287\n+#define R_AARCH64_MOVW_PREL_G0_NC\t288\n+#define R_AARCH64_MOVW_PREL_G1\t\t289\n+#define R_AARCH64_MOVW_PREL_G1_NC\t290\n+#define R_AARCH64_MOVW_PREL_G2\t\t291\n+#define R_AARCH64_MOVW_PREL_G2_NC\t292\n+#define R_AARCH64_MOVW_PREL_G3\t\t293\n+\n+#define R_AARCH64_RELATIVE\t\t1027\n+\n+/* PowerPC relocations defined by the ABIs */\n+#define R_PPC_NONE\t\t0\n+#define R_PPC_ADDR32\t\t1\t/* 32bit absolute address */\n+#define R_PPC_ADDR24\t\t2\t/* 26bit address, 2 bits ignored. */\n+#define R_PPC_ADDR16\t\t3\t/* 16bit absolute address */\n+#define R_PPC_ADDR16_LO\t\t4\t/* lower 16bit of absolute address */\n+#define R_PPC_ADDR16_HI\t\t5\t/* high 16bit of absolute address */\n+#define R_PPC_ADDR16_HA\t\t6\t/* adjusted high 16bit */\n+#define R_PPC_ADDR14\t\t7\t/* 16bit address, 2 bits ignored */\n+#define R_PPC_ADDR14_BRTAKEN\t8\n+#define R_PPC_ADDR14_BRNTAKEN\t9\n+#define R_PPC_REL24\t\t10\t/* PC relative 26 bit */\n+#define R_PPC_REL14\t\t11\t/* PC relative 16 bit */\n+#define R_PPC_REL14_BRTAKEN\t12\n+#define R_PPC_REL14_BRNTAKEN\t13\n+#define R_PPC_GOT16\t\t14\n+#define R_PPC_GOT16_LO\t\t15\n+#define R_PPC_GOT16_HI\t\t16\n+#define R_PPC_GOT16_HA\t\t17\n+#define R_PPC_PLTREL24\t\t18\n+#define R_PPC_COPY\t\t19\n+#define R_PPC_GLOB_DAT\t\t20\n+#define R_PPC_JMP_SLOT\t\t21\n+#define R_PPC_RELATIVE\t\t22\n+#define R_PPC_LOCAL24PC\t\t23\n+#define R_PPC_UADDR32\t\t24\n+#define R_PPC_UADDR16\t\t25\n+#define R_PPC_REL32\t\t26\n+#define R_PPC_PLT32\t\t27\n+#define R_PPC_PLTREL32\t\t28\n+#define R_PPC_PLT16_LO\t\t29\n+#define R_PPC_PLT16_HI\t\t30\n+#define R_PPC_PLT16_HA\t\t31\n+#define R_PPC_SDAREL16\t\t32\n+#define R_PPC_SECTOFF\t\t33\n+#define R_PPC_SECTOFF_LO\t34\n+#define R_PPC_SECTOFF_HI\t35\n+#define R_PPC_SECTOFF_HA\t36\n+\n+/* PowerPC relocations defined for the TLS access ABI. */\n+#define R_PPC_TLS\t\t67 /* none\t(sym+add)@tls */\n+#define R_PPC_DTPMOD32\t\t68 /* word32\t(sym+add)@dtpmod */\n+#define R_PPC_TPREL16\t\t69 /* half16*\t(sym+add)@tprel */\n+#define R_PPC_TPREL16_LO\t70 /* half16\t(sym+add)@tprel@l */\n+#define R_PPC_TPREL16_HI\t71 /* half16\t(sym+add)@tprel@h */\n+#define R_PPC_TPREL16_HA\t72 /* half16\t(sym+add)@tprel@ha */\n+#define R_PPC_TPREL32\t\t73 /* word32\t(sym+add)@tprel */\n+#define R_PPC_DTPREL16\t\t74 /* half16*\t(sym+add)@dtprel */\n+#define R_PPC_DTPREL16_LO\t75 /* half16\t(sym+add)@dtprel@l */\n+#define R_PPC_DTPREL16_HI\t76 /* half16\t(sym+add)@dtprel@h */\n+#define R_PPC_DTPREL16_HA\t77 /* half16\t(sym+add)@dtprel@ha */\n+#define R_PPC_DTPREL32\t\t78 /* word32\t(sym+add)@dtprel */\n+#define R_PPC_GOT_TLSGD16\t79 /* half16*\t(sym+add)@got@tlsgd */\n+#define R_PPC_GOT_TLSGD16_LO\t80 /* half16\t(sym+add)@got@tlsgd@l */\n+#define R_PPC_GOT_TLSGD16_HI\t81 /* half16\t(sym+add)@got@tlsgd@h */\n+#define R_PPC_GOT_TLSGD16_HA\t82 /* half16\t(sym+add)@got@tlsgd@ha */\n+#define R_PPC_GOT_TLSLD16\t83 /* half16*\t(sym+add)@got@tlsld */\n+#define R_PPC_GOT_TLSLD16_LO\t84 /* half16\t(sym+add)@got@tlsld@l */\n+#define R_PPC_GOT_TLSLD16_HI\t85 /* half16\t(sym+add)@got@tlsld@h */\n+#define R_PPC_GOT_TLSLD16_HA\t86 /* half16\t(sym+add)@got@tlsld@ha */\n+#define R_PPC_GOT_TPREL16\t87 /* half16*\t(sym+add)@got@tprel */\n+#define R_PPC_GOT_TPREL16_LO\t88 /* half16\t(sym+add)@got@tprel@l */\n+#define R_PPC_GOT_TPREL16_HI\t89 /* half16\t(sym+add)@got@tprel@h */\n+#define R_PPC_GOT_TPREL16_HA\t90 /* half16\t(sym+add)@got@tprel@ha */\n+#define R_PPC_GOT_DTPREL16\t91 /* half16*\t(sym+add)@got@dtprel */\n+#define R_PPC_GOT_DTPREL16_LO\t92 /* half16*\t(sym+add)@got@dtprel@l */\n+#define R_PPC_GOT_DTPREL16_HI\t93 /* half16*\t(sym+add)@got@dtprel@h */\n+#define R_PPC_GOT_DTPREL16_HA\t94 /* half16*\t(sym+add)@got@dtprel@ha */\n+\n+#define R_PPC_REL16\t\t249\n+#define R_PPC_REL16_LO\t\t250\n+#define R_PPC_REL16_HI\t\t251\n+#define R_PPC_REL16_HA\t\t252\n+\n+/* keep this the last entry. */\n+#define R_PPC_NUM\t\t253\n+\n+/* PowerPC64 relocations defined by the ABIs */\n+#define R_PPC64_NONE R_PPC_NONE\n+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */\n+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */\n+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */\n+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */\n+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */\n+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */\n+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */\n+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN\n+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN\n+#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */\n+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */\n+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN\n+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN\n+#define R_PPC64_GOT16 R_PPC_GOT16\n+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO\n+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI\n+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA\n+\n+#define R_PPC64_COPY R_PPC_COPY\n+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT\n+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT\n+#define R_PPC64_RELATIVE R_PPC_RELATIVE\n+\n+#define R_PPC64_UADDR32 R_PPC_UADDR32\n+#define R_PPC64_UADDR16 R_PPC_UADDR16\n+#define R_PPC64_REL32 R_PPC_REL32\n+#define R_PPC64_PLT32 R_PPC_PLT32\n+#define R_PPC64_PLTREL32 R_PPC_PLTREL32\n+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO\n+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI\n+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA\n+\n+#define R_PPC64_SECTOFF R_PPC_SECTOFF\n+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO\n+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI\n+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA\n+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) \u003e\u003e 2. */\n+#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */\n+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */\n+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */\n+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */\n+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */\n+#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */\n+#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */\n+#define R_PPC64_PLT64 45 /* doubleword64 L + A. */\n+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */\n+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */\n+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */\n+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */\n+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */\n+#define R_PPC64_TOC 51 /* doubleword64 .TOC. */\n+#define R_PPC64_PLTGOT16 52 /* half16* M + A. */\n+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */\n+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */\n+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */\n+\n+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) \u003e\u003e 2. */\n+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) \u003e\u003e 2. */\n+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) \u003e\u003e 2. */\n+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) \u003e\u003e 2. */\n+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) \u003e\u003e 2. */\n+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) \u003e\u003e 2. */\n+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) \u003e\u003e 2. */\n+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) \u003e\u003e 2. */\n+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) \u003e\u003e 2. */\n+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) \u003e\u003e 2. */\n+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) \u003e\u003e 2. */\n+\n+/* PowerPC64 relocations defined for the TLS access ABI. */\n+#define R_PPC64_TLS\t\t67 /* none\t(sym+add)@tls */\n+#define R_PPC64_DTPMOD64\t68 /* doubleword64 (sym+add)@dtpmod */\n+#define R_PPC64_TPREL16\t\t69 /* half16*\t(sym+add)@tprel */\n+#define R_PPC64_TPREL16_LO\t70 /* half16\t(sym+add)@tprel@l */\n+#define R_PPC64_TPREL16_HI\t71 /* half16\t(sym+add)@tprel@h */\n+#define R_PPC64_TPREL16_HA\t72 /* half16\t(sym+add)@tprel@ha */\n+#define R_PPC64_TPREL64\t\t73 /* doubleword64 (sym+add)@tprel */\n+#define R_PPC64_DTPREL16\t74 /* half16*\t(sym+add)@dtprel */\n+#define R_PPC64_DTPREL16_LO\t75 /* half16\t(sym+add)@dtprel@l */\n+#define R_PPC64_DTPREL16_HI\t76 /* half16\t(sym+add)@dtprel@h */\n+#define R_PPC64_DTPREL16_HA\t77 /* half16\t(sym+add)@dtprel@ha */\n+#define R_PPC64_DTPREL64\t78 /* doubleword64 (sym+add)@dtprel */\n+#define R_PPC64_GOT_TLSGD16\t79 /* half16*\t(sym+add)@got@tlsgd */\n+#define R_PPC64_GOT_TLSGD16_LO\t80 /* half16\t(sym+add)@got@tlsgd@l */\n+#define R_PPC64_GOT_TLSGD16_HI\t81 /* half16\t(sym+add)@got@tlsgd@h */\n+#define R_PPC64_GOT_TLSGD16_HA\t82 /* half16\t(sym+add)@got@tlsgd@ha */\n+#define R_PPC64_GOT_TLSLD16\t83 /* half16*\t(sym+add)@got@tlsld */\n+#define R_PPC64_GOT_TLSLD16_LO\t84 /* half16\t(sym+add)@got@tlsld@l */\n+#define R_PPC64_GOT_TLSLD16_HI\t85 /* half16\t(sym+add)@got@tlsld@h */\n+#define R_PPC64_GOT_TLSLD16_HA\t86 /* half16\t(sym+add)@got@tlsld@ha */\n+#define R_PPC64_GOT_TPREL16_DS\t87 /* half16ds*\t(sym+add)@got@tprel */\n+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */\n+#define R_PPC64_GOT_TPREL16_HI\t89 /* half16\t(sym+add)@got@tprel@h */\n+#define R_PPC64_GOT_TPREL16_HA\t90 /* half16\t(sym+add)@got@tprel@ha */\n+#define R_PPC64_GOT_DTPREL16_DS\t91 /* half16ds*\t(sym+add)@got@dtprel */\n+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */\n+#define R_PPC64_GOT_DTPREL16_HI\t93 /* half16\t(sym+add)@got@dtprel@h */\n+#define R_PPC64_GOT_DTPREL16_HA\t94 /* half16\t(sym+add)@got@dtprel@ha */\n+#define R_PPC64_TPREL16_DS\t95 /* half16ds*\t(sym+add)@tprel */\n+#define R_PPC64_TPREL16_LO_DS\t96 /* half16ds\t(sym+add)@tprel@l */\n+#define R_PPC64_TPREL16_HIGHER\t97 /* half16\t(sym+add)@tprel@higher */\n+#define R_PPC64_TPREL16_HIGHERA\t98 /* half16\t(sym+add)@tprel@highera */\n+#define R_PPC64_TPREL16_HIGHEST\t99 /* half16\t(sym+add)@tprel@highest */\n+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16\t(sym+add)@tprel@highesta */\n+#define R_PPC64_DTPREL16_DS\t101 /* half16ds* (sym+add)@dtprel */\n+#define R_PPC64_DTPREL16_LO_DS\t102 /* half16ds\t(sym+add)@dtprel@l */\n+#define R_PPC64_DTPREL16_HIGHER\t103 /* half16\t(sym+add)@dtprel@higher */\n+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16\t(sym+add)@dtprel@highera */\n+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16\t(sym+add)@dtprel@highest */\n+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16\t(sym+add)@dtprel@highesta */\n+#define R_PPC64_TLSGD\t\t107\n+#define R_PPC64_TLSLD\t\t108\n+#define R_PPC64_TOCSAVE\t\t109\n+\n+#define R_PPC64_REL24_NOTOC\t116\n+#define R_PPC64_ENTRY\t\t118\n+\n+#define R_PPC64_PCREL34\t\t132\n+#define R_PPC64_GOT_PCREL34\t133\n+\n+#define R_PPC64_REL16\t\t249\n+#define R_PPC64_REL16_LO\t250\n+#define R_PPC64_REL16_HI\t251\n+#define R_PPC64_REL16_HA\t252\n+\n+/* Keep this the last entry. */\n+#define R_PPC64_NUM\t\t253\n+\n+\n+/*\n+ * RISC-V relocation types\n+ */\n+\n+/* Relocation types used by the dynamic linker */\n+#define R_RISCV_NONE\t\t0\n+#define R_RISCV_32\t\t1\n+#define R_RISCV_64\t\t2\n+#define R_RISCV_RELATIVE\t3\n+#define R_RISCV_COPY\t\t4\n+#define R_RISCV_JUMP_SLOT\t5\n+#define R_RISCV_TLS_DTPMOD32\t6\n+#define R_RISCV_TLS_DTPMOD64\t7\n+#define R_RISCV_TLS_DTPREL32\t8\n+#define R_RISCV_TLS_DTPREL64\t9\n+#define R_RISCV_TLS_TPREL32\t10\n+#define R_RISCV_TLS_TPREL64\t11\n+#define R_RISCV_IRELATIVE\t58\n+\n+/* Relocation types not used by the dynamic linker */\n+#define R_RISCV_BRANCH\t\t16\n+#define R_RISCV_JAL\t\t17\n+#define R_RISCV_CALL\t\t18\n+#define R_RISCV_CALL_PLT\t19\n+#define R_RISCV_GOT_HI20\t20\n+#define R_RISCV_TLS_GOT_HI20\t21\n+#define R_RISCV_TLS_GD_HI20\t22\n+#define R_RISCV_PCREL_HI20\t23\n+#define R_RISCV_PCREL_LO12_I\t24\n+#define R_RISCV_PCREL_LO12_S\t25\n+#define R_RISCV_HI20\t\t26\n+#define R_RISCV_LO12_I\t\t27\n+#define R_RISCV_LO12_S\t\t28\n+#define R_RISCV_TPREL_HI20\t29\n+#define R_RISCV_TPREL_LO12_I\t30\n+#define R_RISCV_TPREL_LO12_S\t31\n+#define R_RISCV_TPREL_ADD\t32\n+#define R_RISCV_ADD8\t\t33\n+#define R_RISCV_ADD16\t\t34\n+#define R_RISCV_ADD32\t\t35\n+#define R_RISCV_ADD64\t\t36\n+#define R_RISCV_SUB8\t\t37\n+#define R_RISCV_SUB16\t\t38\n+#define R_RISCV_SUB32\t\t39\n+#define R_RISCV_SUB64\t\t40\n+#define R_RISCV_GNU_VTINHERIT\t41\n+#define R_RISCV_GNU_VTENTRY\t42\n+#define R_RISCV_ALIGN\t\t43\n+#define R_RISCV_RVC_BRANCH\t44\n+#define R_RISCV_RVC_JUMP\t45\n+#define R_RISCV_GPREL_I\t\t47\n+#define R_RISCV_GPREL_S\t\t48\n+#define R_RISCV_TPREL_I\t\t49\n+#define R_RISCV_TPREL_S\t\t50\n+#define R_RISCV_RELAX\t\t51\n+#define R_RISCV_SUB6\t\t52\n+#define R_RISCV_SET6\t\t53\n+#define R_RISCV_SET8\t\t54\n+#define R_RISCV_SET16\t\t55\n+#define R_RISCV_SET32\t\t56\n+#define R_RISCV_32_PCREL\t57\n+#define R_RISCV_PLT32\t\t59\n+#define R_RISCV_SET_ULEB128\t60\n+#define R_RISCV_SUB_ULEB128\t61\n+\n+/* LoongArch relocation types used by the dynamic linker */\n+#define R_LARCH_NONE\t\t\t\t0\n+#define R_LARCH_32\t\t\t\t1\n+#define R_LARCH_64\t\t\t\t2\n+#define R_LARCH_RELATIVE\t\t\t3\n+#define R_LARCH_COPY\t\t\t\t4\n+#define R_LARCH_JUMP_SLOT\t\t\t5\n+#define R_LARCH_TLS_DTPMOD32\t\t\t6\n+#define R_LARCH_TLS_DTPMOD64\t\t\t7\n+#define R_LARCH_TLS_DTPREL32\t\t\t8\n+#define R_LARCH_TLS_DTPREL64\t\t\t9\n+#define R_LARCH_TLS_TPREL32\t\t\t10\n+#define R_LARCH_TLS_TPREL64\t\t\t11\n+#define R_LARCH_IRELATIVE\t\t\t12\n+#define R_LARCH_MARK_LA\t\t\t\t20\n+#define R_LARCH_MARK_PCREL\t\t\t21\n+#define R_LARCH_SOP_PUSH_PCREL\t\t\t22\n+#define R_LARCH_SOP_PUSH_ABSOLUTE\t\t23\n+#define R_LARCH_SOP_PUSH_DUP\t\t\t24\n+#define R_LARCH_SOP_PUSH_GPREL\t\t\t25\n+#define R_LARCH_SOP_PUSH_TLS_TPREL\t\t26\n+#define R_LARCH_SOP_PUSH_TLS_GOT\t\t27\n+#define R_LARCH_SOP_PUSH_TLS_GD\t\t\t28\n+#define R_LARCH_SOP_PUSH_PLT_PCREL\t\t29\n+#define R_LARCH_SOP_ASSERT\t\t\t30\n+#define R_LARCH_SOP_NOT\t\t\t\t31\n+#define R_LARCH_SOP_SUB\t\t\t\t32\n+#define R_LARCH_SOP_SL\t\t\t\t33\n+#define R_LARCH_SOP_SR\t\t\t\t34\n+#define R_LARCH_SOP_ADD\t\t\t\t35\n+#define R_LARCH_SOP_AND\t\t\t\t36\n+#define R_LARCH_SOP_IF_ELSE\t\t\t37\n+#define R_LARCH_SOP_POP_32_S_10_5\t\t38\n+#define R_LARCH_SOP_POP_32_U_10_12\t\t39\n+#define R_LARCH_SOP_POP_32_S_10_12\t\t40\n+#define R_LARCH_SOP_POP_32_S_10_16\t\t41\n+#define R_LARCH_SOP_POP_32_S_10_16_S2\t\t42\n+#define R_LARCH_SOP_POP_32_S_5_20\t\t43\n+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2\t44\n+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2\t45\n+#define R_LARCH_SOP_POP_32_U\t\t\t46\n+#define R_LARCH_ADD8\t\t\t\t47\n+#define R_LARCH_ADD16\t\t\t\t48\n+#define R_LARCH_ADD24\t\t\t\t49\n+#define R_LARCH_ADD32\t\t\t\t50\n+#define R_LARCH_ADD64\t\t\t\t51\n+#define R_LARCH_SUB8\t\t\t\t52\n+#define R_LARCH_SUB16\t\t\t\t53\n+#define R_LARCH_SUB24\t\t\t\t54\n+#define R_LARCH_SUB32\t\t\t\t55\n+#define R_LARCH_SUB64\t\t\t\t56\n+#define R_LARCH_GNU_VTINHERIT\t\t\t57\n+#define R_LARCH_GNU_VTENTRY\t\t\t58\n+#define R_LARCH_B16\t\t\t\t64\n+#define R_LARCH_B21\t\t\t\t65\n+#define R_LARCH_B26\t\t\t\t66\n+#define R_LARCH_ABS_HI20\t\t\t67\n+#define R_LARCH_ABS_LO12\t\t\t68\n+#define R_LARCH_ABS64_LO20\t\t\t69\n+#define R_LARCH_ABS64_HI12\t\t\t70\n+#define R_LARCH_PCALA_HI20\t\t\t71\n+#define R_LARCH_PCALA_LO12\t\t\t72\n+#define R_LARCH_PCALA64_LO20\t\t\t73\n+#define R_LARCH_PCALA64_HI12\t\t\t74\n+#define R_LARCH_GOT_PC_HI20\t\t\t75\n+#define R_LARCH_GOT_PC_LO12\t\t\t76\n+#define R_LARCH_GOT64_PC_LO20\t\t\t77\n+#define R_LARCH_GOT64_PC_HI12\t\t\t78\n+#define R_LARCH_GOT_HI20\t\t\t79\n+#define R_LARCH_GOT_LO12\t\t\t80\n+#define R_LARCH_GOT64_LO20\t\t\t81\n+#define R_LARCH_GOT64_HI12\t\t\t82\n+#define R_LARCH_TLS_LE_HI20\t\t\t83\n+#define R_LARCH_TLS_LE_LO12\t\t\t84\n+#define R_LARCH_TLS_LE64_LO20\t\t\t85\n+#define R_LARCH_TLS_LE64_HI12\t\t\t86\n+#define R_LARCH_TLS_IE_PC_HI20\t\t\t87\n+#define R_LARCH_TLS_IE_PC_LO12\t\t\t88\n+#define R_LARCH_TLS_IE64_PC_LO20\t\t89\n+#define R_LARCH_TLS_IE64_PC_HI12\t\t90\n+#define R_LARCH_TLS_IE_HI20\t\t\t91\n+#define R_LARCH_TLS_IE_LO12\t\t\t92\n+#define R_LARCH_TLS_IE64_LO20\t\t\t93\n+#define R_LARCH_TLS_IE64_HI12\t\t\t94\n+#define R_LARCH_TLS_LD_PC_HI20\t\t\t95\n+#define R_LARCH_TLS_LD_HI20\t\t\t96\n+#define R_LARCH_TLS_GD_PC_HI20\t\t\t97\n+#define R_LARCH_TLS_GD_HI20\t\t\t98\n+#define R_LARCH_32_PCREL\t\t\t99\n+#define R_LARCH_RELAX\t\t\t\t100\n+#define R_LARCH_DELETE\t\t\t\t101\n+#define R_LARCH_ALIGN\t\t\t\t102\n+#define R_LARCH_PCREL20_S2\t\t\t103\n+#define R_LARCH_CFA\t\t\t\t104\n+#define R_LARCH_ADD6\t\t\t\t105\n+#define R_LARCH_SUB6\t\t\t\t106\n+#define R_LARCH_ADD_ULEB128\t\t\t107\n+#define R_LARCH_SUB_ULEB128\t\t\t108\n+#define R_LARCH_64_PCREL\t\t\t109\n+#define R_LARCH_CALL36\t\t\t\t110\n+#define R_LARCH_TLS_DESC_PC_HI20\t\t111\n+#define R_LARCH_TLS_DESC_PC_LO12\t\t112\n+#define R_LARCH_TLS_DESC64_PC_LO20\t\t113\n+#define R_LARCH_TLS_DESC64_PC_HI12\t\t114\n+#define R_LARCH_TLS_DESC_HI20\t\t\t115\n+#define R_LARCH_TLS_DESC_LO12\t\t\t116\n+#define R_LARCH_TLS_DESC64_LO20\t\t\t117\n+#define R_LARCH_TLS_DESC64_HI12\t\t\t118\n+#define R_LARCH_TLS_DESC_LD\t\t\t119\n+#define R_LARCH_TLS_DESC_CALL\t\t\t120\n+#define R_LARCH_TLS_LE_HI20_R\t\t\t121\n+#define R_LARCH_TLS_LE_ADD_R\t\t\t122\n+#define R_LARCH_TLS_LE_LO12_R\t\t\t123\n+#define R_LARCH_TLS_LD_PCREL20_S2\t\t124\n+#define R_LARCH_TLS_GD_PCREL20_S2\t\t125\n+#define R_LARCH_TLS_DESC_PCREL20_S2\t\t126\n+#define R_LARCH_CALL30\t\t\t\t127\n+#define R_LARCH_PCADD_HI20\t\t\t128\n+#define R_LARCH_PCADD_LO12\t\t\t129\n+#define R_LARCH_GOT_PCADD_HI20\t\t\t130\n+#define R_LARCH_GOT_PCADD_LO12\t\t\t131\n+#define R_LARCH_TLS_IE_PCADD_HI20\t\t132\n+#define R_LARCH_TLS_IE_PCADD_LO12\t\t133\n+#define R_LARCH_TLS_LD_PCADD_HI20\t\t134\n+#define R_LARCH_TLS_LD_PCADD_LO12\t\t135\n+#define R_LARCH_TLS_GD_PCADD_HI20\t\t136\n+#define R_LARCH_TLS_GD_PCADD_LO12\t\t137\n+#define R_LARCH_TLS_DESC_PCADD_HI20\t\t138\n+#define R_LARCH_TLS_DESC_PCADD_LO12\t\t139\n+\n+/* s390 relocations defined by the ABIs */\n+#define R_390_NONE\t\t0\t/* No reloc. */\n+#define R_390_8\t\t\t1\t/* Direct 8 bit. */\n+#define R_390_12\t\t2\t/* Direct 12 bit. */\n+#define R_390_16\t\t3\t/* Direct 16 bit. */\n+#define R_390_32\t\t4\t/* Direct 32 bit. */\n+#define R_390_PC32\t\t5\t/* PC relative 32 bit.\t*/\n+#define R_390_GOT12\t\t6\t/* 12 bit GOT offset. */\n+#define R_390_GOT32\t\t7\t/* 32 bit GOT offset. */\n+#define R_390_PLT32\t\t8\t/* 32 bit PC relative PLT address. */\n+#define R_390_COPY\t\t9\t/* Copy symbol at runtime. */\n+#define R_390_GLOB_DAT\t\t10\t/* Create GOT entry. */\n+#define R_390_JMP_SLOT\t\t11\t/* Create PLT entry. */\n+#define R_390_RELATIVE\t\t12\t/* Adjust by program base. */\n+#define R_390_GOTOFF32\t\t13\t/* 32 bit offset to GOT.\t */\n+#define R_390_GOTPC\t\t14\t/* 32 bit PC rel. offset to GOT. */\n+#define R_390_GOT16\t\t15\t/* 16 bit GOT offset. */\n+#define R_390_PC16\t\t16\t/* PC relative 16 bit.\t*/\n+#define R_390_PC16DBL\t\t17\t/* PC relative 16 bit shifted by 1. */\n+#define R_390_PLT16DBL\t\t18\t/* 16 bit PC rel. PLT shifted by 1. */\n+#define R_390_PC32DBL\t\t19\t/* PC relative 32 bit shifted by 1. */\n+#define R_390_PLT32DBL\t\t20\t/* 32 bit PC rel. PLT shifted by 1. */\n+#define R_390_GOTPCDBL\t\t21\t/* 32 bit PC rel. GOT shifted by 1. */\n+#define R_390_64\t\t22\t/* Direct 64 bit. */\n+#define R_390_PC64\t\t23\t/* PC relative 64 bit.\t*/\n+#define R_390_GOT64\t\t24\t/* 64 bit GOT offset. */\n+#define R_390_PLT64\t\t25\t/* 64 bit PC relative PLT address. */\n+#define R_390_GOTENT\t\t26\t/* 32 bit PC rel. to GOT entry \u003e\u003e 1. */\n+#define R_390_GOTOFF16\t\t27\t/* 16 bit offset to GOT. */\n+#define R_390_GOTOFF64\t\t28\t/* 64 bit offset to GOT. */\n+#define R_390_GOTPLT12\t\t29\t/* 12 bit offset to jump slot.\t*/\n+#define R_390_GOTPLT16\t\t30\t/* 16 bit offset to jump slot.\t*/\n+#define R_390_GOTPLT32\t\t31\t/* 32 bit offset to jump slot.\t*/\n+#define R_390_GOTPLT64\t\t32\t/* 64 bit offset to jump slot.\t*/\n+#define R_390_GOTPLTENT\t\t33\t/* 32 bit rel. offset to jump slot. */\n+#define R_390_PLTOFF16\t\t34\t/* 16 bit offset from GOT to PLT. */\n+#define R_390_PLTOFF32\t\t35\t/* 32 bit offset from GOT to PLT. */\n+#define R_390_PLTOFF64\t\t36\t/* 16 bit offset from GOT to PLT. */\n+#define R_390_TLS_LOAD\t\t37\t/* Tag for load insn in TLS code. */\n+#define R_390_TLS_GDCALL\t38\t/* Tag for function call in general\n+ dynamic TLS code. */\n+#define R_390_TLS_LDCALL\t39\t/* Tag for function call in local\n+ dynamic TLS code. */\n+#define R_390_TLS_GD32\t\t40\t/* Direct 32 bit for general dynamic\n+ thread local data. */\n+#define R_390_TLS_GD64\t\t41\t/* Direct 64 bit for general dynamic\n+ thread local data. */\n+#define R_390_TLS_GOTIE12\t42\t/* 12 bit GOT offset for static TLS\n+ block offset. */\n+#define R_390_TLS_GOTIE32\t43\t/* 32 bit GOT offset for static TLS\n+ block offset. */\n+#define R_390_TLS_GOTIE64\t44\t/* 64 bit GOT offset for static TLS\n+ block offset. */\n+#define R_390_TLS_LDM32\t\t45\t/* Direct 32 bit for local dynamic\n+ thread local data in LD code. */\n+#define R_390_TLS_LDM64\t\t46\t/* Direct 64 bit for local dynamic\n+ thread local data in LD code. */\n+#define R_390_TLS_IE32\t\t47\t/* 32 bit address of GOT entry for\n+ negated static TLS block offset. */\n+#define R_390_TLS_IE64\t\t48\t/* 64 bit address of GOT entry for\n+ negated static TLS block offset. */\n+#define R_390_TLS_IEENT\t\t49\t/* 32 bit rel. offset to GOT entry for\n+ negated static TLS block offset. */\n+#define R_390_TLS_LE32\t\t50\t/* 32 bit negated offset relative to\n+ static TLS block. */\n+#define R_390_TLS_LE64\t\t51\t/* 64 bit negated offset relative to\n+ static TLS block. */\n+#define R_390_TLS_LDO32\t\t52\t/* 32 bit offset relative to TLS\n+ block. */\n+#define R_390_TLS_LDO64\t\t53\t/* 64 bit offset relative to TLS\n+ block. */\n+#define R_390_TLS_DTPMOD\t54\t/* ID of module containing symbol. */\n+#define R_390_TLS_DTPOFF\t55\t/* Offset in TLS block. */\n+#define R_390_TLS_TPOFF\t\t56\t/* Negate offset in static TLS\n+ block. */\n+#define R_390_20\t\t57\t/* Direct 20 bit. */\n+#define R_390_GOT20\t\t58\t/* 20 bit GOT offset. */\n+#define R_390_GOTPLT20\t\t59\t/* 20 bit offset to jump slot. */\n+#define R_390_TLS_GOTIE20\t60\t/* 20 bit GOT offset for static TLS\n+\t\t\t\t\t block offset. */\n+/* Keep this the last entry. */\n+#define R_390_NUM\t61\n+\n+/* MIPS relocations defined by the ABIs */\n+#define R_MIPS_NONE\t\t0\n+#define R_MIPS_16\t\t1\n+#define R_MIPS_32\t\t2\n+#define R_MIPS_REL32\t\t3\n+#define R_MIPS_26\t\t4\n+#define R_MIPS_HI16\t\t5\n+#define R_MIPS_LO16\t\t6\n+#define R_MIPS_GPREL16\t\t7\n+#define R_MIPS_LITERAL\t\t8\n+#define R_MIPS_GOT16\t\t9\n+#define R_MIPS_PC16\t\t10\n+#define R_MIPS_CALL16\t\t11\n+#define R_MIPS_GPREL32\t\t12\n+/* The remaining relocs are defined on Irix, although they are not\n+ in the MIPS ELF ABI.\t */\n+#define R_MIPS_UNUSED1\t\t13\n+#define R_MIPS_UNUSED2\t\t14\n+#define R_MIPS_UNUSED3\t\t15\n+#define R_MIPS_SHIFT5\t\t16\n+#define R_MIPS_SHIFT6\t\t17\n+#define R_MIPS_64\t\t18\n+#define R_MIPS_GOT_DISP\t\t19\n+#define R_MIPS_GOT_PAGE\t\t20\n+#define R_MIPS_GOT_OFST\t\t21\n+/*\n+ * The following two relocation types are specified in the MIPS ABI\n+ * conformance guide version 1.2 but not yet in the psABI.\n+ */\n+#define R_MIPS_GOTHI16\t\t22\n+#define R_MIPS_GOTLO16\t\t23\n+#define R_MIPS_SUB\t\t24\n+#define R_MIPS_INSERT_A\t\t25\n+#define R_MIPS_INSERT_B\t\t26\n+#define R_MIPS_DELETE\t\t27\n+#define R_MIPS_HIGHER\t\t28\n+#define R_MIPS_HIGHEST\t\t29\n+/*\n+ * The following two relocation types are specified in the MIPS ABI\n+ * conformance guide version 1.2 but not yet in the psABI.\n+ */\n+#define R_MIPS_CALLHI16\t\t30\n+#define R_MIPS_CALLLO16\t\t31\n+/*\n+ * Introduced for MIPSr6.\n+ */\n+#define R_MIPS_PC21_S2\t\t60\n+#define R_MIPS_PC26_S2\t\t61\n+#define R_MIPS_PC18_S3\t\t62\n+#define R_MIPS_PC19_S2\t\t63\n+#define R_MIPS_PCHI16\t\t64\n+#define R_MIPS_PCLO16\t\t65\n+/*\n+ * This range is reserved for vendor specific relocations.\n+ */\n+#define R_MIPS_LOVENDOR\t\t100\n+#define R_MIPS_HIVENDOR\t\t127\n+\n+#define R_MIPS_PC32\t\t248\n+\n+/*\n+ * Sparc ELF relocation types\n+ */\n+#define\tR_SPARC_NONE\t\t0\n+#define\tR_SPARC_8\t\t1\n+#define\tR_SPARC_16\t\t2\n+#define\tR_SPARC_32\t\t3\n+#define\tR_SPARC_DISP8\t\t4\n+#define\tR_SPARC_DISP16\t\t5\n+#define\tR_SPARC_DISP32\t\t6\n+#define\tR_SPARC_WDISP30\t\t7\n+#define\tR_SPARC_WDISP22\t\t8\n+#define\tR_SPARC_HI22\t\t9\n+#define\tR_SPARC_22\t\t10\n+#define\tR_SPARC_13\t\t11\n+#define\tR_SPARC_LO10\t\t12\n+#define\tR_SPARC_GOT10\t\t13\n+#define\tR_SPARC_GOT13\t\t14\n+#define\tR_SPARC_GOT22\t\t15\n+#define\tR_SPARC_PC10\t\t16\n+#define\tR_SPARC_PC22\t\t17\n+#define\tR_SPARC_WPLT30\t\t18\n+#define\tR_SPARC_COPY\t\t19\n+#define\tR_SPARC_GLOB_DAT\t20\n+#define\tR_SPARC_JMP_SLOT\t21\n+#define\tR_SPARC_RELATIVE\t22\n+#define\tR_SPARC_UA32\t\t23\n+#define R_SPARC_PLT32\t\t24\n+#define R_SPARC_HIPLT22\t\t25\n+#define R_SPARC_LOPLT10\t\t26\n+#define R_SPARC_PCPLT32\t\t27\n+#define R_SPARC_PCPLT22\t\t28\n+#define R_SPARC_PCPLT10\t\t29\n+#define R_SPARC_10\t\t30\n+#define R_SPARC_11\t\t31\n+#define R_SPARC_64\t\t32\n+#define R_SPARC_OLO10\t\t33\n+#define R_SPARC_WDISP16\t\t40\n+#define R_SPARC_WDISP19\t\t41\n+#define R_SPARC_7\t\t43\n+#define R_SPARC_5\t\t44\n+#define R_SPARC_6\t\t45\n+#define R_SPARC_UA64\t\t54\n+\n+#endif /* _UAPI_LINUX_ELF_R_H */\ndiff --git a/tools/include/uapi/linux/elf.h b/tools/include/uapi/linux/elf.h\nindex 5834b83d7f9a4..88bdcbb526c16 100644\n--- a/tools/include/uapi/linux/elf.h\n+++ b/tools/include/uapi/linux/elf.h\n@@ -4,6 +4,7 @@\n \n #include \u003clinux/types.h\u003e\n #include \u003clinux/elf-em.h\u003e\n+#include \u003clinux/elf-r.h\u003e\n \n /* 32-bit ELF base types. */\n typedef __u32\tElf32_Addr;\n@@ -32,9 +33,9 @@ typedef __u16\tElf64_Versym;\n #define PT_NOTE 4\n #define PT_SHLIB 5\n #define PT_PHDR 6\n-#define PT_TLS 7\t\t/* Thread local storage segment */\n-#define PT_LOOS 0x60000000\t/* OS-specific */\n-#define PT_HIOS 0x6fffffff\t/* OS-specific */\n+#define PT_TLS 7 /* Thread local storage segment */\n+#define PT_LOOS 0x60000000 /* OS-specific */\n+#define PT_HIOS 0x6fffffff /* OS-specific */\n #define PT_LOPROC 0x70000000\n #define PT_HIPROC 0x7fffffff\n #define PT_GNU_EH_FRAME\t(PT_LOOS + 0x474e550)\n@@ -95,7 +96,7 @@ typedef __u16\tElf64_Versym;\n #define DT_SONAME\t14\n #define DT_RPATH\t15\n #define DT_SYMBOLIC\t16\n-#define DT_REL\t\t17\n+#define DT_REL\t 17\n #define DT_RELSZ\t18\n #define DT_RELENT\t19\n #define DT_PLTREL\t20\n@@ -299,8 +300,18 @@ typedef struct elf64_phdr {\n #define SHF_WRITE\t\t0x1\n #define SHF_ALLOC\t\t0x2\n #define SHF_EXECINSTR\t\t0x4\n+#define SHF_MERGE\t\t0x10\n+#define SHF_STRINGS\t\t0x20\n+#define SHF_INFO_LINK\t\t0x40\n+#define SHF_LINK_ORDER\t\t0x80\n+#define SHF_OS_NONCONFORMING\t0x100\n+#define SHF_GROUP\t\t0x200\n+#define SHF_TLS\t\t\t0x400\n #define SHF_RELA_LIVEPATCH\t0x00100000\n #define SHF_RO_AFTER_INIT\t0x00200000\n+#define SHF_ORDERED\t\t0x04000000\n+#define SHF_EXCLUDE\t\t0x08000000\n+#define SHF_MASKOS\t\t0x0ff00000\n #define SHF_MASKPROC\t\t0xf0000000\n \n /* special section indexes */\n@@ -312,7 +323,7 @@ typedef struct elf64_phdr {\n #define SHN_ABS\t\t0xfff1\n #define SHN_COMMON\t0xfff2\n #define SHN_HIRESERVE\t0xffff\n-\n+ \n typedef struct elf32_shdr {\n Elf32_Word\tsh_name;\n Elf32_Word\tsh_type;\n@@ -376,101 +387,180 @@ typedef struct elf64_shdr {\n #define ELF_OSABI ELFOSABI_NONE\n #endif\n \n+/* Note definitions: NN_ defines names. NT_ defines types. */\n+\n+#define NN_GNU_PROPERTY_TYPE_0\t\"GNU\"\n+#define NT_GNU_PROPERTY_TYPE_0\t5\n+\n /*\n * Notes used in ET_CORE. Architectures export some of the arch register sets\n * using the corresponding note types via the PTRACE_GETREGSET and\n * PTRACE_SETREGSET requests.\n- * The note name for these types is \"LINUX\", except NT_PRFPREG that is named\n- * \"CORE\".\n */\n+#define NN_PRSTATUS\t\"CORE\"\n #define NT_PRSTATUS\t1\n+#define NN_PRFPREG\t\"CORE\"\n #define NT_PRFPREG\t2\n+#define NN_PRPSINFO\t\"CORE\"\n #define NT_PRPSINFO\t3\n+#define NN_TASKSTRUCT\t\"CORE\"\n #define NT_TASKSTRUCT\t4\n+#define NN_AUXV\t\t\"CORE\"\n #define NT_AUXV\t\t6\n /*\n * Note to userspace developers: size of NT_SIGINFO note may increase\n * in the future to accomodate more fields, don't assume it is fixed!\n */\n+#define NN_SIGINFO \"CORE\"\n #define NT_SIGINFO 0x53494749\n-#define NT_FILE\t\t0x46494c45\n+#define NN_FILE \"CORE\"\n+#define NT_FILE 0x46494c45\n+#define NN_PRXFPREG \"LINUX\"\n #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */\n+#define NN_PPC_VMX\t\"LINUX\"\n #define NT_PPC_VMX\t0x100\t\t/* PowerPC Altivec/VMX registers */\n+#define NN_PPC_SPE\t\"LINUX\"\n #define NT_PPC_SPE\t0x101\t\t/* PowerPC SPE/EVR registers */\n+#define NN_PPC_VSX\t\"LINUX\"\n #define NT_PPC_VSX\t0x102\t\t/* PowerPC VSX registers */\n+#define NN_PPC_TAR\t\"LINUX\"\n #define NT_PPC_TAR\t0x103\t\t/* Target Address Register */\n+#define NN_PPC_PPR\t\"LINUX\"\n #define NT_PPC_PPR\t0x104\t\t/* Program Priority Register */\n+#define NN_PPC_DSCR\t\"LINUX\"\n #define NT_PPC_DSCR\t0x105\t\t/* Data Stream Control Register */\n+#define NN_PPC_EBB\t\"LINUX\"\n #define NT_PPC_EBB\t0x106\t\t/* Event Based Branch Registers */\n+#define NN_PPC_PMU\t\"LINUX\"\n #define NT_PPC_PMU\t0x107\t\t/* Performance Monitor Registers */\n+#define NN_PPC_TM_CGPR\t\"LINUX\"\n #define NT_PPC_TM_CGPR\t0x108\t\t/* TM checkpointed GPR Registers */\n+#define NN_PPC_TM_CFPR\t\"LINUX\"\n #define NT_PPC_TM_CFPR\t0x109\t\t/* TM checkpointed FPR Registers */\n+#define NN_PPC_TM_CVMX\t\"LINUX\"\n #define NT_PPC_TM_CVMX\t0x10a\t\t/* TM checkpointed VMX Registers */\n+#define NN_PPC_TM_CVSX\t\"LINUX\"\n #define NT_PPC_TM_CVSX\t0x10b\t\t/* TM checkpointed VSX Registers */\n+#define NN_PPC_TM_SPR\t\"LINUX\"\n #define NT_PPC_TM_SPR\t0x10c\t\t/* TM Special Purpose Registers */\n+#define NN_PPC_TM_CTAR\t\"LINUX\"\n #define NT_PPC_TM_CTAR\t0x10d\t\t/* TM checkpointed Target Address Register */\n+#define NN_PPC_TM_CPPR\t\"LINUX\"\n #define NT_PPC_TM_CPPR\t0x10e\t\t/* TM checkpointed Program Priority Register */\n+#define NN_PPC_TM_CDSCR\t\"LINUX\"\n #define NT_PPC_TM_CDSCR\t0x10f\t\t/* TM checkpointed Data Stream Control Register */\n+#define NN_PPC_PKEY\t\"LINUX\"\n #define NT_PPC_PKEY\t0x110\t\t/* Memory Protection Keys registers */\n+#define NN_PPC_DEXCR\t\"LINUX\"\n #define NT_PPC_DEXCR\t0x111\t\t/* PowerPC DEXCR registers */\n+#define NN_PPC_HASHKEYR\t\"LINUX\"\n #define NT_PPC_HASHKEYR\t0x112\t\t/* PowerPC HASHKEYR register */\n+#define NN_386_TLS\t\"LINUX\"\n #define NT_386_TLS\t0x200\t\t/* i386 TLS slots (struct user_desc) */\n+#define NN_386_IOPERM\t\"LINUX\"\n #define NT_386_IOPERM\t0x201\t\t/* x86 io permission bitmap (1=deny) */\n+#define NN_X86_XSTATE\t\"LINUX\"\n #define NT_X86_XSTATE\t0x202\t\t/* x86 extended state using xsave */\n /* Old binutils treats 0x203 as a CET state */\n+#define NN_X86_SHSTK\t\"LINUX\"\n #define NT_X86_SHSTK\t0x204\t\t/* x86 SHSTK state */\n+#define NN_X86_XSAVE_LAYOUT\t\"LINUX\"\n #define NT_X86_XSAVE_LAYOUT\t0x205\t/* XSAVE layout description */\n+#define NN_S390_HIGH_GPRS\t\"LINUX\"\n #define NT_S390_HIGH_GPRS\t0x300\t/* s390 upper register halves */\n+#define NN_S390_TIMER\t\"LINUX\"\n #define NT_S390_TIMER\t0x301\t\t/* s390 timer register */\n+#define NN_S390_TODCMP\t\"LINUX\"\n #define NT_S390_TODCMP\t0x302\t\t/* s390 TOD clock comparator register */\n+#define NN_S390_TODPREG\t\"LINUX\"\n #define NT_S390_TODPREG\t0x303\t\t/* s390 TOD programmable register */\n+#define NN_S390_CTRS\t\"LINUX\"\n #define NT_S390_CTRS\t0x304\t\t/* s390 control registers */\n+#define NN_S390_PREFIX\t\"LINUX\"\n #define NT_S390_PREFIX\t0x305\t\t/* s390 prefix register */\n+#define NN_S390_LAST_BREAK\t\"LINUX\"\n #define NT_S390_LAST_BREAK\t0x306\t/* s390 breaking event address */\n+#define NN_S390_SYSTEM_CALL\t\"LINUX\"\n #define NT_S390_SYSTEM_CALL\t0x307\t/* s390 system call restart data */\n+#define NN_S390_TDB\t\"LINUX\"\n #define NT_S390_TDB\t0x308\t\t/* s390 transaction diagnostic block */\n+#define NN_S390_VXRS_LOW\t\"LINUX\"\n #define NT_S390_VXRS_LOW\t0x309\t/* s390 vector registers 0-15 upper half */\n+#define NN_S390_VXRS_HIGH\t\"LINUX\"\n #define NT_S390_VXRS_HIGH\t0x30a\t/* s390 vector registers 16-31 */\n+#define NN_S390_GS_CB\t\"LINUX\"\n #define NT_S390_GS_CB\t0x30b\t\t/* s390 guarded storage registers */\n+#define NN_S390_GS_BC\t\"LINUX\"\n #define NT_S390_GS_BC\t0x30c\t\t/* s390 guarded storage broadcast control block */\n+#define NN_S390_RI_CB\t\"LINUX\"\n #define NT_S390_RI_CB\t0x30d\t\t/* s390 runtime instrumentation */\n+#define NN_S390_PV_CPU_DATA\t\"LINUX\"\n #define NT_S390_PV_CPU_DATA\t0x30e\t/* s390 protvirt cpu dump data */\n+#define NN_ARM_VFP\t\"LINUX\"\n #define NT_ARM_VFP\t0x400\t\t/* ARM VFP/NEON registers */\n+#define NN_ARM_TLS\t\"LINUX\"\n #define NT_ARM_TLS\t0x401\t\t/* ARM TLS register */\n+#define NN_ARM_HW_BREAK\t\"LINUX\"\n #define NT_ARM_HW_BREAK\t0x402\t\t/* ARM hardware breakpoint registers */\n+#define NN_ARM_HW_WATCH\t\"LINUX\"\n #define NT_ARM_HW_WATCH\t0x403\t\t/* ARM hardware watchpoint registers */\n+#define NN_ARM_SYSTEM_CALL\t\"LINUX\"\n #define NT_ARM_SYSTEM_CALL\t0x404\t/* ARM system call number */\n+#define NN_ARM_SVE\t\"LINUX\"\n #define NT_ARM_SVE\t0x405\t\t/* ARM Scalable Vector Extension registers */\n+#define NN_ARM_PAC_MASK\t\t\"LINUX\"\n #define NT_ARM_PAC_MASK\t\t0x406\t/* ARM pointer authentication code masks */\n+#define NN_ARM_PACA_KEYS\t\"LINUX\"\n #define NT_ARM_PACA_KEYS\t0x407\t/* ARM pointer authentication address keys */\n+#define NN_ARM_PACG_KEYS\t\"LINUX\"\n #define NT_ARM_PACG_KEYS\t0x408\t/* ARM pointer authentication generic key */\n+#define NN_ARM_TAGGED_ADDR_CTRL\t\"LINUX\"\n #define NT_ARM_TAGGED_ADDR_CTRL\t0x409\t/* arm64 tagged address control (prctl()) */\n+#define NN_ARM_PAC_ENABLED_KEYS\t\"LINUX\"\n #define NT_ARM_PAC_ENABLED_KEYS\t0x40a\t/* arm64 ptr auth enabled keys (prctl()) */\n+#define NN_ARM_SSVE\t\"LINUX\"\n #define NT_ARM_SSVE\t0x40b\t\t/* ARM Streaming SVE registers */\n+#define NN_ARM_ZA\t\"LINUX\"\n #define NT_ARM_ZA\t0x40c\t\t/* ARM SME ZA registers */\n+#define NN_ARM_ZT\t\"LINUX\"\n #define NT_ARM_ZT\t0x40d\t\t/* ARM SME ZT registers */\n+#define NN_ARM_FPMR\t\"LINUX\"\n #define NT_ARM_FPMR\t0x40e\t\t/* ARM floating point mode register */\n+#define NN_ARM_POE\t\"LINUX\"\n #define NT_ARM_POE\t0x40f\t\t/* ARM POE registers */\n+#define NN_ARM_GCS\t\"LINUX\"\n #define NT_ARM_GCS\t0x410\t\t/* ARM GCS state */\n+#define NN_ARC_V2\t\"LINUX\"\n #define NT_ARC_V2\t0x600\t\t/* ARCv2 accumulator/extra registers */\n+#define NN_VMCOREDD\t\"LINUX\"\n #define NT_VMCOREDD\t0x700\t\t/* Vmcore Device Dump Note */\n+#define NN_MIPS_DSP\t\"LINUX\"\n #define NT_MIPS_DSP\t0x800\t\t/* MIPS DSP ASE registers */\n+#define NN_MIPS_FP_MODE\t\"LINUX\"\n #define NT_MIPS_FP_MODE\t0x801\t\t/* MIPS floating-point mode */\n+#define NN_MIPS_MSA\t\"LINUX\"\n #define NT_MIPS_MSA\t0x802\t\t/* MIPS SIMD registers */\n+#define NN_RISCV_CSR\t\"LINUX\"\n #define NT_RISCV_CSR\t0x900\t\t/* RISC-V Control and Status Registers */\n+#define NN_RISCV_VECTOR\t\"LINUX\"\n #define NT_RISCV_VECTOR\t0x901\t\t/* RISC-V vector registers */\n+#define NN_RISCV_TAGGED_ADDR_CTRL \"LINUX\"\n #define NT_RISCV_TAGGED_ADDR_CTRL 0x902\t/* RISC-V tagged address control (prctl()) */\n+#define NN_LOONGARCH_CPUCFG\t\"LINUX\"\n #define NT_LOONGARCH_CPUCFG\t0xa00\t/* LoongArch CPU config registers */\n+#define NN_LOONGARCH_CSR\t\"LINUX\"\n #define NT_LOONGARCH_CSR\t0xa01\t/* LoongArch control and status registers */\n+#define NN_LOONGARCH_LSX\t\"LINUX\"\n #define NT_LOONGARCH_LSX\t0xa02\t/* LoongArch Loongson SIMD Extension registers */\n+#define NN_LOONGARCH_LASX\t\"LINUX\"\n #define NT_LOONGARCH_LASX\t0xa03\t/* LoongArch Loongson Advanced SIMD Extension registers */\n+#define NN_LOONGARCH_LBT\t\"LINUX\"\n #define NT_LOONGARCH_LBT\t0xa04\t/* LoongArch Loongson Binary Translation registers */\n+#define NN_LOONGARCH_HW_BREAK\t\"LINUX\"\n #define NT_LOONGARCH_HW_BREAK\t0xa05 /* LoongArch hardware breakpoint registers */\n+#define NN_LOONGARCH_HW_WATCH\t\"LINUX\"\n #define NT_LOONGARCH_HW_WATCH\t0xa06 /* LoongArch hardware watchpoint registers */\n \n-/* Note types with note name \"GNU\" */\n-#define NT_GNU_PROPERTY_TYPE_0\t5\n-\n /* Note header in a PT_NOTE section */\n typedef struct elf32_note {\n Elf32_Word\tn_namesz;\t/* Name size */\n"
} |
| 2/1 | 2026/09/08 07:44 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series introduces a build-time ELF relocation checker tool (vdsocheck host program written in Rust), adjusts Makefiles to run this build-time check on vDSO images, and refactors ELF relocation macro definitions across architecture headers into a unified uapi header (linux/elf-r.h). No runtime kernel executable code, data structures, or logic are modified.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit 9747acb9f056fc9dbdeca1bd2df9516d807987b0
Author: syz-cluster <triage@syzkaller.com>
Date: Tue Sep 8 07:44:43 2026 +0000
syz-cluster: applied patch under review
diff --git a/Makefile b/Makefile
index 4ad67b737af7a..e6e0dd7818ef3 100644
--- a/Makefile
+++ b/Makefile
@@ -1559,6 +1559,25 @@ vdso_install: export INSTALL_FILES = $(vdso-install-y)
vdso_install:
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst
+# ---------------------------------------------------------------------------
+# vDSO check
+
+ifdef CONFIG_RUST_IS_AVAILABLE
+ifdef CONFIG_VDSO_CHECK
+
+# Build the checker early.
+prepare: vdsocheck
+
+# If the architecture builds the vDSO early, make sure to be earlier.
+PHONY += vdso_prepare
+vdso_prepare: vdsocheck
+
+PHONY += vdsocheck
+vdsocheck:
+ $(Q)$(MAKE) $(build)=lib/vdso/check $@
+endif
+endif
+
# ---------------------------------------------------------------------------
# Tools
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index 9f21e170320fc..ec2d416baa9f7 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -47,30 +47,6 @@ typedef struct user_fp elf_fpregset_t;
#define EF_ARM_HASENTRY 0x00000002 /* All */
#define EF_ARM_RELEXEC 0x00000001 /* All */
-#define R_ARM_NONE 0
-#define R_ARM_PC24 1
-#define R_ARM_ABS32 2
-#define R_ARM_REL32 3
-#define R_ARM_CALL 28
-#define R_ARM_JUMP24 29
-#define R_ARM_TARGET1 38
-#define R_ARM_V4BX 40
-#define R_ARM_PREL31 42
-#define R_ARM_MOVW_ABS_NC 43
-#define R_ARM_MOVT_ABS 44
-#define R_ARM_MOVW_PREL_NC 45
-#define R_ARM_MOVT_PREL 46
-#define R_ARM_ALU_PC_G0_NC 57
-#define R_ARM_ALU_PC_G1_NC 59
-#define R_ARM_LDR_PC_G2 63
-
-#define R_ARM_THM_CALL 10
-#define R_ARM_THM_JUMP24 30
-#define R_ARM_THM_MOVW_ABS_NC 47
-#define R_ARM_THM_MOVT_ABS 48
-#define R_ARM_THM_MOVW_PREL_NC 49
-#define R_ARM_THM_MOVT_PREL 50
-
/*
* These are used to set parameters in the core dumps.
*/
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index cf8cd39ab8046..fd34d0ff018a8 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -37,7 +37,7 @@ endif
$(obj)/vdso.o : $(obj)/vdso.so
# Link rule for the .so file
-$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
@@ -50,7 +50,7 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
# Actual build commands
quiet_cmd_vdsold_and_vdso_check = LD $@
- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)
quiet_cmd_vdsomunge = MUNGE $@
cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index d2779d604c7be..43f3763807a2f 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -13,61 +13,6 @@
#include <asm/ptrace.h>
#include <asm/user.h>
-/*
- * AArch64 static relocation types.
- */
-
-/* Miscellaneous. */
-#define R_ARM_NONE 0
-#define R_AARCH64_NONE 256
-
-/* Data. */
-#define R_AARCH64_ABS64 257
-#define R_AARCH64_ABS32 258
-#define R_AARCH64_ABS16 259
-#define R_AARCH64_PREL64 260
-#define R_AARCH64_PREL32 261
-#define R_AARCH64_PREL16 262
-
-/* Instructions. */
-#define R_AARCH64_MOVW_UABS_G0 263
-#define R_AARCH64_MOVW_UABS_G0_NC 264
-#define R_AARCH64_MOVW_UABS_G1 265
-#define R_AARCH64_MOVW_UABS_G1_NC 266
-#define R_AARCH64_MOVW_UABS_G2 267
-#define R_AARCH64_MOVW_UABS_G2_NC 268
-#define R_AARCH64_MOVW_UABS_G3 269
-
-#define R_AARCH64_MOVW_SABS_G0 270
-#define R_AARCH64_MOVW_SABS_G1 271
-#define R_AARCH64_MOVW_SABS_G2 272
-
-#define R_AARCH64_LD_PREL_LO19 273
-#define R_AARCH64_ADR_PREL_LO21 274
-#define R_AARCH64_ADR_PREL_PG_HI21 275
-#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
-#define R_AARCH64_ADD_ABS_LO12_NC 277
-#define R_AARCH64_LDST8_ABS_LO12_NC 278
-
-#define R_AARCH64_TSTBR14 279
-#define R_AARCH64_CONDBR19 280
-#define R_AARCH64_JUMP26 282
-#define R_AARCH64_CALL26 283
-#define R_AARCH64_LDST16_ABS_LO12_NC 284
-#define R_AARCH64_LDST32_ABS_LO12_NC 285
-#define R_AARCH64_LDST64_ABS_LO12_NC 286
-#define R_AARCH64_LDST128_ABS_LO12_NC 299
-
-#define R_AARCH64_MOVW_PREL_G0 287
-#define R_AARCH64_MOVW_PREL_G0_NC 288
-#define R_AARCH64_MOVW_PREL_G1 289
-#define R_AARCH64_MOVW_PREL_G1_NC 290
-#define R_AARCH64_MOVW_PREL_G2 291
-#define R_AARCH64_MOVW_PREL_G2_NC 292
-#define R_AARCH64_MOVW_PREL_G3 293
-
-#define R_AARCH64_RELATIVE 1027
-
/*
* These are used to set parameters in the core dumps.
*/
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index 7dec05dd33b70..9fac0e54097dc 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -61,7 +61,7 @@ targets += vdso.lds
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
# Link rule for the .so file, .lds has to be first
-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
# Strip rule for the .so file
@@ -79,4 +79,4 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
# Actual build commands
quiet_cmd_vdsold_and_vdso_check = LD $@
- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)
diff --git a/arch/loongarch/include/asm/elf.h b/arch/loongarch/include/asm/elf.h
index 912c50cdd6b7c..3cbce7e772fa2 100644
--- a/arch/loongarch/include/asm/elf.h
+++ b/arch/loongarch/include/asm/elf.h
@@ -21,136 +21,6 @@
#define EF_LOONGARCH_ABI_ILP32_SINGLE_FLOAT 0x6
#define EF_LOONGARCH_ABI_ILP32_DOUBLE_FLOAT 0x7
-/* LoongArch relocation types used by the dynamic linker */
-#define R_LARCH_NONE 0
-#define R_LARCH_32 1
-#define R_LARCH_64 2
-#define R_LARCH_RELATIVE 3
-#define R_LARCH_COPY 4
-#define R_LARCH_JUMP_SLOT 5
-#define R_LARCH_TLS_DTPMOD32 6
-#define R_LARCH_TLS_DTPMOD64 7
-#define R_LARCH_TLS_DTPREL32 8
-#define R_LARCH_TLS_DTPREL64 9
-#define R_LARCH_TLS_TPREL32 10
-#define R_LARCH_TLS_TPREL64 11
-#define R_LARCH_IRELATIVE 12
-#define R_LARCH_MARK_LA 20
-#define R_LARCH_MARK_PCREL 21
-#define R_LARCH_SOP_PUSH_PCREL 22
-#define R_LARCH_SOP_PUSH_ABSOLUTE 23
-#define R_LARCH_SOP_PUSH_DUP 24
-#define R_LARCH_SOP_PUSH_GPREL 25
-#define R_LARCH_SOP_PUSH_TLS_TPREL 26
-#define R_LARCH_SOP_PUSH_TLS_GOT 27
-#define R_LARCH_SOP_PUSH_TLS_GD 28
-#define R_LARCH_SOP_PUSH_PLT_PCREL 29
-#define R_LARCH_SOP_ASSERT 30
-#define R_LARCH_SOP_NOT 31
-#define R_LARCH_SOP_SUB 32
-#define R_LARCH_SOP_SL 33
-#define R_LARCH_SOP_SR 34
-#define R_LARCH_SOP_ADD 35
-#define R_LARCH_SOP_AND 36
-#define R_LARCH_SOP_IF_ELSE 37
-#define R_LARCH_SOP_POP_32_S_10_5 38
-#define R_LARCH_SOP_POP_32_U_10_12 39
-#define R_LARCH_SOP_POP_32_S_10_12 40
-#define R_LARCH_SOP_POP_32_S_10_16 41
-#define R_LARCH_SOP_POP_32_S_10_16_S2 42
-#define R_LARCH_SOP_POP_32_S_5_20 43
-#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
-#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
-#define R_LARCH_SOP_POP_32_U 46
-#define R_LARCH_ADD8 47
-#define R_LARCH_ADD16 48
-#define R_LARCH_ADD24 49
-#define R_LARCH_ADD32 50
-#define R_LARCH_ADD64 51
-#define R_LARCH_SUB8 52
-#define R_LARCH_SUB16 53
-#define R_LARCH_SUB24 54
-#define R_LARCH_SUB32 55
-#define R_LARCH_SUB64 56
-#define R_LARCH_GNU_VTINHERIT 57
-#define R_LARCH_GNU_VTENTRY 58
-#define R_LARCH_B16 64
-#define R_LARCH_B21 65
-#define R_LARCH_B26 66
-#define R_LARCH_ABS_HI20 67
-#define R_LARCH_ABS_LO12 68
-#define R_LARCH_ABS64_LO20 69
-#define R_LARCH_ABS64_HI12 70
-#define R_LARCH_PCALA_HI20 71
-#define R_LARCH_PCALA_LO12 72
-#define R_LARCH_PCALA64_LO20 73
-#define R_LARCH_PCALA64_HI12 74
-#define R_LARCH_GOT_PC_HI20 75
-#define R_LARCH_GOT_PC_LO12 76
-#define R_LARCH_GOT64_PC_LO20 77
-#define R_LARCH_GOT64_PC_HI12 78
-#define R_LARCH_GOT_HI20 79
-#define R_LARCH_GOT_LO12 80
-#define R_LARCH_GOT64_LO20 81
-#define R_LARCH_GOT64_HI12 82
-#define R_LARCH_TLS_LE_HI20 83
-#define R_LARCH_TLS_LE_LO12 84
-#define R_LARCH_TLS_LE64_LO20 85
-#define R_LARCH_TLS_LE64_HI12 86
-#define R_LARCH_TLS_IE_PC_HI20 87
-#define R_LARCH_TLS_IE_PC_LO12 88
-#define R_LARCH_TLS_IE64_PC_LO20 89
-#define R_LARCH_TLS_IE64_PC_HI12 90
-#define R_LARCH_TLS_IE_HI20 91
-#define R_LARCH_TLS_IE_LO12 92
-#define R_LARCH_TLS_IE64_LO20 93
-#define R_LARCH_TLS_IE64_HI12 94
-#define R_LARCH_TLS_LD_PC_HI20 95
-#define R_LARCH_TLS_LD_HI20 96
-#define R_LARCH_TLS_GD_PC_HI20 97
-#define R_LARCH_TLS_GD_HI20 98
-#define R_LARCH_32_PCREL 99
-#define R_LARCH_RELAX 100
-#define R_LARCH_DELETE 101
-#define R_LARCH_ALIGN 102
-#define R_LARCH_PCREL20_S2 103
-#define R_LARCH_CFA 104
-#define R_LARCH_ADD6 105
-#define R_LARCH_SUB6 106
-#define R_LARCH_ADD_ULEB128 107
-#define R_LARCH_SUB_ULEB128 108
-#define R_LARCH_64_PCREL 109
-#define R_LARCH_CALL36 110
-#define R_LARCH_TLS_DESC_PC_HI20 111
-#define R_LARCH_TLS_DESC_PC_LO12 112
-#define R_LARCH_TLS_DESC64_PC_LO20 113
-#define R_LARCH_TLS_DESC64_PC_HI12 114
-#define R_LARCH_TLS_DESC_HI20 115
-#define R_LARCH_TLS_DESC_LO12 116
-#define R_LARCH_TLS_DESC64_LO20 117
-#define R_LARCH_TLS_DESC64_HI12 118
-#define R_LARCH_TLS_DESC_LD 119
-#define R_LARCH_TLS_DESC_CALL 120
-#define R_LARCH_TLS_LE_HI20_R 121
-#define R_LARCH_TLS_LE_ADD_R 122
-#define R_LARCH_TLS_LE_LO12_R 123
-#define R_LARCH_TLS_LD_PCREL20_S2 124
-#define R_LARCH_TLS_GD_PCREL20_S2 125
-#define R_LARCH_TLS_DESC_PCREL20_S2 126
-#define R_LARCH_CALL30 127
-#define R_LARCH_PCADD_HI20 128
-#define R_LARCH_PCADD_LO12 129
-#define R_LARCH_GOT_PCADD_HI20 130
-#define R_LARCH_GOT_PCADD_LO12 131
-#define R_LARCH_TLS_IE_PCADD_HI20 132
-#define R_LARCH_TLS_IE_PCADD_LO12 133
-#define R_LARCH_TLS_LD_PCADD_HI20 134
-#define R_LARCH_TLS_LD_PCADD_LO12 135
-#define R_LARCH_TLS_GD_PCADD_HI20 136
-#define R_LARCH_TLS_GD_PCADD_LO12 137
-#define R_LARCH_TLS_DESC_PCADD_HI20 138
-#define R_LARCH_TLS_DESC_PCADD_LO12 139
-
#ifndef ELF_ARCH
/* ELF register definitions */
diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index 9c9181bb40715..b0dc583286642 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -50,7 +50,7 @@ ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
#
quiet_cmd_vdsold_and_vdso_check = LD $@
- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)
quiet_cmd_vdsoas_o_S = AS $@
cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
@@ -79,7 +79,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso.so: OBJCOPYFLAGS := -S
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index aaef0eaa68d55..347e12584beeb 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -70,61 +70,6 @@
#define DT_MIPS_HIPAGENO 0x70000014
#define DT_MIPS_RLD_MAP 0x70000016
-#define R_MIPS_NONE 0
-#define R_MIPS_16 1
-#define R_MIPS_32 2
-#define R_MIPS_REL32 3
-#define R_MIPS_26 4
-#define R_MIPS_HI16 5
-#define R_MIPS_LO16 6
-#define R_MIPS_GPREL16 7
-#define R_MIPS_LITERAL 8
-#define R_MIPS_GOT16 9
-#define R_MIPS_PC16 10
-#define R_MIPS_CALL16 11
-#define R_MIPS_GPREL32 12
-/* The remaining relocs are defined on Irix, although they are not
- in the MIPS ELF ABI. */
-#define R_MIPS_UNUSED1 13
-#define R_MIPS_UNUSED2 14
-#define R_MIPS_UNUSED3 15
-#define R_MIPS_SHIFT5 16
-#define R_MIPS_SHIFT6 17
-#define R_MIPS_64 18
-#define R_MIPS_GOT_DISP 19
-#define R_MIPS_GOT_PAGE 20
-#define R_MIPS_GOT_OFST 21
-/*
- * The following two relocation types are specified in the MIPS ABI
- * conformance guide version 1.2 but not yet in the psABI.
- */
-#define R_MIPS_GOTHI16 22
-#define R_MIPS_GOTLO16 23
-#define R_MIPS_SUB 24
-#define R_MIPS_INSERT_A 25
-#define R_MIPS_INSERT_B 26
-#define R_MIPS_DELETE 27
-#define R_MIPS_HIGHER 28
-#define R_MIPS_HIGHEST 29
-/*
- * The following two relocation types are specified in the MIPS ABI
- * conformance guide version 1.2 but not yet in the psABI.
- */
-#define R_MIPS_CALLHI16 30
-#define R_MIPS_CALLLO16 31
-/*
- * Introduced for MIPSr6.
- */
-#define R_MIPS_PC21_S2 60
-#define R_MIPS_PC26_S2 61
-/*
- * This range is reserved for vendor specific relocations.
- */
-#define R_MIPS_LOVENDOR 100
-#define R_MIPS_HIVENDOR 127
-
-#define R_MIPS_PC32 248
-
#define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */
#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 00d3ba2c482ac..63060057cd213 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -66,7 +66,7 @@ quiet_cmd_vdso_mips_check = VDSOCHK $@
#
quiet_cmd_vdsold_and_vdso_check = LD $@
- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check); $(cmd_vdso_mips_check)
+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check); $(cmd_vdso_mips_check)
quiet_cmd_vdsoas_o_S = AS $@
cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
@@ -103,7 +103,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
-$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso-image.c: $(obj)/vdso.so.dbg.raw $(obj)/vdso.so.raw \
@@ -141,7 +141,7 @@ $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32
$(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
-$(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE
+$(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso-o32-image.c: VDSO_NAME := o32
@@ -181,7 +181,7 @@ $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32
$(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
-$(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE
+$(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso-n32-image.c: VDSO_NAME := n32
diff --git a/arch/powerpc/include/uapi/asm/elf.h b/arch/powerpc/include/uapi/asm/elf.h
index a5377f494fa31..aba921b8249a2 100644
--- a/arch/powerpc/include/uapi/asm/elf.h
+++ b/arch/powerpc/include/uapi/asm/elf.h
@@ -17,78 +17,6 @@
#include <asm/cputable.h>
#include <asm/auxvec.h>
-/* PowerPC relocations defined by the ABIs */
-#define R_PPC_NONE 0
-#define R_PPC_ADDR32 1 /* 32bit absolute address */
-#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
-#define R_PPC_ADDR16 3 /* 16bit absolute address */
-#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
-#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
-#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
-#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
-#define R_PPC_ADDR14_BRTAKEN 8
-#define R_PPC_ADDR14_BRNTAKEN 9
-#define R_PPC_REL24 10 /* PC relative 26 bit */
-#define R_PPC_REL14 11 /* PC relative 16 bit */
-#define R_PPC_REL14_BRTAKEN 12
-#define R_PPC_REL14_BRNTAKEN 13
-#define R_PPC_GOT16 14
-#define R_PPC_GOT16_LO 15
-#define R_PPC_GOT16_HI 16
-#define R_PPC_GOT16_HA 17
-#define R_PPC_PLTREL24 18
-#define R_PPC_COPY 19
-#define R_PPC_GLOB_DAT 20
-#define R_PPC_JMP_SLOT 21
-#define R_PPC_RELATIVE 22
-#define R_PPC_LOCAL24PC 23
-#define R_PPC_UADDR32 24
-#define R_PPC_UADDR16 25
-#define R_PPC_REL32 26
-#define R_PPC_PLT32 27
-#define R_PPC_PLTREL32 28
-#define R_PPC_PLT16_LO 29
-#define R_PPC_PLT16_HI 30
-#define R_PPC_PLT16_HA 31
-#define R_PPC_SDAREL16 32
-#define R_PPC_SECTOFF 33
-#define R_PPC_SECTOFF_LO 34
-#define R_PPC_SECTOFF_HI 35
-#define R_PPC_SECTOFF_HA 36
-
-/* PowerPC relocations defined for the TLS access ABI. */
-#define R_PPC_TLS 67 /* none (sym+add)@tls */
-#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
-#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
-#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
-#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
-#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
-#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
-#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
-#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
-#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
-#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
-#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
-#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
-#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
-#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
-#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
-#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
-#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
-#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
-#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
-#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
-#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
-#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
-#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
-#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
-#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
-#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
-#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
-
-/* keep this the last entry. */
-#define R_PPC_NUM 95
-
#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
#define ELF_NFPREG 33 /* includes fpscr */
@@ -166,133 +94,4 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG];
#endif
-/* PowerPC64 relocations defined by the ABIs */
-#define R_PPC64_NONE R_PPC_NONE
-#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */
-#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */
-#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */
-#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */
-#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */
-#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
-#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */
-#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
-#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
-#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */
-#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */
-#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
-#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
-#define R_PPC64_GOT16 R_PPC_GOT16
-#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
-#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
-#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
-
-#define R_PPC64_COPY R_PPC_COPY
-#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
-#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
-#define R_PPC64_RELATIVE R_PPC_RELATIVE
-
-#define R_PPC64_UADDR32 R_PPC_UADDR32
-#define R_PPC64_UADDR16 R_PPC_UADDR16
-#define R_PPC64_REL32 R_PPC_REL32
-#define R_PPC64_PLT32 R_PPC_PLT32
-#define R_PPC64_PLTREL32 R_PPC_PLTREL32
-#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
-#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
-#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
-
-#define R_PPC64_SECTOFF R_PPC_SECTOFF
-#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
-#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
-#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
-#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */
-#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */
-#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */
-#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */
-#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */
-#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */
-#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */
-#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */
-#define R_PPC64_PLT64 45 /* doubleword64 L + A. */
-#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */
-#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */
-#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */
-#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */
-#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */
-#define R_PPC64_TOC 51 /* doubleword64 .TOC. */
-#define R_PPC64_PLTGOT16 52 /* half16* M + A. */
-#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */
-#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */
-#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */
-
-#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */
-#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */
-#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */
-#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */
-#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */
-#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */
-#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */
-#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */
-#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */
-#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */
-#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */
-
-/* PowerPC64 relocations defined for the TLS access ABI. */
-#define R_PPC64_TLS 67 /* none (sym+add)@tls */
-#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
-#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
-#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
-#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
-#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
-#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
-#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
-#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
-#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
-#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
-#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
-#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
-#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
-#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
-#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
-#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
-#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
-#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
-#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
-#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
-#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
-#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
-#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
-#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
-#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
-#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
-#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
-#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
-#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
-#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
-#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
-#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
-#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
-#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
-#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
-#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
-#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
-#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
-#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
-#define R_PPC64_TLSGD 107
-#define R_PPC64_TLSLD 108
-#define R_PPC64_TOCSAVE 109
-
-#define R_PPC64_REL24_NOTOC 116
-#define R_PPC64_ENTRY 118
-
-#define R_PPC64_PCREL34 132
-#define R_PPC64_GOT_PCREL34 133
-
-#define R_PPC64_REL16 249
-#define R_PPC64_REL16_LO 250
-#define R_PPC64_REL16_HI 251
-#define R_PPC64_REL16_HA 252
-
-/* Keep this the last entry. */
-#define R_PPC64_NUM 253
-
#endif /* _UAPI_ASM_POWERPC_ELF_H */
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index 368759f817084..ca20b91b4373c 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -81,9 +81,9 @@ targets += vdso64.lds
CPPFLAGS_vdso64.lds += -P -C
# link rule for the .so file, .lds has to be first
-$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE
+$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o $(vdsocheck) FORCE
$(call if_changed,vdso32ld_and_check)
-$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o FORCE
+$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o $(vdsocheck) FORCE
$(call if_changed,vdso64ld_and_check)
# assembly rules for the .S files
diff --git a/arch/riscv/include/uapi/asm/elf.h b/arch/riscv/include/uapi/asm/elf.h
index 11a71b8533d57..05cf74a4a5357 100644
--- a/arch/riscv/include/uapi/asm/elf.h
+++ b/arch/riscv/include/uapi/asm/elf.h
@@ -32,70 +32,4 @@ typedef union __riscv_fp_state elf_fpregset_t;
#define ELF_RISCV_R_TYPE(r_info) ELF32_R_TYPE(r_info)
#endif
-/*
- * RISC-V relocation types
- */
-
-/* Relocation types used by the dynamic linker */
-#define R_RISCV_NONE 0
-#define R_RISCV_32 1
-#define R_RISCV_64 2
-#define R_RISCV_RELATIVE 3
-#define R_RISCV_COPY 4
-#define R_RISCV_JUMP_SLOT 5
-#define R_RISCV_TLS_DTPMOD32 6
-#define R_RISCV_TLS_DTPMOD64 7
-#define R_RISCV_TLS_DTPREL32 8
-#define R_RISCV_TLS_DTPREL64 9
-#define R_RISCV_TLS_TPREL32 10
-#define R_RISCV_TLS_TPREL64 11
-#define R_RISCV_IRELATIVE 58
-
-/* Relocation types not used by the dynamic linker */
-#define R_RISCV_BRANCH 16
-#define R_RISCV_JAL 17
-#define R_RISCV_CALL 18
-#define R_RISCV_CALL_PLT 19
-#define R_RISCV_GOT_HI20 20
-#define R_RISCV_TLS_GOT_HI20 21
-#define R_RISCV_TLS_GD_HI20 22
-#define R_RISCV_PCREL_HI20 23
-#define R_RISCV_PCREL_LO12_I 24
-#define R_RISCV_PCREL_LO12_S 25
-#define R_RISCV_HI20 26
-#define R_RISCV_LO12_I 27
-#define R_RISCV_LO12_S 28
-#define R_RISCV_TPREL_HI20 29
-#define R_RISCV_TPREL_LO12_I 30
-#define R_RISCV_TPREL_LO12_S 31
-#define R_RISCV_TPREL_ADD 32
-#define R_RISCV_ADD8 33
-#define R_RISCV_ADD16 34
-#define R_RISCV_ADD32 35
-#define R_RISCV_ADD64 36
-#define R_RISCV_SUB8 37
-#define R_RISCV_SUB16 38
-#define R_RISCV_SUB32 39
-#define R_RISCV_SUB64 40
-#define R_RISCV_GNU_VTINHERIT 41
-#define R_RISCV_GNU_VTENTRY 42
-#define R_RISCV_ALIGN 43
-#define R_RISCV_RVC_BRANCH 44
-#define R_RISCV_RVC_JUMP 45
-#define R_RISCV_GPREL_I 47
-#define R_RISCV_GPREL_S 48
-#define R_RISCV_TPREL_I 49
-#define R_RISCV_TPREL_S 50
-#define R_RISCV_RELAX 51
-#define R_RISCV_SUB6 52
-#define R_RISCV_SET6 53
-#define R_RISCV_SET8 54
-#define R_RISCV_SET16 55
-#define R_RISCV_SET32 56
-#define R_RISCV_32_PCREL 57
-#define R_RISCV_PLT32 59
-#define R_RISCV_SET_ULEB128 60
-#define R_RISCV_SUB_ULEB128 61
-
-
#endif /* _UAPI_ASM_RISCV_ELF_H */
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 8dbf2532a5730..7e707fdff26c1 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -74,7 +74,7 @@ endif
$(obj)/$(vdso_o): $(obj)/$(vdso_so)
# link rule for the .so file, .lds has to be first
-$(obj)/$(vdso_so_dbg): $(obj)/$(vdso_lds) $(obj-vdso) FORCE
+$(obj)/$(vdso_so_dbg): $(obj)/$(vdso_lds) $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_check)
LDFLAGS_$(vdso_so_dbg) = -shared -soname=linux-vdso.so.1 \
--build-id=sha1 --eh-frame-hdr
@@ -96,7 +96,7 @@ include/generated/$(vdso_offsets): $(obj)/$(vdso_so_dbg) FORCE
# The DSO images are built using a special linker script
# Make sure only to export the intended __vdso_xxx symbol offsets.
quiet_cmd_vdsold_and_check = VDSOLD $@
- cmd_vdsold_and_check = $(LD) $(CFI_FULL) $(ld_flags) -T $(filter-out FORCE,$^) -o $@.tmp && \
+ cmd_vdsold_and_check = $(LD) $(CFI_FULL) $(ld_flags) -T $(filter-out FORCE $(vdsocheck),$^) -o $@.tmp && \
$(OBJCOPY) $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
rm $@.tmp && \
$(cmd_vdso_check)
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index bb63fa4d20bb8..c3fa168f0c300 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -8,89 +8,6 @@
#ifndef __ASMS390_ELF_H
#define __ASMS390_ELF_H
-/* s390 relocations defined by the ABIs */
-#define R_390_NONE 0 /* No reloc. */
-#define R_390_8 1 /* Direct 8 bit. */
-#define R_390_12 2 /* Direct 12 bit. */
-#define R_390_16 3 /* Direct 16 bit. */
-#define R_390_32 4 /* Direct 32 bit. */
-#define R_390_PC32 5 /* PC relative 32 bit. */
-#define R_390_GOT12 6 /* 12 bit GOT offset. */
-#define R_390_GOT32 7 /* 32 bit GOT offset. */
-#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
-#define R_390_COPY 9 /* Copy symbol at runtime. */
-#define R_390_GLOB_DAT 10 /* Create GOT entry. */
-#define R_390_JMP_SLOT 11 /* Create PLT entry. */
-#define R_390_RELATIVE 12 /* Adjust by program base. */
-#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
-#define R_390_GOTPC 14 /* 32 bit PC rel. offset to GOT. */
-#define R_390_GOT16 15 /* 16 bit GOT offset. */
-#define R_390_PC16 16 /* PC relative 16 bit. */
-#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
-#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
-#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
-#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
-#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
-#define R_390_64 22 /* Direct 64 bit. */
-#define R_390_PC64 23 /* PC relative 64 bit. */
-#define R_390_GOT64 24 /* 64 bit GOT offset. */
-#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
-#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
-#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
-#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
-#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
-#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
-#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
-#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
-#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
-#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
-#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
-#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
-#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
-#define R_390_TLS_GDCALL 38 /* Tag for function call in general
- dynamic TLS code. */
-#define R_390_TLS_LDCALL 39 /* Tag for function call in local
- dynamic TLS code. */
-#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
- thread local data. */
-#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
- thread local data. */
-#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
- block offset. */
-#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
- block offset. */
-#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
- block offset. */
-#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
- thread local data in LD code. */
-#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
- thread local data in LD code. */
-#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
- negated static TLS block offset. */
-#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
- negated static TLS block offset. */
-#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
- negated static TLS block offset. */
-#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
- static TLS block. */
-#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
- static TLS block. */
-#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
- block. */
-#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
- block. */
-#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
-#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
-#define R_390_TLS_TPOFF 56 /* Negate offset in static TLS
- block. */
-#define R_390_20 57 /* Direct 20 bit. */
-#define R_390_GOT20 58 /* 20 bit GOT offset. */
-#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
-#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
- block offset. */
-/* Keep this the last entry. */
-#define R_390_NUM 61
-
/*
* HWCAP flags - for AT_HWCAP
*
diff --git a/arch/s390/kernel/vdso/Makefile b/arch/s390/kernel/vdso/Makefile
index 35c834b895ecb..509ef3f1e2ebf 100644
--- a/arch/s390/kernel/vdso/Makefile
+++ b/arch/s390/kernel/vdso/Makefile
@@ -44,10 +44,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
$(obj)/vdso_wrapper.o : $(obj)/vdso.so
quiet_cmd_vdso_and_check = VDSO $@
- cmd_vdso_and_check = $(cmd_ld); $(cmd_vdso_check)
+ cmd_vdso_and_check = $(cmd_ld_vdso); $(cmd_vdso_check)
# link rule for the .so file, .lds has to be first
-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvdso) FORCE
+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvdso) $(vdsocheck) FORCE
$(call if_changed,vdso_and_check)
# strip rule for the .so file
diff --git a/arch/sparc/include/asm/elf_32.h b/arch/sparc/include/asm/elf_32.h
index 37a6016c9ccdf..02736284f7afb 100644
--- a/arch/sparc/include/asm/elf_32.h
+++ b/arch/sparc/include/asm/elf_32.h
@@ -13,49 +13,6 @@
*/
#define STT_REGISTER 13
-/*
- * Sparc ELF relocation types
- */
-#define R_SPARC_NONE 0
-#define R_SPARC_8 1
-#define R_SPARC_16 2
-#define R_SPARC_32 3
-#define R_SPARC_DISP8 4
-#define R_SPARC_DISP16 5
-#define R_SPARC_DISP32 6
-#define R_SPARC_WDISP30 7
-#define R_SPARC_WDISP22 8
-#define R_SPARC_HI22 9
-#define R_SPARC_22 10
-#define R_SPARC_13 11
-#define R_SPARC_LO10 12
-#define R_SPARC_GOT10 13
-#define R_SPARC_GOT13 14
-#define R_SPARC_GOT22 15
-#define R_SPARC_PC10 16
-#define R_SPARC_PC22 17
-#define R_SPARC_WPLT30 18
-#define R_SPARC_COPY 19
-#define R_SPARC_GLOB_DAT 20
-#define R_SPARC_JMP_SLOT 21
-#define R_SPARC_RELATIVE 22
-#define R_SPARC_UA32 23
-#define R_SPARC_PLT32 24
-#define R_SPARC_HIPLT22 25
-#define R_SPARC_LOPLT10 26
-#define R_SPARC_PCPLT32 27
-#define R_SPARC_PCPLT22 28
-#define R_SPARC_PCPLT10 29
-#define R_SPARC_10 30
-#define R_SPARC_11 31
-#define R_SPARC_64 32
-#define R_SPARC_OLO10 33
-#define R_SPARC_WDISP16 40
-#define R_SPARC_WDISP19 41
-#define R_SPARC_7 43
-#define R_SPARC_5 44
-#define R_SPARC_6 45
-
/* Bits present in AT_HWCAP, primarily for Sparc32. */
#define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 694ed081cf8d9..3be9e2d3a94af 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -16,50 +16,6 @@
*/
#define STT_REGISTER 13
-/*
- * Sparc ELF relocation types
- */
-#define R_SPARC_NONE 0
-#define R_SPARC_8 1
-#define R_SPARC_16 2
-#define R_SPARC_32 3
-#define R_SPARC_DISP8 4
-#define R_SPARC_DISP16 5
-#define R_SPARC_DISP32 6
-#define R_SPARC_WDISP30 7
-#define R_SPARC_WDISP22 8
-#define R_SPARC_HI22 9
-#define R_SPARC_22 10
-#define R_SPARC_13 11
-#define R_SPARC_LO10 12
-#define R_SPARC_GOT10 13
-#define R_SPARC_GOT13 14
-#define R_SPARC_GOT22 15
-#define R_SPARC_PC10 16
-#define R_SPARC_PC22 17
-#define R_SPARC_WPLT30 18
-#define R_SPARC_COPY 19
-#define R_SPARC_GLOB_DAT 20
-#define R_SPARC_JMP_SLOT 21
-#define R_SPARC_RELATIVE 22
-#define R_SPARC_UA32 23
-#define R_SPARC_PLT32 24
-#define R_SPARC_HIPLT22 25
-#define R_SPARC_LOPLT10 26
-#define R_SPARC_PCPLT32 27
-#define R_SPARC_PCPLT22 28
-#define R_SPARC_PCPLT10 29
-#define R_SPARC_10 30
-#define R_SPARC_11 31
-#define R_SPARC_64 32
-#define R_SPARC_OLO10 33
-#define R_SPARC_WDISP16 40
-#define R_SPARC_WDISP19 41
-#define R_SPARC_7 43
-#define R_SPARC_5 44
-#define R_SPARC_6 45
-#define R_SPARC_UA64 54
-
/* Bits present in AT_HWCAP, primarily for Sparc32. */
#define HWCAP_SPARC_FLUSH 0x00000001
#define HWCAP_SPARC_STBAR 0x00000002
diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 83fb2aca59cb9..8bb235c3a6180 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -28,7 +28,7 @@ CPPFLAGS_vdso.lds += -P -C
VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 \
-z max-page-size=8192
-$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
+$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) $(vdsocheck) FORCE
$(call if_changed,vdso)
HOST_EXTRACFLAGS += -I$(srctree)/tools/include
@@ -99,7 +99,8 @@ $(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
$(obj)/vdso32.so.dbg: FORCE \
$(obj)/vdso32/vdso32.lds \
$(obj)/vdso32/vclock_gettime.o \
- $(obj)/vdso32/vdso-note.o
+ $(obj)/vdso32/vdso-note.o \
+ $(vdsocheck)
$(call if_changed,vdso)
#
diff --git a/arch/x86/entry/vdso/common/Makefile.include b/arch/x86/entry/vdso/common/Makefile.include
index 687b3d89b40d5..510d5e79857e6 100644
--- a/arch/x86/entry/vdso/common/Makefile.include
+++ b/arch/x86/entry/vdso/common/Makefile.include
@@ -71,7 +71,7 @@ quiet_cmd_vdso = VDSO $@
quiet_cmd_vdso_and_check = VDSO $@
cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check)
-$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds FORCE
+$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds $(vdsocheck) FORCE
$(call if_changed,vdso_and_check)
$(obj)/%.so: OBJCOPYFLAGS := -S --remove-section __ex_table
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 4133c790e71a9..ad84c0f604592 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -22,19 +22,6 @@ typedef struct user_i387_struct elf_fpregset_t;
#ifdef __i386__
-#define R_386_NONE 0
-#define R_386_32 1
-#define R_386_PC32 2
-#define R_386_GOT32 3
-#define R_386_PLT32 4
-#define R_386_COPY 5
-#define R_386_GLOB_DAT 6
-#define R_386_JMP_SLOT 7
-#define R_386_RELATIVE 8
-#define R_386_GOTOFF 9
-#define R_386_GOTPC 10
-#define R_386_NUM 11
-
/*
* These are used to set parameters in the core dumps.
*/
@@ -44,26 +31,6 @@ typedef struct user_i387_struct elf_fpregset_t;
#else
-/* x86-64 relocation types */
-#define R_X86_64_NONE 0 /* No reloc */
-#define R_X86_64_64 1 /* Direct 64 bit */
-#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
-#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
-#define R_X86_64_PLT32 4 /* 32 bit PLT address */
-#define R_X86_64_COPY 5 /* Copy symbol at runtime */
-#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
-#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
-#define R_X86_64_RELATIVE 8 /* Adjust by program base */
-#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
- offset to GOT */
-#define R_X86_64_32 10 /* Direct 32 bit zero extended */
-#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
-#define R_X86_64_16 12 /* Direct 16 bit zero extended */
-#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
-#define R_X86_64_8 14 /* Direct 8 bit sign extended */
-#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
-#define R_X86_64_PC64 24 /* Place relative 64-bit signed */
-
/*
* These are used to set parameters in the core dumps.
*/
diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h
index 22d0111b543b3..b768497d5ee19 100644
--- a/arch/x86/um/asm/elf.h
+++ b/arch/x86/um/asm/elf.h
@@ -12,19 +12,6 @@
#ifdef CONFIG_X86_32
-#define R_386_NONE 0
-#define R_386_32 1
-#define R_386_PC32 2
-#define R_386_GOT32 3
-#define R_386_PLT32 4
-#define R_386_COPY 5
-#define R_386_GLOB_DAT 6
-#define R_386_JMP_SLOT 7
-#define R_386_RELATIVE 8
-#define R_386_GOTOFF 9
-#define R_386_GOTPC 10
-#define R_386_NUM 11
-
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
@@ -72,26 +59,6 @@
#else
-/* x86-64 relocation types, taken from asm-x86_64/elf.h */
-#define R_X86_64_NONE 0 /* No reloc */
-#define R_X86_64_64 1 /* Direct 64 bit */
-#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
-#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
-#define R_X86_64_PLT32 4 /* 32 bit PLT address */
-#define R_X86_64_COPY 5 /* Copy symbol at runtime */
-#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
-#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
-#define R_X86_64_RELATIVE 8 /* Adjust by program base */
-#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
- offset to GOT */
-#define R_X86_64_32 10 /* Direct 32 bit zero extended */
-#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
-#define R_X86_64_16 12 /* Direct 16 bit zero extended */
-#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
-#define R_X86_64_8 14 /* Direct 8 bit sign extended */
-#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
-#define R_X86_64_PC64 24 /* Place relative 64-bit signed */
-
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
diff --git a/include/uapi/linux/elf-r.h b/include/uapi/linux/elf-r.h
new file mode 100644
index 0000000000000..a6a4d7643c5d7
--- /dev/null
+++ b/include/uapi/linux/elf-r.h
@@ -0,0 +1,705 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_ELF_R_H
+#define _UAPI_LINUX_ELF_R_H
+
+/* i386 relocation types */
+#define R_386_NONE 0
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GOT32 3
+#define R_386_PLT32 4
+#define R_386_COPY 5
+#define R_386_GLOB_DAT 6
+#define R_386_JMP_SLOT 7
+#define R_386_RELATIVE 8
+#define R_386_GOTOFF 9
+#define R_386_GOTPC 10
+#define R_386_NUM 11
+
+/* x86-64 relocation types */
+#define R_X86_64_NONE 0 /* No reloc */
+#define R_X86_64_64 1 /* Direct 64 bit */
+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
+#define R_X86_64_PLT32 4 /* 32 bit PLT address */
+#define R_X86_64_COPY 5 /* Copy symbol at runtime */
+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
+#define R_X86_64_RELATIVE 8 /* Adjust by program base */
+#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
+ offset to GOT */
+#define R_X86_64_32 10 /* Direct 32 bit zero extended */
+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
+#define R_X86_64_16 12 /* Direct 16 bit zero extended */
+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
+#define R_X86_64_8 14 /* Direct 8 bit sign extended */
+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
+#define R_X86_64_PC64 24 /* Place relative 64-bit signed */
+
+/* arm relocation types */
+#define R_ARM_NONE 0
+#define R_ARM_PC24 1
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+#define R_ARM_CALL 28
+#define R_ARM_JUMP24 29
+#define R_ARM_TARGET1 38
+#define R_ARM_V4BX 40
+#define R_ARM_PREL31 42
+#define R_ARM_MOVW_ABS_NC 43
+#define R_ARM_MOVT_ABS 44
+#define R_ARM_MOVW_PREL_NC 45
+#define R_ARM_MOVT_PREL 46
+#define R_ARM_ALU_PC_G0_NC 57
+#define R_ARM_ALU_PC_G1_NC 59
+#define R_ARM_LDR_PC_G2 63
+
+#define R_ARM_THM_CALL 10
+#define R_ARM_THM_JUMP24 30
+#define R_ARM_THM_MOVW_ABS_NC 47
+#define R_ARM_THM_MOVT_ABS 48
+#define R_ARM_THM_MOVW_PREL_NC 49
+#define R_ARM_THM_MOVT_PREL 50
+
+/* AArch64 static relocation types */
+
+/* Miscellaneous. */
+#define R_AARCH64_NONE 256
+
+/* Data. */
+#define R_AARCH64_ABS64 257
+#define R_AARCH64_ABS32 258
+#define R_AARCH64_ABS16 259
+#define R_AARCH64_PREL64 260
+#define R_AARCH64_PREL32 261
+#define R_AARCH64_PREL16 262
+
+/* Instructions. */
+#define R_AARCH64_MOVW_UABS_G0 263
+#define R_AARCH64_MOVW_UABS_G0_NC 264
+#define R_AARCH64_MOVW_UABS_G1 265
+#define R_AARCH64_MOVW_UABS_G1_NC 266
+#define R_AARCH64_MOVW_UABS_G2 267
+#define R_AARCH64_MOVW_UABS_G2_NC 268
+#define R_AARCH64_MOVW_UABS_G3 269
+
+#define R_AARCH64_MOVW_SABS_G0 270
+#define R_AARCH64_MOVW_SABS_G1 271
+#define R_AARCH64_MOVW_SABS_G2 272
+
+#define R_AARCH64_LD_PREL_LO19 273
+#define R_AARCH64_ADR_PREL_LO21 274
+#define R_AARCH64_ADR_PREL_PG_HI21 275
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
+#define R_AARCH64_ADD_ABS_LO12_NC 277
+#define R_AARCH64_LDST8_ABS_LO12_NC 278
+
+#define R_AARCH64_TSTBR14 279
+#define R_AARCH64_CONDBR19 280
+#define R_AARCH64_JUMP26 282
+#define R_AARCH64_CALL26 283
+#define R_AARCH64_LDST16_ABS_LO12_NC 284
+#define R_AARCH64_LDST32_ABS_LO12_NC 285
+#define R_AARCH64_LDST64_ABS_LO12_NC 286
+#define R_AARCH64_LDST128_ABS_LO12_NC 299
+
+#define R_AARCH64_MOVW_PREL_G0 287
+#define R_AARCH64_MOVW_PREL_G0_NC 288
+#define R_AARCH64_MOVW_PREL_G1 289
+#define R_AARCH64_MOVW_PREL_G1_NC 290
+#define R_AARCH64_MOVW_PREL_G2 291
+#define R_AARCH64_MOVW_PREL_G2_NC 292
+#define R_AARCH64_MOVW_PREL_G3 293
+
+#define R_AARCH64_RELATIVE 1027
+
+/* PowerPC relocations defined by the ABIs */
+#define R_PPC_NONE 0
+#define R_PPC_ADDR32 1 /* 32bit absolute address */
+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
+#define R_PPC_ADDR16 3 /* 16bit absolute address */
+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10 /* PC relative 26 bit */
+#define R_PPC_REL14 11 /* PC relative 16 bit */
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+
+/* PowerPC relocations defined for the TLS access ABI. */
+#define R_PPC_TLS 67 /* none (sym+add)@tls */
+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
+
+#define R_PPC_REL16 249
+#define R_PPC_REL16_LO 250
+#define R_PPC_REL16_HI 251
+#define R_PPC_REL16_HA 252
+
+/* keep this the last entry. */
+#define R_PPC_NUM 253
+
+/* PowerPC64 relocations defined by the ABIs */
+#define R_PPC64_NONE R_PPC_NONE
+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */
+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */
+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */
+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */
+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */
+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */
+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */
+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */
+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16 R_PPC_GOT16
+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
+
+#define R_PPC64_COPY R_PPC_COPY
+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32 R_PPC_UADDR32
+#define R_PPC64_UADDR16 R_PPC_UADDR16
+#define R_PPC64_REL32 R_PPC_REL32
+#define R_PPC64_PLT32 R_PPC_PLT32
+#define R_PPC64_PLTREL32 R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */
+#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */
+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */
+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */
+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */
+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */
+#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */
+#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */
+#define R_PPC64_PLT64 45 /* doubleword64 L + A. */
+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */
+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */
+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */
+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */
+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */
+#define R_PPC64_TOC 51 /* doubleword64 .TOC. */
+#define R_PPC64_PLTGOT16 52 /* half16* M + A. */
+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */
+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */
+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */
+
+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */
+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */
+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */
+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */
+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */
+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */
+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */
+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */
+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */
+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */
+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */
+
+/* PowerPC64 relocations defined for the TLS access ABI. */
+#define R_PPC64_TLS 67 /* none (sym+add)@tls */
+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
+#define R_PPC64_TLSGD 107
+#define R_PPC64_TLSLD 108
+#define R_PPC64_TOCSAVE 109
+
+#define R_PPC64_REL24_NOTOC 116
+#define R_PPC64_ENTRY 118
+
+#define R_PPC64_PCREL34 132
+#define R_PPC64_GOT_PCREL34 133
+
+#define R_PPC64_REL16 249
+#define R_PPC64_REL16_LO 250
+#define R_PPC64_REL16_HI 251
+#define R_PPC64_REL16_HA 252
+
+/* Keep this the last entry. */
+#define R_PPC64_NUM 253
+
+
+/*
+ * RISC-V relocation types
+ */
+
+/* Relocation types used by the dynamic linker */
+#define R_RISCV_NONE 0
+#define R_RISCV_32 1
+#define R_RISCV_64 2
+#define R_RISCV_RELATIVE 3
+#define R_RISCV_COPY 4
+#define R_RISCV_JUMP_SLOT 5
+#define R_RISCV_TLS_DTPMOD32 6
+#define R_RISCV_TLS_DTPMOD64 7
+#define R_RISCV_TLS_DTPREL32 8
+#define R_RISCV_TLS_DTPREL64 9
+#define R_RISCV_TLS_TPREL32 10
+#define R_RISCV_TLS_TPREL64 11
+#define R_RISCV_IRELATIVE 58
+
+/* Relocation types not used by the dynamic linker */
+#define R_RISCV_BRANCH 16
+#define R_RISCV_JAL 17
+#define R_RISCV_CALL 18
+#define R_RISCV_CALL_PLT 19
+#define R_RISCV_GOT_HI20 20
+#define R_RISCV_TLS_GOT_HI20 21
+#define R_RISCV_TLS_GD_HI20 22
+#define R_RISCV_PCREL_HI20 23
+#define R_RISCV_PCREL_LO12_I 24
+#define R_RISCV_PCREL_LO12_S 25
+#define R_RISCV_HI20 26
+#define R_RISCV_LO12_I 27
+#define R_RISCV_LO12_S 28
+#define R_RISCV_TPREL_HI20 29
+#define R_RISCV_TPREL_LO12_I 30
+#define R_RISCV_TPREL_LO12_S 31
+#define R_RISCV_TPREL_ADD 32
+#define R_RISCV_ADD8 33
+#define R_RISCV_ADD16 34
+#define R_RISCV_ADD32 35
+#define R_RISCV_ADD64 36
+#define R_RISCV_SUB8 37
+#define R_RISCV_SUB16 38
+#define R_RISCV_SUB32 39
+#define R_RISCV_SUB64 40
+#define R_RISCV_GNU_VTINHERIT 41
+#define R_RISCV_GNU_VTENTRY 42
+#define R_RISCV_ALIGN 43
+#define R_RISCV_RVC_BRANCH 44
+#define R_RISCV_RVC_JUMP 45
+#define R_RISCV_GPREL_I 47
+#define R_RISCV_GPREL_S 48
+#define R_RISCV_TPREL_I 49
+#define R_RISCV_TPREL_S 50
+#define R_RISCV_RELAX 51
+#define R_RISCV_SUB6 52
+#define R_RISCV_SET6 53
+#define R_RISCV_SET8 54
+#define R_RISCV_SET16 55
+#define R_RISCV_SET32 56
+#define R_RISCV_32_PCREL 57
+#define R_RISCV_PLT32 59
+#define R_RISCV_SET_ULEB128 60
+#define R_RISCV_SUB_ULEB128 61
+
+/* LoongArch relocation types used by the dynamic linker */
+#define R_LARCH_NONE 0
+#define R_LARCH_32 1
+#define R_LARCH_64 2
+#define R_LARCH_RELATIVE 3
+#define R_LARCH_COPY 4
+#define R_LARCH_JUMP_SLOT 5
+#define R_LARCH_TLS_DTPMOD32 6
+#define R_LARCH_TLS_DTPMOD64 7
+#define R_LARCH_TLS_DTPREL32 8
+#define R_LARCH_TLS_DTPREL64 9
+#define R_LARCH_TLS_TPREL32 10
+#define R_LARCH_TLS_TPREL64 11
+#define R_LARCH_IRELATIVE 12
+#define R_LARCH_MARK_LA 20
+#define R_LARCH_MARK_PCREL 21
+#define R_LARCH_SOP_PUSH_PCREL 22
+#define R_LARCH_SOP_PUSH_ABSOLUTE 23
+#define R_LARCH_SOP_PUSH_DUP 24
+#define R_LARCH_SOP_PUSH_GPREL 25
+#define R_LARCH_SOP_PUSH_TLS_TPREL 26
+#define R_LARCH_SOP_PUSH_TLS_GOT 27
+#define R_LARCH_SOP_PUSH_TLS_GD 28
+#define R_LARCH_SOP_PUSH_PLT_PCREL 29
+#define R_LARCH_SOP_ASSERT 30
+#define R_LARCH_SOP_NOT 31
+#define R_LARCH_SOP_SUB 32
+#define R_LARCH_SOP_SL 33
+#define R_LARCH_SOP_SR 34
+#define R_LARCH_SOP_ADD 35
+#define R_LARCH_SOP_AND 36
+#define R_LARCH_SOP_IF_ELSE 37
+#define R_LARCH_SOP_POP_32_S_10_5 38
+#define R_LARCH_SOP_POP_32_U_10_12 39
+#define R_LARCH_SOP_POP_32_S_10_12 40
+#define R_LARCH_SOP_POP_32_S_10_16 41
+#define R_LARCH_SOP_POP_32_S_10_16_S2 42
+#define R_LARCH_SOP_POP_32_S_5_20 43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
+#define R_LARCH_SOP_POP_32_U 46
+#define R_LARCH_ADD8 47
+#define R_LARCH_ADD16 48
+#define R_LARCH_ADD24 49
+#define R_LARCH_ADD32 50
+#define R_LARCH_ADD64 51
+#define R_LARCH_SUB8 52
+#define R_LARCH_SUB16 53
+#define R_LARCH_SUB24 54
+#define R_LARCH_SUB32 55
+#define R_LARCH_SUB64 56
+#define R_LARCH_GNU_VTINHERIT 57
+#define R_LARCH_GNU_VTENTRY 58
+#define R_LARCH_B16 64
+#define R_LARCH_B21 65
+#define R_LARCH_B26 66
+#define R_LARCH_ABS_HI20 67
+#define R_LARCH_ABS_LO12 68
+#define R_LARCH_ABS64_LO20 69
+#define R_LARCH_ABS64_HI12 70
+#define R_LARCH_PCALA_HI20 71
+#define R_LARCH_PCALA_LO12 72
+#define R_LARCH_PCALA64_LO20 73
+#define R_LARCH_PCALA64_HI12 74
+#define R_LARCH_GOT_PC_HI20 75
+#define R_LARCH_GOT_PC_LO12 76
+#define R_LARCH_GOT64_PC_LO20 77
+#define R_LARCH_GOT64_PC_HI12 78
+#define R_LARCH_GOT_HI20 79
+#define R_LARCH_GOT_LO12 80
+#define R_LARCH_GOT64_LO20 81
+#define R_LARCH_GOT64_HI12 82
+#define R_LARCH_TLS_LE_HI20 83
+#define R_LARCH_TLS_LE_LO12 84
+#define R_LARCH_TLS_LE64_LO20 85
+#define R_LARCH_TLS_LE64_HI12 86
+#define R_LARCH_TLS_IE_PC_HI20 87
+#define R_LARCH_TLS_IE_PC_LO12 88
+#define R_LARCH_TLS_IE64_PC_LO20 89
+#define R_LARCH_TLS_IE64_PC_HI12 90
+#define R_LARCH_TLS_IE_HI20 91
+#define R_LARCH_TLS_IE_LO12 92
+#define R_LARCH_TLS_IE64_LO20 93
+#define R_LARCH_TLS_IE64_HI12 94
+#define R_LARCH_TLS_LD_PC_HI20 95
+#define R_LARCH_TLS_LD_HI20 96
+#define R_LARCH_TLS_GD_PC_HI20 97
+#define R_LARCH_TLS_GD_HI20 98
+#define R_LARCH_32_PCREL 99
+#define R_LARCH_RELAX 100
+#define R_LARCH_DELETE 101
+#define R_LARCH_ALIGN 102
+#define R_LARCH_PCREL20_S2 103
+#define R_LARCH_CFA 104
+#define R_LARCH_ADD6 105
+#define R_LARCH_SUB6 106
+#define R_LARCH_ADD_ULEB128 107
+#define R_LARCH_SUB_ULEB128 108
+#define R_LARCH_64_PCREL 109
+#define R_LARCH_CALL36 110
+#define R_LARCH_TLS_DESC_PC_HI20 111
+#define R_LARCH_TLS_DESC_PC_LO12 112
+#define R_LARCH_TLS_DESC64_PC_LO20 113
+#define R_LARCH_TLS_DESC64_PC_HI12 114
+#define R_LARCH_TLS_DESC_HI20 115
+#define R_LARCH_TLS_DESC_LO12 116
+#define R_LARCH_TLS_DESC64_LO20 117
+#define R_LARCH_TLS_DESC64_HI12 118
+#define R_LARCH_TLS_DESC_LD 119
+#define R_LARCH_TLS_DESC_CALL 120
+#define R_LARCH_TLS_LE_HI20_R 121
+#define R_LARCH_TLS_LE_ADD_R 122
+#define R_LARCH_TLS_LE_LO12_R 123
+#define R_LARCH_TLS_LD_PCREL20_S2 124
+#define R_LARCH_TLS_GD_PCREL20_S2 125
+#define R_LARCH_TLS_DESC_PCREL20_S2 126
+#define R_LARCH_CALL30 127
+#define R_LARCH_PCADD_HI20 128
+#define R_LARCH_PCADD_LO12 129
+#define R_LARCH_GOT_PCADD_HI20 130
+#define R_LARCH_GOT_PCADD_LO12 131
+#define R_LARCH_TLS_IE_PCADD_HI20 132
+#define R_LARCH_TLS_IE_PCADD_LO12 133
+#define R_LARCH_TLS_LD_PCADD_HI20 134
+#define R_LARCH_TLS_LD_PCADD_LO12 135
+#define R_LARCH_TLS_GD_PCADD_HI20 136
+#define R_LARCH_TLS_GD_PCADD_LO12 137
+#define R_LARCH_TLS_DESC_PCADD_HI20 138
+#define R_LARCH_TLS_DESC_PCADD_LO12 139
+
+/* s390 relocations defined by the ABIs */
+#define R_390_NONE 0 /* No reloc. */
+#define R_390_8 1 /* Direct 8 bit. */
+#define R_390_12 2 /* Direct 12 bit. */
+#define R_390_16 3 /* Direct 16 bit. */
+#define R_390_32 4 /* Direct 32 bit. */
+#define R_390_PC32 5 /* PC relative 32 bit. */
+#define R_390_GOT12 6 /* 12 bit GOT offset. */
+#define R_390_GOT32 7 /* 32 bit GOT offset. */
+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
+#define R_390_COPY 9 /* Copy symbol at runtime. */
+#define R_390_GLOB_DAT 10 /* Create GOT entry. */
+#define R_390_JMP_SLOT 11 /* Create PLT entry. */
+#define R_390_RELATIVE 12 /* Adjust by program base. */
+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
+#define R_390_GOTPC 14 /* 32 bit PC rel. offset to GOT. */
+#define R_390_GOT16 15 /* 16 bit GOT offset. */
+#define R_390_PC16 16 /* PC relative 16 bit. */
+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
+#define R_390_64 22 /* Direct 64 bit. */
+#define R_390_PC64 23 /* PC relative 64 bit. */
+#define R_390_GOT64 24 /* 64 bit GOT offset. */
+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
+#define R_390_TLS_GDCALL 38 /* Tag for function call in general
+ dynamic TLS code. */
+#define R_390_TLS_LDCALL 39 /* Tag for function call in local
+ dynamic TLS code. */
+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
+ thread local data. */
+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
+ thread local data. */
+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
+ block offset. */
+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
+ block offset. */
+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
+ block offset. */
+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
+ thread local data in LD code. */
+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
+ thread local data in LD code. */
+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
+ negated static TLS block offset. */
+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
+ negated static TLS block offset. */
+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
+ negated static TLS block offset. */
+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
+ static TLS block. */
+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
+ static TLS block. */
+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
+ block. */
+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
+ block. */
+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
+#define R_390_TLS_TPOFF 56 /* Negate offset in static TLS
+ block. */
+#define R_390_20 57 /* Direct 20 bit. */
+#define R_390_GOT20 58 /* 20 bit GOT offset. */
+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
+ block offset. */
+/* Keep this the last entry. */
+#define R_390_NUM 61
+
+/* MIPS relocations defined by the ABIs */
+#define R_MIPS_NONE 0
+#define R_MIPS_16 1
+#define R_MIPS_32 2
+#define R_MIPS_REL32 3
+#define R_MIPS_26 4
+#define R_MIPS_HI16 5
+#define R_MIPS_LO16 6
+#define R_MIPS_GPREL16 7
+#define R_MIPS_LITERAL 8
+#define R_MIPS_GOT16 9
+#define R_MIPS_PC16 10
+#define R_MIPS_CALL16 11
+#define R_MIPS_GPREL32 12
+/* The remaining relocs are defined on Irix, although they are not
+ in the MIPS ELF ABI. */
+#define R_MIPS_UNUSED1 13
+#define R_MIPS_UNUSED2 14
+#define R_MIPS_UNUSED3 15
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
+#define R_MIPS_64 18
+#define R_MIPS_GOT_DISP 19
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+/*
+ * The following two relocation types are specified in the MIPS ABI
+ * conformance guide version 1.2 but not yet in the psABI.
+ */
+#define R_MIPS_GOTHI16 22
+#define R_MIPS_GOTLO16 23
+#define R_MIPS_SUB 24
+#define R_MIPS_INSERT_A 25
+#define R_MIPS_INSERT_B 26
+#define R_MIPS_DELETE 27
+#define R_MIPS_HIGHER 28
+#define R_MIPS_HIGHEST 29
+/*
+ * The following two relocation types are specified in the MIPS ABI
+ * conformance guide version 1.2 but not yet in the psABI.
+ */
+#define R_MIPS_CALLHI16 30
+#define R_MIPS_CALLLO16 31
+/*
+ * Introduced for MIPSr6.
+ */
+#define R_MIPS_PC21_S2 60
+#define R_MIPS_PC26_S2 61
+#define R_MIPS_PC18_S3 62
+#define R_MIPS_PC19_S2 63
+#define R_MIPS_PCHI16 64
+#define R_MIPS_PCLO16 65
+/*
+ * This range is reserved for vendor specific relocations.
+ */
+#define R_MIPS_LOVENDOR 100
+#define R_MIPS_HIVENDOR 127
+
+#define R_MIPS_PC32 248
+
+/*
+ * Sparc ELF relocation types
+ */
+#define R_SPARC_NONE 0
+#define R_SPARC_8 1
+#define R_SPARC_16 2
+#define R_SPARC_32 3
+#define R_SPARC_DISP8 4
+#define R_SPARC_DISP16 5
+#define R_SPARC_DISP32 6
+#define R_SPARC_WDISP30 7
+#define R_SPARC_WDISP22 8
+#define R_SPARC_HI22 9
+#define R_SPARC_22 10
+#define R_SPARC_13 11
+#define R_SPARC_LO10 12
+#define R_SPARC_GOT10 13
+#define R_SPARC_GOT13 14
+#define R_SPARC_GOT22 15
+#define R_SPARC_PC10 16
+#define R_SPARC_PC22 17
+#define R_SPARC_WPLT30 18
+#define R_SPARC_COPY 19
+#define R_SPARC_GLOB_DAT 20
+#define R_SPARC_JMP_SLOT 21
+#define R_SPARC_RELATIVE 22
+#define R_SPARC_UA32 23
+#define R_SPARC_PLT32 24
+#define R_SPARC_HIPLT22 25
+#define R_SPARC_LOPLT10 26
+#define R_SPARC_PCPLT32 27
+#define R_SPARC_PCPLT22 28
+#define R_SPARC_PCPLT10 29
+#define R_SPARC_10 30
+#define R_SPARC_11 31
+#define R_SPARC_64 32
+#define R_SPARC_OLO10 33
+#define R_SPARC_WDISP16 40
+#define R_SPARC_WDISP19 41
+#define R_SPARC_7 43
+#define R_SPARC_5 44
+#define R_SPARC_6 45
+#define R_SPARC_UA64 54
+
+#endif /* _UAPI_LINUX_ELF_R_H */
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index ee30dcd80901f..b3e312255552b 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/elf-em.h>
+#include <linux/elf-r.h>
/* 32-bit ELF base types. */
typedef __u32 Elf32_Addr;
diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
index 597f5f0f96819..12a640c78b72f 100644
--- a/lib/vdso/Kconfig
+++ b/lib/vdso/Kconfig
@@ -6,6 +6,7 @@ config VDSO_DATASTORE
config GENERIC_GETTIMEOFDAY
bool
select VDSO_DATASTORE
+ select VDSO_CHECK
help
This is a generic implementation of gettimeofday vdso.
Each architecture that enables this feature has to
@@ -21,5 +22,11 @@ config GENERIC_VDSO_OVERFLOW_PROTECT
config VDSO_GETRANDOM
bool
select VDSO_DATASTORE
+ select VDSO_CHECK
help
Selected by architectures that support vDSO getrandom().
+
+config VDSO_CHECK
+ bool
+ help
+ Selected for architectures that are supported by the 'vdsocheck' progam.
diff --git a/lib/vdso/Makefile b/lib/vdso/Makefile
index ac304def42d6d..9932b43d5bac0 100644
--- a/lib/vdso/Makefile
+++ b/lib/vdso/Makefile
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_VDSO_DATASTORE) += datastore.o
+
+obj-y += check/
diff --git a/lib/vdso/Makefile.include b/lib/vdso/Makefile.include
index cedbf15f80874..5528e548f02e9 100644
--- a/lib/vdso/Makefile.include
+++ b/lib/vdso/Makefile.include
@@ -6,6 +6,12 @@ GENERIC_VDSO_DIR := $(dir $(GENERIC_VDSO_MK_PATH))
c-gettimeofday-$(CONFIG_GENERIC_GETTIMEOFDAY) := $(addprefix $(GENERIC_VDSO_DIR), gettimeofday.c)
c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrandom.c)
+ifeq ($(CONFIG_RUST_IS_AVAILABLE)$(CONFIG_VDSO_CHECK),yy)
+vdsocheck := lib/vdso/check/vdsocheck
+else
+vdsocheck :=
+endif
+
# This cmd checks that the vdso library does not contain dynamic relocations.
# It has to be called after the linking of the vdso library and requires it
# as a parameter.
@@ -13,6 +19,14 @@ c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrand
# As a workaround for some GNU ld ports which produce unneeded R_*_NONE
# dynamic relocations, ignore R_*_NONE.
quiet_cmd_vdso_check = VDSOCHK $@
+ifneq ($(vdsocheck),)
+ cmd_vdso_check = $(vdsocheck) $(filter %.o, $(real-prereqs)) $@
+else
cmd_vdso_check = if $(READELF) -rW $@ | grep -v _NONE | grep -q " R_\w*_"; \
then (echo >&2 "$@: dynamic relocations are not supported"; \
rm -f $@; /bin/false); fi
+endif
+
+# Variant of cmd_ld which does not try to link the vdsocheck tool.
+quiet_cmd_ld_vdso = VDSOLD $@
+ cmd_ld_vdso = $(LD) $(ld_flags) $(filter-out $(vdsocheck), $(real-prereqs)) -o $@
diff --git a/lib/vdso/check/.gitignore b/lib/vdso/check/.gitignore
new file mode 100644
index 0000000000000..751be38f11f21
--- /dev/null
+++ b/lib/vdso/check/.gitignore
@@ -0,0 +1,3 @@
+/bindings.rs
+/libbindings.rlib
+/vdsocheck
diff --git a/lib/vdso/check/Makefile b/lib/vdso/check/Makefile
new file mode 100644
index 0000000000000..98de42c6c0ebe
--- /dev/null
+++ b/lib/vdso/check/Makefile
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+quiet_cmd_host_bindgen = HOSTBINDGEN $@
+ cmd_host_bindgen = $(BINDGEN) $< -o $@ --depfile $(depfile) -- $(HOSTBINDGEN_FLAGS)
+
+quiet_cmd_host_rustlib = HOSTRUSTC L $@
+ cmd_host_rustlib = \
+ $(HOSTRUSTC) $(hostrust_flags) \
+ --emit=dep-info=$(depfile) --emit=link=$@ \
+ --crate-type rlib \
+ --crate-name $(patsubst %.rlib,%,$(notdir $@)) $<
+
+uapi-directory := $(srctree)/tools/include/uapi
+
+# bindings.rs will be generated in the build directory, but rustc can not use
+# source code from both the source and build directory together.
+# Compile the binding code into a library first.
+$(obj)/bindings.rs: HOSTBINDGEN_FLAGS := -I$(uapi-directory)
+$(obj)/bindings.rs: $(uapi-directory)/linux/elf.h FORCE
+ $(call if_changed_dep,host_bindgen)
+
+HOSTRUSTFLAGS_libbindings := -Amissing_docs -Anon-camel-case-types
+$(obj)/libbindings.rlib: $(obj)/bindings.rs FORCE
+ $(call if_changed_dep,host_rustlib)
+
+targets += bindings.rs libbindings.rlib
+
+hostprogs += vdsocheck
+vdsocheck-rust := y
+HOSTRUSTFLAGS_vdsocheck := --extern=bindings=$(obj)/libbindings.rlib
+$(obj)/vdsocheck: $(obj)/libbindings.rlib
+
+PHONY += vdsocheck
+vdsocheck: $(obj)/vdsocheck
diff --git a/lib/vdso/check/elf.rs b/lib/vdso/check/elf.rs
new file mode 100644
index 0000000000000..520285d6fd10a
--- /dev/null
+++ b/lib/vdso/check/elf.rs
@@ -0,0 +1,498 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#![allow(unreachable_pub)]
+
+use core::fmt;
+use core::iter::Iterator;
+use core::result::Result;
+use core::str;
+
+use ::bindings;
+
+#[derive(Debug, Copy, Clone)]
+enum ByteOrder {
+ LittleEndian,
+ BigEndian,
+}
+
+trait ToCpu {
+ fn to_cpu(self, byteorder: ByteOrder) -> Self;
+}
+
+macro_rules! declare_to_cpu {
+ ($t:ty) => {
+ impl ToCpu for $t {
+ fn to_cpu(self, byteorder: ByteOrder) -> Self {
+ match byteorder {
+ ByteOrder::LittleEndian => Self::from_le(self),
+ ByteOrder::BigEndian => Self::from_be(self),
+ }
+ }
+ }
+ };
+}
+
+declare_to_cpu!(u16);
+declare_to_cpu!(u32);
+declare_to_cpu!(u64);
+
+#[derive(Debug, Copy, Clone)]
+enum Class {
+ Elf32,
+ Elf64,
+}
+
+enum ClassAlternative<T32, T64> {
+ Elf32(T32),
+ Elf64(T64),
+}
+
+#[derive(Debug)]
+pub enum ParseError {
+ InvalidFileMagic([u8; 4]),
+ InvalidFileClass(u32),
+ InvalidFileByteOrder(u32),
+ InvalidSectionSize,
+ MissingStringTable,
+ StrtabIndexOutOfRange,
+ IndexOutOfRange,
+ StrtabInvalidData(str::Utf8Error),
+}
+
+pub type ParseResult<T> = Result<T, ParseError>;
+
+impl fmt::Display for ParseError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ ParseError::InvalidFileMagic(m) => write!(f, "Invalid ELF magic {:?}", m),
+ ParseError::InvalidFileClass(c) => write!(f, "Invalid ELF class {}", c),
+ ParseError::InvalidFileByteOrder(b) => write!(f, "Invalid ELF byteorder {}", b),
+ ParseError::InvalidSectionSize => write!(f, "Invalid ELF section size"),
+ ParseError::MissingStringTable => write!(f, "Missing string table"),
+ ParseError::IndexOutOfRange => write!(f, "Index out of range"),
+ ParseError::StrtabIndexOutOfRange => write!(f, "String table index out of range"),
+ ParseError::StrtabInvalidData(e) => write!(f, "Invalid data in string table: {}", e),
+ }
+ }
+}
+
+fn read_from_bytes<T: Copy>(data: &[u8]) -> ParseResult<T> {
+ if data.len() < core::mem::size_of::<T>() {
+ Err(ParseError::IndexOutOfRange)?
+ }
+ let ptr = data.as_ptr() as *const T;
+ // SAFETY: `T` is `Copy` by the type constraints.
+ // `ptr` is valid as it is derived from the slice `data` above.
+ // `self.data.len()` being large enough is guaranteed by the runtime check above.
+ Ok(unsafe { ptr.read_unaligned() })
+}
+
+fn get_data_subslice(data: &[u8], offset: u64, size: u64) -> ParseResult<&[u8]> {
+ let start: usize = offset.try_into().map_err(|_| ParseError::IndexOutOfRange)?;
+ let size: usize = size.try_into().map_err(|_| ParseError::IndexOutOfRange)?;
+ let end = start.checked_add(size).ok_or(ParseError::IndexOutOfRange)?;
+
+ Ok(&data[start..end])
+}
+
+/// Representation of a complete ELF file.
+#[derive(Debug)]
+pub struct File<'a> {
+ byteorder: ByteOrder,
+ class: Class,
+ pub type_: u16,
+ pub machine: u16,
+ pub data: &'a [u8],
+ section_headers: SectionInfo<'a>,
+ section_names: StrtabSection<'a>,
+}
+
+impl<'a> File<'a> {
+ pub fn new_from_bytes(data: &'a [u8]) -> Result<Self, ParseError> {
+ const ELF_MAGIC: [u8; 4] = [
+ bindings::ELFMAG0 as u8,
+ bindings::ELFMAG1 as u8,
+ bindings::ELFMAG2 as u8,
+ bindings::ELFMAG3 as u8,
+ ];
+ let ehdr: bindings::elf32_hdr = read_from_bytes(data)?;
+
+ let magic = [
+ ehdr.e_ident[bindings::EI_MAG0 as usize],
+ ehdr.e_ident[bindings::EI_MAG1 as usize],
+ ehdr.e_ident[bindings::EI_MAG2 as usize],
+ ehdr.e_ident[bindings::EI_MAG3 as usize],
+ ];
+
+ if magic != ELF_MAGIC {
+ return Err(ParseError::InvalidFileMagic(magic));
+ }
+
+ let class = match ehdr.e_ident[bindings::EI_CLASS as usize] as u32 {
+ bindings::ELFCLASS32 => Class::Elf32,
+ bindings::ELFCLASS64 => Class::Elf64,
+ c => return Err(ParseError::InvalidFileClass(c)),
+ };
+
+ let byteorder = match ehdr.e_ident[bindings::EI_DATA as usize] as u32 {
+ bindings::ELFDATA2LSB => ByteOrder::LittleEndian,
+ bindings::ELFDATA2MSB => ByteOrder::BigEndian,
+ b => return Err(ParseError::InvalidFileByteOrder(b)),
+ };
+
+ let (type_, machine, shnum, shoff, shentsize, shstrndx) = match class {
+ Class::Elf32 => {
+ let ehdr: bindings::elf32_hdr = read_from_bytes(data)?;
+ (
+ ehdr.e_type.to_cpu(byteorder),
+ ehdr.e_machine.to_cpu(byteorder),
+ ehdr.e_shnum.to_cpu(byteorder),
+ ehdr.e_shoff.to_cpu(byteorder).into(),
+ ehdr.e_shentsize.to_cpu(byteorder),
+ ehdr.e_shstrndx.to_cpu(byteorder),
+ )
+ }
+ Class::Elf64 => {
+ let ehdr: bindings::elf64_hdr = read_from_bytes(data)?;
+ (
+ ehdr.e_type.to_cpu(byteorder),
+ ehdr.e_machine.to_cpu(byteorder),
+ ehdr.e_shnum.to_cpu(byteorder),
+ ehdr.e_shoff.to_cpu(byteorder),
+ ehdr.e_shentsize.to_cpu(byteorder),
+ ehdr.e_shstrndx.to_cpu(byteorder),
+ )
+ }
+ };
+
+ let section_headers = SectionInfo {
+ byteorder,
+ class,
+ entsize: shentsize.into(),
+ data: get_data_subslice(data, shoff, u64::from(shnum) * u64::from(shentsize))?,
+ name: "<section headers>",
+ };
+
+ let string_table = SectionHeaderIterator::new(§ion_headers, data)?
+ .nth(shstrndx.into())
+ .ok_or(ParseError::MissingStringTable)??;
+
+ let section_names = StrtabSection(SectionInfo {
+ name: "<section header names>",
+ byteorder,
+ class,
+ data: string_table.data,
+ entsize: string_table.entsize,
+ });
+
+ Ok(File {
+ byteorder,
+ class,
+ type_,
+ machine,
+ section_headers,
+ section_names,
+ data,
+ })
+ }
+
+ pub fn sections(&self) -> ParseResult<SectionIterator<'_>> {
+ Ok(SectionIterator {
+ file: self,
+ section_headers: SectionHeaderIterator::new(&self.section_headers, self.data)?,
+ })
+ }
+}
+
+/// High-level representation of an ELF section.
+#[derive(Clone, Debug)]
+pub struct SectionInfo<'a> {
+ byteorder: ByteOrder,
+ class: Class,
+ pub name: &'a str,
+ entsize: u64,
+ pub data: &'a [u8],
+}
+
+/// Typed high-level iterator over all sections in a `File`.
+#[derive(Debug)]
+pub enum Section<'a> {
+ Null(SectionInfo<'a>),
+ Rel(RelSection<'a>),
+ Rela(RelaSection<'a>),
+ Strtab(StrtabSection<'a>),
+ Unknown(SectionInfo<'a>),
+}
+
+impl<'a> Section<'a> {
+ pub fn info(&'a self) -> &'a SectionInfo<'a> {
+ match self {
+ Section::Null(info) | Section::Unknown(info) => info,
+ Section::Rel(rel) => &rel.0,
+ Section::Rela(rela) => &rela.0,
+ Section::Strtab(strtab) => &strtab.0,
+ }
+ }
+}
+
+pub struct SectionIterator<'a> {
+ file: &'a File<'a>,
+ section_headers: SectionHeaderIterator<'a, 'a>,
+}
+
+impl<'a> Iterator for SectionIterator<'a> {
+ type Item = ParseResult<Section<'a>>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.section_headers.next().map(|header| {
+ let header = header?;
+ let info = SectionInfo {
+ byteorder: self.file.byteorder,
+ class: self.file.class,
+ name: self.file.section_names.entry(header.name)?,
+ entsize: header.entsize,
+ data: header.data,
+ };
+
+ Ok(match header.type_ {
+ bindings::SHT_NULL => Section::Null(info),
+ bindings::SHT_RELA => Section::Rela(RelaSection(info)),
+ bindings::SHT_REL => Section::Rel(RelSection(info)),
+ bindings::SHT_STRTAB => Section::Strtab(StrtabSection(info)),
+ _ => Section::Unknown(info),
+ })
+ })
+ }
+}
+
+/// Iterator over a section of data containing instances of type `T`.
+struct SectionEntityIterator<'a, T: Copy> {
+ data: &'a [u8],
+ byteorder: ByteOrder,
+ _phantom: core::marker::PhantomData<T>,
+}
+
+impl<'a, T: Copy> SectionEntityIterator<'a, T> {
+ const ENTITY_SIZE: usize = core::mem::size_of::<T>();
+
+ fn new(section: &'a SectionInfo<'a>) -> ParseResult<Self> {
+ let data = section.data;
+
+ if section.entsize != Self::ENTITY_SIZE as u64 {
+ return Err(ParseError::InvalidSectionSize);
+ }
+
+ if !data.len().is_multiple_of(Self::ENTITY_SIZE) {
+ return Err(ParseError::InvalidSectionSize);
+ }
+
+ Ok(Self {
+ data,
+ byteorder: section.byteorder,
+ _phantom: core::marker::PhantomData,
+ })
+ }
+}
+
+impl<'a, T: Copy> Iterator for SectionEntityIterator<'a, T> {
+ type Item = T;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ if self.data.len() != 0 {
+ let ptr = self.data.as_ptr() as *const T;
+ // SAFETY: `T` is `Copy` by the type constraints.
+ // `ptr` is valid as it is derived from the slice `data` above.
+ // `self.data.len()` being a multiple of `Self::ENTITY_SIZE` is
+ // guaranteed by `SectionEntityIterator::new`.
+ let entity: T = unsafe { ptr.read_unaligned() };
+ self.data = &self.data[Self::ENTITY_SIZE..];
+ Some(entity)
+ } else {
+ None
+ }
+ }
+}
+
+/// Class-independent representation of an entry in a section header table.
+#[derive(Debug)]
+struct SectionHeader<'a> {
+ name: u32,
+ type_: u32,
+ entsize: u64,
+ data: &'a [u8],
+}
+
+/// Iterator over the section header table.
+struct SectionHeaderIterator<'f: 'a, 'a>(
+ ClassAlternative<
+ SectionEntityIterator<'a, bindings::elf32_shdr>,
+ SectionEntityIterator<'a, bindings::elf64_shdr>,
+ >,
+ &'f [u8],
+);
+
+impl<'f: 'a, 'a> SectionHeaderIterator<'f, 'a> {
+ fn new(section: &'a SectionInfo<'a>, file_data: &'f [u8]) -> ParseResult<Self> {
+ Ok(Self(
+ match section.class {
+ Class::Elf32 => ClassAlternative::Elf32(SectionEntityIterator::new(section)?),
+ Class::Elf64 => ClassAlternative::Elf64(SectionEntityIterator::new(section)?),
+ },
+ file_data,
+ ))
+ }
+}
+
+impl<'f: 'a, 'a> Iterator for SectionHeaderIterator<'f, 'a> {
+ type Item = ParseResult<SectionHeader<'f>>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ let file_data = self.1;
+
+ match &mut self.0 {
+ ClassAlternative::Elf32(iter) => iter.next().map(|n| {
+ Ok(SectionHeader {
+ name: n.sh_name.to_cpu(iter.byteorder).into(),
+ type_: n.sh_type.to_cpu(iter.byteorder).into(),
+ entsize: n.sh_entsize.to_cpu(iter.byteorder).into(),
+ data: get_data_subslice(
+ file_data,
+ n.sh_offset.to_cpu(iter.byteorder).into(),
+ n.sh_size.to_cpu(iter.byteorder).into(),
+ )?,
+ })
+ }),
+ ClassAlternative::Elf64(iter) => iter.next().map(|n| {
+ Ok(SectionHeader {
+ name: n.sh_name.to_cpu(iter.byteorder).into(),
+ type_: n.sh_type.to_cpu(iter.byteorder).into(),
+ entsize: n.sh_entsize.to_cpu(iter.byteorder).into(),
+ data: get_data_subslice(
+ file_data,
+ n.sh_offset.to_cpu(iter.byteorder).into(),
+ n.sh_size.to_cpu(iter.byteorder).into(),
+ )?,
+ })
+ }),
+ }
+ }
+}
+
+/// High-level interface to a SHT_STRTAB string table.
+#[derive(Debug)]
+pub struct StrtabSection<'a>(SectionInfo<'a>);
+
+impl<'a> StrtabSection<'a> {
+ pub fn entry(&'a self, index: u32) -> ParseResult<&'a str> {
+ let data = self.0.data;
+ let index = index as usize;
+
+ if index >= data.len() {
+ Err(ParseError::StrtabIndexOutOfRange)
+ } else {
+ let len = data[index..]
+ .iter()
+ .position(|b| *b == 0x00)
+ .ok_or(ParseError::StrtabIndexOutOfRange)?;
+ let s = str::from_utf8(&data[index..index + len])
+ .map_err(|e| ParseError::StrtabInvalidData(e))?;
+ Ok(s)
+ }
+ }
+}
+
+/// High-level interface to a SHT_REL relocation table.
+#[derive(Debug)]
+pub struct RelSection<'a>(SectionInfo<'a>);
+
+impl<'a> RelSection<'a> {
+ pub fn entries(&'a self) -> ParseResult<RelSectionIterator<'a>> {
+ RelSectionIterator::new(&self.0)
+ }
+}
+
+#[derive(Debug)]
+pub struct Rel {
+ pub type_: u32,
+}
+
+pub struct RelSectionIterator<'a>(
+ ClassAlternative<
+ SectionEntityIterator<'a, bindings::elf32_rel>,
+ SectionEntityIterator<'a, bindings::elf64_rel>,
+ >,
+);
+
+impl<'a> RelSectionIterator<'a> {
+ fn new(section: &'a SectionInfo<'a>) -> ParseResult<Self> {
+ Ok(Self(match section.class {
+ Class::Elf32 => ClassAlternative::Elf32(SectionEntityIterator::new(section)?),
+ Class::Elf64 => ClassAlternative::Elf64(SectionEntityIterator::new(section)?),
+ }))
+ }
+}
+
+impl<'a> Iterator for RelSectionIterator<'a> {
+ type Item = Rel;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ match &mut self.0 {
+ ClassAlternative::Elf32(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) & 0xff;
+ Self::Item { type_ }
+ }),
+ ClassAlternative::Elf64(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) as u32;
+ Self::Item { type_ }
+ }),
+ }
+ }
+}
+
+/// High-level interface to a SHT_RELA relocation table.
+#[derive(Debug)]
+pub struct RelaSection<'a>(SectionInfo<'a>);
+
+impl<'a> RelaSection<'a> {
+ pub fn entries(&'a self) -> ParseResult<RelaSectionIterator<'a>> {
+ RelaSectionIterator::new(&self.0)
+ }
+}
+
+#[derive(Debug)]
+pub struct Rela {
+ pub type_: u32,
+}
+
+pub struct RelaSectionIterator<'a>(
+ ClassAlternative<
+ SectionEntityIterator<'a, bindings::elf32_rela>,
+ SectionEntityIterator<'a, bindings::elf64_rela>,
+ >,
+);
+
+impl<'a> RelaSectionIterator<'a> {
+ fn new(section: &'a SectionInfo<'a>) -> ParseResult<Self> {
+ Ok(Self(match section.class {
+ Class::Elf32 => ClassAlternative::Elf32(SectionEntityIterator::new(section)?),
+ Class::Elf64 => ClassAlternative::Elf64(SectionEntityIterator::new(section)?),
+ }))
+ }
+}
+
+impl<'a> Iterator for RelaSectionIterator<'a> {
+ type Item = Rela;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ match &mut self.0 {
+ ClassAlternative::Elf32(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) & 0xff;
+ Self::Item { type_ }
+ }),
+ ClassAlternative::Elf64(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) as u32;
+ Self::Item { type_ }
+ }),
+ }
+ }
+}
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
new file mode 100644
index 0000000000000..0d3b47bf57e1f
--- /dev/null
+++ b/lib/vdso/check/vdsocheck.rs
@@ -0,0 +1,299 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! vDSO build-time validation
+//!
+//! Check that the vDSO library does not contain dynamic relocations.
+
+use std::default::Default;
+use std::fmt;
+use std::fs;
+use std::option::Option;
+use std::process;
+
+use ::bindings;
+
+mod elf;
+
+#[derive(Default)]
+struct AllowedRelocations<'a> {
+ ignored_object_file_sections: &'a [&'a str],
+ in_object_file: &'a [u32],
+}
+
+impl<'a> AllowedRelocations<'a> {
+ fn is_ignored_section(&self, section: &elf::Section<'_>) -> bool {
+ let name = section.info().name;
+
+ if name.starts_with(".rel.debug_") || name.starts_with(".rela.debug_") {
+ true
+ } else {
+ self.ignored_object_file_sections.contains(&name)
+ }
+ }
+}
+
+fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'static>> {
+ match machine as u32 {
+ bindings::EM_386 => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_386_PC32,
+ bindings::R_386_GOTOFF,
+ bindings::R_386_GOTPC,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_X86_64 => AllowedRelocations {
+ in_object_file: &[bindings::R_X86_64_PC32, bindings::R_X86_64_PLT32],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_ARM => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_ARM_NONE,
+ bindings::R_ARM_REL32,
+ bindings::R_ARM_PREL31,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_AARCH64 => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_AARCH64_PREL64,
+ bindings::R_AARCH64_PREL32,
+ bindings::R_AARCH64_PREL16,
+ bindings::R_AARCH64_LD_PREL_LO19,
+ bindings::R_AARCH64_ADR_PREL_LO21,
+ bindings::R_AARCH64_CALL26,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_PPC => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_PPC_REL24,
+ bindings::R_PPC_REL14,
+ bindings::R_PPC_REL32,
+ bindings::R_PPC_REL16,
+ bindings::R_PPC_REL16_LO,
+ bindings::R_PPC_REL16_HI,
+ bindings::R_PPC_REL16_HA,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_PPC64 => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_PPC64_REL24,
+ bindings::R_PPC64_REL14,
+ bindings::R_PPC64_REL32,
+ bindings::R_PPC64_REL64,
+ bindings::R_PPC64_REL16,
+ bindings::R_PPC64_REL16_LO,
+ bindings::R_PPC64_REL16_HI,
+ bindings::R_PPC64_REL16_HA,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_RISCV => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_RISCV_BRANCH,
+ bindings::R_RISCV_JAL,
+ bindings::R_RISCV_CALL,
+ bindings::R_RISCV_CALL_PLT,
+ bindings::R_RISCV_PCREL_HI20,
+ bindings::R_RISCV_PCREL_LO12_I,
+ bindings::R_RISCV_PCREL_LO12_S,
+ bindings::R_RISCV_ADD8,
+ bindings::R_RISCV_ADD16,
+ bindings::R_RISCV_ADD32,
+ bindings::R_RISCV_ADD64,
+ bindings::R_RISCV_SUB8,
+ bindings::R_RISCV_SUB16,
+ bindings::R_RISCV_SUB32,
+ bindings::R_RISCV_SUB64,
+ bindings::R_RISCV_ALIGN,
+ bindings::R_RISCV_RVC_BRANCH,
+ bindings::R_RISCV_RVC_JUMP,
+ bindings::R_RISCV_RELAX,
+ bindings::R_RISCV_32_PCREL,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_LOONGARCH => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_LARCH_ADD8,
+ bindings::R_LARCH_ADD16,
+ bindings::R_LARCH_ADD24,
+ bindings::R_LARCH_ADD32,
+ bindings::R_LARCH_ADD64,
+ bindings::R_LARCH_SUB8,
+ bindings::R_LARCH_SUB16,
+ bindings::R_LARCH_SUB24,
+ bindings::R_LARCH_SUB32,
+ bindings::R_LARCH_SUB64,
+ bindings::R_LARCH_B16,
+ bindings::R_LARCH_B21,
+ bindings::R_LARCH_B26,
+ bindings::R_LARCH_PCALA_HI20,
+ bindings::R_LARCH_PCALA_LO12,
+ bindings::R_LARCH_PCALA64_LO20,
+ bindings::R_LARCH_PCALA64_HI12,
+ bindings::R_LARCH_32_PCREL,
+ bindings::R_LARCH_PCADD_HI20,
+ bindings::R_LARCH_PCADD_LO12,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_S390 => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_390_PC32,
+ bindings::R_390_PC32DBL,
+ bindings::R_390_PLT32DBL,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_MIPS => AllowedRelocations {
+ ignored_object_file_sections: &[".rel.pdr", ".rela.pdr"],
+ in_object_file: &[
+ bindings::R_MIPS_PC16,
+ bindings::R_MIPS_PC21_S2,
+ bindings::R_MIPS_PC26_S2,
+ bindings::R_MIPS_PC18_S3,
+ bindings::R_MIPS_PC19_S2,
+ bindings::R_MIPS_PCHI16,
+ bindings::R_MIPS_PCLO16,
+ bindings::R_MIPS_PC32,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_SPARC | bindings::EM_SPARC32PLUS | bindings::EM_SPARCV9 => {
+ AllowedRelocations {
+ in_object_file: &[bindings::R_SPARC_DISP32],
+ ..Default::default()
+ }
+ .into()
+ }
+ _ => None,
+ }
+}
+
+#[derive(Debug)]
+enum ValidationError<'a> {
+ ParseError(elf::ParseError),
+ UnsupportedArchitecture(u16),
+ UnrecognizedElfFileType(u32),
+ UnexpectedSection(elf::Section<'a>),
+ InvalidRelocation(elf::Section<'a>, u32),
+}
+
+impl<'a> From<elf::ParseError> for ValidationError<'a> {
+ fn from(parse_error: elf::ParseError) -> Self {
+ Self::ParseError(parse_error)
+ }
+}
+
+impl fmt::Display for ValidationError<'_> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ ValidationError::ParseError(e) => write!(f, "Parsing error: {}", e),
+ ValidationError::UnsupportedArchitecture(n) => {
+ write!(f, "Unsupported ELF architecture {}", n)
+ }
+ ValidationError::UnrecognizedElfFileType(t) => {
+ write!(f, "Unrecognized ELF file type {}", t)
+ }
+ ValidationError::UnexpectedSection(ref s) => {
+ write!(f, "Unexpected section '{}'", s.info().name)
+ }
+ ValidationError::InvalidRelocation(ref s, t) => {
+ write!(f, "Invalid relocation {} in section '{}'", t, s.info().name)
+ }
+ }
+ }
+}
+
+type ValidationResult<'a> = Result<(), ValidationError<'a>>;
+
+fn validate_linked_dso<'a>(file: &'a elf::File<'a>) -> ValidationResult<'a> {
+ for section in file.sections()? {
+ let section = section?;
+
+ /* No relocations are allowed */
+ match section {
+ elf::Section::Rel(_) | elf::Section::Rela(_) => {
+ return Err(ValidationError::UnexpectedSection(section))
+ }
+ _ => {}
+ }
+ }
+
+ Ok(())
+}
+
+fn validate_object_file<'a>(file: &'a elf::File<'a>) -> ValidationResult<'a> {
+ let allowed_relocs = allowed_relocations_for_machine(file.machine)
+ .ok_or(ValidationError::UnsupportedArchitecture(file.machine))?;
+
+ for section in file.sections()? {
+ let section = section?;
+
+ if allowed_relocs.is_ignored_section(§ion) {
+ continue;
+ }
+
+ match section {
+ elf::Section::Rel(ref rel) => {
+ for entry in rel.entries()? {
+ if !allowed_relocs.in_object_file.contains(&entry.type_) {
+ return Err(ValidationError::InvalidRelocation(section, entry.type_));
+ }
+ }
+ }
+ elf::Section::Rela(ref rela) => {
+ for entry in rela.entries()? {
+ if !allowed_relocs.in_object_file.contains(&entry.type_) {
+ return Err(ValidationError::InvalidRelocation(section, entry.type_));
+ }
+ }
+ }
+ _ => {}
+ };
+ }
+
+ Ok(())
+}
+
+fn main() {
+ let mut args = std::env::args_os();
+
+ let program_name = args.next().unwrap_or("vdsocheck".into());
+
+ for path in args {
+ let data = fs::read(&path).unwrap_or_else(|err| {
+ println!("{}: {}: {}", program_name.display(), path.display(), err);
+ process::exit(1);
+ });
+
+ let file = elf::File::new_from_bytes(&data).unwrap_or_else(|err| {
+ println!("{}: {}: {}", program_name.display(), path.display(), err);
+ process::exit(2);
+ });
+
+ let result = match file.type_ as u32 {
+ bindings::ET_DYN => validate_linked_dso(&file),
+ bindings::ET_REL => validate_object_file(&file),
+ t => Err(ValidationError::UnrecognizedElfFileType(t)),
+ };
+
+ result.unwrap_or_else(|err| {
+ println!("{}: {}: {}", program_name.display(), path.display(), err);
+ process::exit(3);
+ });
+ }
+}
diff --git a/tools/include/uapi/linux/elf-em.h b/tools/include/uapi/linux/elf-em.h
new file mode 100644
index 0000000000000..ef38c2bc5ab7a
--- /dev/null
+++ b/tools/include/uapi/linux/elf-em.h
@@ -0,0 +1,71 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _LINUX_ELF_EM_H
+#define _LINUX_ELF_EM_H
+
+/* These constants define the various ELF target machines */
+#define EM_NONE 0
+#define EM_M32 1
+#define EM_SPARC 2
+#define EM_386 3
+#define EM_68K 4
+#define EM_88K 5
+#define EM_486 6 /* Perhaps disused */
+#define EM_860 7
+#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
+ /* Next two are historical and binaries and
+ modules of these types will be rejected by
+ Linux. */
+#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
+
+#define EM_PARISC 15 /* HPPA */
+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
+#define EM_PPC 20 /* PowerPC */
+#define EM_PPC64 21 /* PowerPC64 */
+#define EM_SPU 23 /* Cell BE SPU */
+#define EM_ARM 40 /* ARM 32 bit */
+#define EM_SH 42 /* SuperH */
+#define EM_SPARCV9 43 /* SPARC v9 64-bit */
+#define EM_H8_300 46 /* Renesas H8/300 */
+#define EM_IA_64 50 /* HP/Intel IA-64 */
+#define EM_X86_64 62 /* AMD x86-64 */
+#define EM_S390 22 /* IBM S/390 */
+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
+#define EM_M32R 88 /* Renesas M32R */
+#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
+#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
+#define EM_ARCOMPACT 93 /* ARCompact processor */
+#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
+#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
+#define EM_UNICORE 110 /* UniCore-32 */
+#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */
+#define EM_TI_C6000 140 /* TI C6X DSPs */
+#define EM_HEXAGON 164 /* QUALCOMM Hexagon */
+#define EM_NDS32 167 /* Andes Technology compact code size
+ embedded RISC processor family */
+#define EM_AARCH64 183 /* ARM 64 bit */
+#define EM_TILEPRO 188 /* Tilera TILEPro */
+#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze */
+#define EM_TILEGX 191 /* Tilera TILE-Gx */
+#define EM_ARCV2 195 /* ARCv2 Cores */
+#define EM_RISCV 243 /* RISC-V */
+#define EM_BPF 247 /* Linux BPF - in-kernel virtual machine */
+#define EM_CSKY 252 /* C-SKY */
+#define EM_LOONGARCH 258 /* LoongArch */
+#define EM_FRV 0x5441 /* Fujitsu FR-V */
+
+/*
+ * This is an interim value that we will use until the committee comes
+ * up with a final number.
+ */
+#define EM_ALPHA 0x9026
+
+/* Bogus old m32r magic number, used by old tools. */
+#define EM_CYGNUS_M32R 0x9041
+/* This is the old interim value for S/390 architecture */
+#define EM_S390_OLD 0xA390
+/* Also Panasonic/MEI MN10300, AM33 */
+#define EM_CYGNUS_MN10300 0xbeef
+
+
+#endif /* _LINUX_ELF_EM_H */
diff --git a/tools/include/uapi/linux/elf-r.h b/tools/include/uapi/linux/elf-r.h
new file mode 100644
index 0000000000000..a6a4d7643c5d7
--- /dev/null
+++ b/tools/include/uapi/linux/elf-r.h
@@ -0,0 +1,705 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_ELF_R_H
+#define _UAPI_LINUX_ELF_R_H
+
+/* i386 relocation types */
+#define R_386_NONE 0
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GOT32 3
+#define R_386_PLT32 4
+#define R_386_COPY 5
+#define R_386_GLOB_DAT 6
+#define R_386_JMP_SLOT 7
+#define R_386_RELATIVE 8
+#define R_386_GOTOFF 9
+#define R_386_GOTPC 10
+#define R_386_NUM 11
+
+/* x86-64 relocation types */
+#define R_X86_64_NONE 0 /* No reloc */
+#define R_X86_64_64 1 /* Direct 64 bit */
+#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
+#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
+#define R_X86_64_PLT32 4 /* 32 bit PLT address */
+#define R_X86_64_COPY 5 /* Copy symbol at runtime */
+#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
+#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
+#define R_X86_64_RELATIVE 8 /* Adjust by program base */
+#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
+ offset to GOT */
+#define R_X86_64_32 10 /* Direct 32 bit zero extended */
+#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
+#define R_X86_64_16 12 /* Direct 16 bit zero extended */
+#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
+#define R_X86_64_8 14 /* Direct 8 bit sign extended */
+#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
+#define R_X86_64_PC64 24 /* Place relative 64-bit signed */
+
+/* arm relocation types */
+#define R_ARM_NONE 0
+#define R_ARM_PC24 1
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+#define R_ARM_CALL 28
+#define R_ARM_JUMP24 29
+#define R_ARM_TARGET1 38
+#define R_ARM_V4BX 40
+#define R_ARM_PREL31 42
+#define R_ARM_MOVW_ABS_NC 43
+#define R_ARM_MOVT_ABS 44
+#define R_ARM_MOVW_PREL_NC 45
+#define R_ARM_MOVT_PREL 46
+#define R_ARM_ALU_PC_G0_NC 57
+#define R_ARM_ALU_PC_G1_NC 59
+#define R_ARM_LDR_PC_G2 63
+
+#define R_ARM_THM_CALL 10
+#define R_ARM_THM_JUMP24 30
+#define R_ARM_THM_MOVW_ABS_NC 47
+#define R_ARM_THM_MOVT_ABS 48
+#define R_ARM_THM_MOVW_PREL_NC 49
+#define R_ARM_THM_MOVT_PREL 50
+
+/* AArch64 static relocation types */
+
+/* Miscellaneous. */
+#define R_AARCH64_NONE 256
+
+/* Data. */
+#define R_AARCH64_ABS64 257
+#define R_AARCH64_ABS32 258
+#define R_AARCH64_ABS16 259
+#define R_AARCH64_PREL64 260
+#define R_AARCH64_PREL32 261
+#define R_AARCH64_PREL16 262
+
+/* Instructions. */
+#define R_AARCH64_MOVW_UABS_G0 263
+#define R_AARCH64_MOVW_UABS_G0_NC 264
+#define R_AARCH64_MOVW_UABS_G1 265
+#define R_AARCH64_MOVW_UABS_G1_NC 266
+#define R_AARCH64_MOVW_UABS_G2 267
+#define R_AARCH64_MOVW_UABS_G2_NC 268
+#define R_AARCH64_MOVW_UABS_G3 269
+
+#define R_AARCH64_MOVW_SABS_G0 270
+#define R_AARCH64_MOVW_SABS_G1 271
+#define R_AARCH64_MOVW_SABS_G2 272
+
+#define R_AARCH64_LD_PREL_LO19 273
+#define R_AARCH64_ADR_PREL_LO21 274
+#define R_AARCH64_ADR_PREL_PG_HI21 275
+#define R_AARCH64_ADR_PREL_PG_HI21_NC 276
+#define R_AARCH64_ADD_ABS_LO12_NC 277
+#define R_AARCH64_LDST8_ABS_LO12_NC 278
+
+#define R_AARCH64_TSTBR14 279
+#define R_AARCH64_CONDBR19 280
+#define R_AARCH64_JUMP26 282
+#define R_AARCH64_CALL26 283
+#define R_AARCH64_LDST16_ABS_LO12_NC 284
+#define R_AARCH64_LDST32_ABS_LO12_NC 285
+#define R_AARCH64_LDST64_ABS_LO12_NC 286
+#define R_AARCH64_LDST128_ABS_LO12_NC 299
+
+#define R_AARCH64_MOVW_PREL_G0 287
+#define R_AARCH64_MOVW_PREL_G0_NC 288
+#define R_AARCH64_MOVW_PREL_G1 289
+#define R_AARCH64_MOVW_PREL_G1_NC 290
+#define R_AARCH64_MOVW_PREL_G2 291
+#define R_AARCH64_MOVW_PREL_G2_NC 292
+#define R_AARCH64_MOVW_PREL_G3 293
+
+#define R_AARCH64_RELATIVE 1027
+
+/* PowerPC relocations defined by the ABIs */
+#define R_PPC_NONE 0
+#define R_PPC_ADDR32 1 /* 32bit absolute address */
+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
+#define R_PPC_ADDR16 3 /* 16bit absolute address */
+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
+#define R_PPC_ADDR14_BRTAKEN 8
+#define R_PPC_ADDR14_BRNTAKEN 9
+#define R_PPC_REL24 10 /* PC relative 26 bit */
+#define R_PPC_REL14 11 /* PC relative 16 bit */
+#define R_PPC_REL14_BRTAKEN 12
+#define R_PPC_REL14_BRNTAKEN 13
+#define R_PPC_GOT16 14
+#define R_PPC_GOT16_LO 15
+#define R_PPC_GOT16_HI 16
+#define R_PPC_GOT16_HA 17
+#define R_PPC_PLTREL24 18
+#define R_PPC_COPY 19
+#define R_PPC_GLOB_DAT 20
+#define R_PPC_JMP_SLOT 21
+#define R_PPC_RELATIVE 22
+#define R_PPC_LOCAL24PC 23
+#define R_PPC_UADDR32 24
+#define R_PPC_UADDR16 25
+#define R_PPC_REL32 26
+#define R_PPC_PLT32 27
+#define R_PPC_PLTREL32 28
+#define R_PPC_PLT16_LO 29
+#define R_PPC_PLT16_HI 30
+#define R_PPC_PLT16_HA 31
+#define R_PPC_SDAREL16 32
+#define R_PPC_SECTOFF 33
+#define R_PPC_SECTOFF_LO 34
+#define R_PPC_SECTOFF_HI 35
+#define R_PPC_SECTOFF_HA 36
+
+/* PowerPC relocations defined for the TLS access ABI. */
+#define R_PPC_TLS 67 /* none (sym+add)@tls */
+#define R_PPC_DTPMOD32 68 /* word32 (sym+add)@dtpmod */
+#define R_PPC_TPREL16 69 /* half16* (sym+add)@tprel */
+#define R_PPC_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
+#define R_PPC_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
+#define R_PPC_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
+#define R_PPC_TPREL32 73 /* word32 (sym+add)@tprel */
+#define R_PPC_DTPREL16 74 /* half16* (sym+add)@dtprel */
+#define R_PPC_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
+#define R_PPC_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
+#define R_PPC_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
+#define R_PPC_DTPREL32 78 /* word32 (sym+add)@dtprel */
+#define R_PPC_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
+#define R_PPC_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
+#define R_PPC_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
+#define R_PPC_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
+#define R_PPC_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
+#define R_PPC_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
+#define R_PPC_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
+#define R_PPC_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
+#define R_PPC_GOT_TPREL16 87 /* half16* (sym+add)@got@tprel */
+#define R_PPC_GOT_TPREL16_LO 88 /* half16 (sym+add)@got@tprel@l */
+#define R_PPC_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
+#define R_PPC_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
+#define R_PPC_GOT_DTPREL16 91 /* half16* (sym+add)@got@dtprel */
+#define R_PPC_GOT_DTPREL16_LO 92 /* half16* (sym+add)@got@dtprel@l */
+#define R_PPC_GOT_DTPREL16_HI 93 /* half16* (sym+add)@got@dtprel@h */
+#define R_PPC_GOT_DTPREL16_HA 94 /* half16* (sym+add)@got@dtprel@ha */
+
+#define R_PPC_REL16 249
+#define R_PPC_REL16_LO 250
+#define R_PPC_REL16_HI 251
+#define R_PPC_REL16_HA 252
+
+/* keep this the last entry. */
+#define R_PPC_NUM 253
+
+/* PowerPC64 relocations defined by the ABIs */
+#define R_PPC64_NONE R_PPC_NONE
+#define R_PPC64_ADDR32 R_PPC_ADDR32 /* 32bit absolute address. */
+#define R_PPC64_ADDR24 R_PPC_ADDR24 /* 26bit address, word aligned. */
+#define R_PPC64_ADDR16 R_PPC_ADDR16 /* 16bit absolute address. */
+#define R_PPC64_ADDR16_LO R_PPC_ADDR16_LO /* lower 16bits of abs. address. */
+#define R_PPC64_ADDR16_HI R_PPC_ADDR16_HI /* high 16bits of abs. address. */
+#define R_PPC64_ADDR16_HA R_PPC_ADDR16_HA /* adjusted high 16bits. */
+#define R_PPC64_ADDR14 R_PPC_ADDR14 /* 16bit address, word aligned. */
+#define R_PPC64_ADDR14_BRTAKEN R_PPC_ADDR14_BRTAKEN
+#define R_PPC64_ADDR14_BRNTAKEN R_PPC_ADDR14_BRNTAKEN
+#define R_PPC64_REL24 R_PPC_REL24 /* PC relative 26 bit, word aligned. */
+#define R_PPC64_REL14 R_PPC_REL14 /* PC relative 16 bit. */
+#define R_PPC64_REL14_BRTAKEN R_PPC_REL14_BRTAKEN
+#define R_PPC64_REL14_BRNTAKEN R_PPC_REL14_BRNTAKEN
+#define R_PPC64_GOT16 R_PPC_GOT16
+#define R_PPC64_GOT16_LO R_PPC_GOT16_LO
+#define R_PPC64_GOT16_HI R_PPC_GOT16_HI
+#define R_PPC64_GOT16_HA R_PPC_GOT16_HA
+
+#define R_PPC64_COPY R_PPC_COPY
+#define R_PPC64_GLOB_DAT R_PPC_GLOB_DAT
+#define R_PPC64_JMP_SLOT R_PPC_JMP_SLOT
+#define R_PPC64_RELATIVE R_PPC_RELATIVE
+
+#define R_PPC64_UADDR32 R_PPC_UADDR32
+#define R_PPC64_UADDR16 R_PPC_UADDR16
+#define R_PPC64_REL32 R_PPC_REL32
+#define R_PPC64_PLT32 R_PPC_PLT32
+#define R_PPC64_PLTREL32 R_PPC_PLTREL32
+#define R_PPC64_PLT16_LO R_PPC_PLT16_LO
+#define R_PPC64_PLT16_HI R_PPC_PLT16_HI
+#define R_PPC64_PLT16_HA R_PPC_PLT16_HA
+
+#define R_PPC64_SECTOFF R_PPC_SECTOFF
+#define R_PPC64_SECTOFF_LO R_PPC_SECTOFF_LO
+#define R_PPC64_SECTOFF_HI R_PPC_SECTOFF_HI
+#define R_PPC64_SECTOFF_HA R_PPC_SECTOFF_HA
+#define R_PPC64_ADDR30 37 /* word30 (S + A - P) >> 2. */
+#define R_PPC64_ADDR64 38 /* doubleword64 S + A. */
+#define R_PPC64_ADDR16_HIGHER 39 /* half16 #higher(S + A). */
+#define R_PPC64_ADDR16_HIGHERA 40 /* half16 #highera(S + A). */
+#define R_PPC64_ADDR16_HIGHEST 41 /* half16 #highest(S + A). */
+#define R_PPC64_ADDR16_HIGHESTA 42 /* half16 #highesta(S + A). */
+#define R_PPC64_UADDR64 43 /* doubleword64 S + A. */
+#define R_PPC64_REL64 44 /* doubleword64 S + A - P. */
+#define R_PPC64_PLT64 45 /* doubleword64 L + A. */
+#define R_PPC64_PLTREL64 46 /* doubleword64 L + A - P. */
+#define R_PPC64_TOC16 47 /* half16* S + A - .TOC. */
+#define R_PPC64_TOC16_LO 48 /* half16 #lo(S + A - .TOC.). */
+#define R_PPC64_TOC16_HI 49 /* half16 #hi(S + A - .TOC.). */
+#define R_PPC64_TOC16_HA 50 /* half16 #ha(S + A - .TOC.). */
+#define R_PPC64_TOC 51 /* doubleword64 .TOC. */
+#define R_PPC64_PLTGOT16 52 /* half16* M + A. */
+#define R_PPC64_PLTGOT16_LO 53 /* half16 #lo(M + A). */
+#define R_PPC64_PLTGOT16_HI 54 /* half16 #hi(M + A). */
+#define R_PPC64_PLTGOT16_HA 55 /* half16 #ha(M + A). */
+
+#define R_PPC64_ADDR16_DS 56 /* half16ds* (S + A) >> 2. */
+#define R_PPC64_ADDR16_LO_DS 57 /* half16ds #lo(S + A) >> 2. */
+#define R_PPC64_GOT16_DS 58 /* half16ds* (G + A) >> 2. */
+#define R_PPC64_GOT16_LO_DS 59 /* half16ds #lo(G + A) >> 2. */
+#define R_PPC64_PLT16_LO_DS 60 /* half16ds #lo(L + A) >> 2. */
+#define R_PPC64_SECTOFF_DS 61 /* half16ds* (R + A) >> 2. */
+#define R_PPC64_SECTOFF_LO_DS 62 /* half16ds #lo(R + A) >> 2. */
+#define R_PPC64_TOC16_DS 63 /* half16ds* (S + A - .TOC.) >> 2. */
+#define R_PPC64_TOC16_LO_DS 64 /* half16ds #lo(S + A - .TOC.) >> 2. */
+#define R_PPC64_PLTGOT16_DS 65 /* half16ds* (M + A) >> 2. */
+#define R_PPC64_PLTGOT16_LO_DS 66 /* half16ds #lo(M + A) >> 2. */
+
+/* PowerPC64 relocations defined for the TLS access ABI. */
+#define R_PPC64_TLS 67 /* none (sym+add)@tls */
+#define R_PPC64_DTPMOD64 68 /* doubleword64 (sym+add)@dtpmod */
+#define R_PPC64_TPREL16 69 /* half16* (sym+add)@tprel */
+#define R_PPC64_TPREL16_LO 70 /* half16 (sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HI 71 /* half16 (sym+add)@tprel@h */
+#define R_PPC64_TPREL16_HA 72 /* half16 (sym+add)@tprel@ha */
+#define R_PPC64_TPREL64 73 /* doubleword64 (sym+add)@tprel */
+#define R_PPC64_DTPREL16 74 /* half16* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO 75 /* half16 (sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HI 76 /* half16 (sym+add)@dtprel@h */
+#define R_PPC64_DTPREL16_HA 77 /* half16 (sym+add)@dtprel@ha */
+#define R_PPC64_DTPREL64 78 /* doubleword64 (sym+add)@dtprel */
+#define R_PPC64_GOT_TLSGD16 79 /* half16* (sym+add)@got@tlsgd */
+#define R_PPC64_GOT_TLSGD16_LO 80 /* half16 (sym+add)@got@tlsgd@l */
+#define R_PPC64_GOT_TLSGD16_HI 81 /* half16 (sym+add)@got@tlsgd@h */
+#define R_PPC64_GOT_TLSGD16_HA 82 /* half16 (sym+add)@got@tlsgd@ha */
+#define R_PPC64_GOT_TLSLD16 83 /* half16* (sym+add)@got@tlsld */
+#define R_PPC64_GOT_TLSLD16_LO 84 /* half16 (sym+add)@got@tlsld@l */
+#define R_PPC64_GOT_TLSLD16_HI 85 /* half16 (sym+add)@got@tlsld@h */
+#define R_PPC64_GOT_TLSLD16_HA 86 /* half16 (sym+add)@got@tlsld@ha */
+#define R_PPC64_GOT_TPREL16_DS 87 /* half16ds* (sym+add)@got@tprel */
+#define R_PPC64_GOT_TPREL16_LO_DS 88 /* half16ds (sym+add)@got@tprel@l */
+#define R_PPC64_GOT_TPREL16_HI 89 /* half16 (sym+add)@got@tprel@h */
+#define R_PPC64_GOT_TPREL16_HA 90 /* half16 (sym+add)@got@tprel@ha */
+#define R_PPC64_GOT_DTPREL16_DS 91 /* half16ds* (sym+add)@got@dtprel */
+#define R_PPC64_GOT_DTPREL16_LO_DS 92 /* half16ds (sym+add)@got@dtprel@l */
+#define R_PPC64_GOT_DTPREL16_HI 93 /* half16 (sym+add)@got@dtprel@h */
+#define R_PPC64_GOT_DTPREL16_HA 94 /* half16 (sym+add)@got@dtprel@ha */
+#define R_PPC64_TPREL16_DS 95 /* half16ds* (sym+add)@tprel */
+#define R_PPC64_TPREL16_LO_DS 96 /* half16ds (sym+add)@tprel@l */
+#define R_PPC64_TPREL16_HIGHER 97 /* half16 (sym+add)@tprel@higher */
+#define R_PPC64_TPREL16_HIGHERA 98 /* half16 (sym+add)@tprel@highera */
+#define R_PPC64_TPREL16_HIGHEST 99 /* half16 (sym+add)@tprel@highest */
+#define R_PPC64_TPREL16_HIGHESTA 100 /* half16 (sym+add)@tprel@highesta */
+#define R_PPC64_DTPREL16_DS 101 /* half16ds* (sym+add)@dtprel */
+#define R_PPC64_DTPREL16_LO_DS 102 /* half16ds (sym+add)@dtprel@l */
+#define R_PPC64_DTPREL16_HIGHER 103 /* half16 (sym+add)@dtprel@higher */
+#define R_PPC64_DTPREL16_HIGHERA 104 /* half16 (sym+add)@dtprel@highera */
+#define R_PPC64_DTPREL16_HIGHEST 105 /* half16 (sym+add)@dtprel@highest */
+#define R_PPC64_DTPREL16_HIGHESTA 106 /* half16 (sym+add)@dtprel@highesta */
+#define R_PPC64_TLSGD 107
+#define R_PPC64_TLSLD 108
+#define R_PPC64_TOCSAVE 109
+
+#define R_PPC64_REL24_NOTOC 116
+#define R_PPC64_ENTRY 118
+
+#define R_PPC64_PCREL34 132
+#define R_PPC64_GOT_PCREL34 133
+
+#define R_PPC64_REL16 249
+#define R_PPC64_REL16_LO 250
+#define R_PPC64_REL16_HI 251
+#define R_PPC64_REL16_HA 252
+
+/* Keep this the last entry. */
+#define R_PPC64_NUM 253
+
+
+/*
+ * RISC-V relocation types
+ */
+
+/* Relocation types used by the dynamic linker */
+#define R_RISCV_NONE 0
+#define R_RISCV_32 1
+#define R_RISCV_64 2
+#define R_RISCV_RELATIVE 3
+#define R_RISCV_COPY 4
+#define R_RISCV_JUMP_SLOT 5
+#define R_RISCV_TLS_DTPMOD32 6
+#define R_RISCV_TLS_DTPMOD64 7
+#define R_RISCV_TLS_DTPREL32 8
+#define R_RISCV_TLS_DTPREL64 9
+#define R_RISCV_TLS_TPREL32 10
+#define R_RISCV_TLS_TPREL64 11
+#define R_RISCV_IRELATIVE 58
+
+/* Relocation types not used by the dynamic linker */
+#define R_RISCV_BRANCH 16
+#define R_RISCV_JAL 17
+#define R_RISCV_CALL 18
+#define R_RISCV_CALL_PLT 19
+#define R_RISCV_GOT_HI20 20
+#define R_RISCV_TLS_GOT_HI20 21
+#define R_RISCV_TLS_GD_HI20 22
+#define R_RISCV_PCREL_HI20 23
+#define R_RISCV_PCREL_LO12_I 24
+#define R_RISCV_PCREL_LO12_S 25
+#define R_RISCV_HI20 26
+#define R_RISCV_LO12_I 27
+#define R_RISCV_LO12_S 28
+#define R_RISCV_TPREL_HI20 29
+#define R_RISCV_TPREL_LO12_I 30
+#define R_RISCV_TPREL_LO12_S 31
+#define R_RISCV_TPREL_ADD 32
+#define R_RISCV_ADD8 33
+#define R_RISCV_ADD16 34
+#define R_RISCV_ADD32 35
+#define R_RISCV_ADD64 36
+#define R_RISCV_SUB8 37
+#define R_RISCV_SUB16 38
+#define R_RISCV_SUB32 39
+#define R_RISCV_SUB64 40
+#define R_RISCV_GNU_VTINHERIT 41
+#define R_RISCV_GNU_VTENTRY 42
+#define R_RISCV_ALIGN 43
+#define R_RISCV_RVC_BRANCH 44
+#define R_RISCV_RVC_JUMP 45
+#define R_RISCV_GPREL_I 47
+#define R_RISCV_GPREL_S 48
+#define R_RISCV_TPREL_I 49
+#define R_RISCV_TPREL_S 50
+#define R_RISCV_RELAX 51
+#define R_RISCV_SUB6 52
+#define R_RISCV_SET6 53
+#define R_RISCV_SET8 54
+#define R_RISCV_SET16 55
+#define R_RISCV_SET32 56
+#define R_RISCV_32_PCREL 57
+#define R_RISCV_PLT32 59
+#define R_RISCV_SET_ULEB128 60
+#define R_RISCV_SUB_ULEB128 61
+
+/* LoongArch relocation types used by the dynamic linker */
+#define R_LARCH_NONE 0
+#define R_LARCH_32 1
+#define R_LARCH_64 2
+#define R_LARCH_RELATIVE 3
+#define R_LARCH_COPY 4
+#define R_LARCH_JUMP_SLOT 5
+#define R_LARCH_TLS_DTPMOD32 6
+#define R_LARCH_TLS_DTPMOD64 7
+#define R_LARCH_TLS_DTPREL32 8
+#define R_LARCH_TLS_DTPREL64 9
+#define R_LARCH_TLS_TPREL32 10
+#define R_LARCH_TLS_TPREL64 11
+#define R_LARCH_IRELATIVE 12
+#define R_LARCH_MARK_LA 20
+#define R_LARCH_MARK_PCREL 21
+#define R_LARCH_SOP_PUSH_PCREL 22
+#define R_LARCH_SOP_PUSH_ABSOLUTE 23
+#define R_LARCH_SOP_PUSH_DUP 24
+#define R_LARCH_SOP_PUSH_GPREL 25
+#define R_LARCH_SOP_PUSH_TLS_TPREL 26
+#define R_LARCH_SOP_PUSH_TLS_GOT 27
+#define R_LARCH_SOP_PUSH_TLS_GD 28
+#define R_LARCH_SOP_PUSH_PLT_PCREL 29
+#define R_LARCH_SOP_ASSERT 30
+#define R_LARCH_SOP_NOT 31
+#define R_LARCH_SOP_SUB 32
+#define R_LARCH_SOP_SL 33
+#define R_LARCH_SOP_SR 34
+#define R_LARCH_SOP_ADD 35
+#define R_LARCH_SOP_AND 36
+#define R_LARCH_SOP_IF_ELSE 37
+#define R_LARCH_SOP_POP_32_S_10_5 38
+#define R_LARCH_SOP_POP_32_U_10_12 39
+#define R_LARCH_SOP_POP_32_S_10_12 40
+#define R_LARCH_SOP_POP_32_S_10_16 41
+#define R_LARCH_SOP_POP_32_S_10_16_S2 42
+#define R_LARCH_SOP_POP_32_S_5_20 43
+#define R_LARCH_SOP_POP_32_S_0_5_10_16_S2 44
+#define R_LARCH_SOP_POP_32_S_0_10_10_16_S2 45
+#define R_LARCH_SOP_POP_32_U 46
+#define R_LARCH_ADD8 47
+#define R_LARCH_ADD16 48
+#define R_LARCH_ADD24 49
+#define R_LARCH_ADD32 50
+#define R_LARCH_ADD64 51
+#define R_LARCH_SUB8 52
+#define R_LARCH_SUB16 53
+#define R_LARCH_SUB24 54
+#define R_LARCH_SUB32 55
+#define R_LARCH_SUB64 56
+#define R_LARCH_GNU_VTINHERIT 57
+#define R_LARCH_GNU_VTENTRY 58
+#define R_LARCH_B16 64
+#define R_LARCH_B21 65
+#define R_LARCH_B26 66
+#define R_LARCH_ABS_HI20 67
+#define R_LARCH_ABS_LO12 68
+#define R_LARCH_ABS64_LO20 69
+#define R_LARCH_ABS64_HI12 70
+#define R_LARCH_PCALA_HI20 71
+#define R_LARCH_PCALA_LO12 72
+#define R_LARCH_PCALA64_LO20 73
+#define R_LARCH_PCALA64_HI12 74
+#define R_LARCH_GOT_PC_HI20 75
+#define R_LARCH_GOT_PC_LO12 76
+#define R_LARCH_GOT64_PC_LO20 77
+#define R_LARCH_GOT64_PC_HI12 78
+#define R_LARCH_GOT_HI20 79
+#define R_LARCH_GOT_LO12 80
+#define R_LARCH_GOT64_LO20 81
+#define R_LARCH_GOT64_HI12 82
+#define R_LARCH_TLS_LE_HI20 83
+#define R_LARCH_TLS_LE_LO12 84
+#define R_LARCH_TLS_LE64_LO20 85
+#define R_LARCH_TLS_LE64_HI12 86
+#define R_LARCH_TLS_IE_PC_HI20 87
+#define R_LARCH_TLS_IE_PC_LO12 88
+#define R_LARCH_TLS_IE64_PC_LO20 89
+#define R_LARCH_TLS_IE64_PC_HI12 90
+#define R_LARCH_TLS_IE_HI20 91
+#define R_LARCH_TLS_IE_LO12 92
+#define R_LARCH_TLS_IE64_LO20 93
+#define R_LARCH_TLS_IE64_HI12 94
+#define R_LARCH_TLS_LD_PC_HI20 95
+#define R_LARCH_TLS_LD_HI20 96
+#define R_LARCH_TLS_GD_PC_HI20 97
+#define R_LARCH_TLS_GD_HI20 98
+#define R_LARCH_32_PCREL 99
+#define R_LARCH_RELAX 100
+#define R_LARCH_DELETE 101
+#define R_LARCH_ALIGN 102
+#define R_LARCH_PCREL20_S2 103
+#define R_LARCH_CFA 104
+#define R_LARCH_ADD6 105
+#define R_LARCH_SUB6 106
+#define R_LARCH_ADD_ULEB128 107
+#define R_LARCH_SUB_ULEB128 108
+#define R_LARCH_64_PCREL 109
+#define R_LARCH_CALL36 110
+#define R_LARCH_TLS_DESC_PC_HI20 111
+#define R_LARCH_TLS_DESC_PC_LO12 112
+#define R_LARCH_TLS_DESC64_PC_LO20 113
+#define R_LARCH_TLS_DESC64_PC_HI12 114
+#define R_LARCH_TLS_DESC_HI20 115
+#define R_LARCH_TLS_DESC_LO12 116
+#define R_LARCH_TLS_DESC64_LO20 117
+#define R_LARCH_TLS_DESC64_HI12 118
+#define R_LARCH_TLS_DESC_LD 119
+#define R_LARCH_TLS_DESC_CALL 120
+#define R_LARCH_TLS_LE_HI20_R 121
+#define R_LARCH_TLS_LE_ADD_R 122
+#define R_LARCH_TLS_LE_LO12_R 123
+#define R_LARCH_TLS_LD_PCREL20_S2 124
+#define R_LARCH_TLS_GD_PCREL20_S2 125
+#define R_LARCH_TLS_DESC_PCREL20_S2 126
+#define R_LARCH_CALL30 127
+#define R_LARCH_PCADD_HI20 128
+#define R_LARCH_PCADD_LO12 129
+#define R_LARCH_GOT_PCADD_HI20 130
+#define R_LARCH_GOT_PCADD_LO12 131
+#define R_LARCH_TLS_IE_PCADD_HI20 132
+#define R_LARCH_TLS_IE_PCADD_LO12 133
+#define R_LARCH_TLS_LD_PCADD_HI20 134
+#define R_LARCH_TLS_LD_PCADD_LO12 135
+#define R_LARCH_TLS_GD_PCADD_HI20 136
+#define R_LARCH_TLS_GD_PCADD_LO12 137
+#define R_LARCH_TLS_DESC_PCADD_HI20 138
+#define R_LARCH_TLS_DESC_PCADD_LO12 139
+
+/* s390 relocations defined by the ABIs */
+#define R_390_NONE 0 /* No reloc. */
+#define R_390_8 1 /* Direct 8 bit. */
+#define R_390_12 2 /* Direct 12 bit. */
+#define R_390_16 3 /* Direct 16 bit. */
+#define R_390_32 4 /* Direct 32 bit. */
+#define R_390_PC32 5 /* PC relative 32 bit. */
+#define R_390_GOT12 6 /* 12 bit GOT offset. */
+#define R_390_GOT32 7 /* 32 bit GOT offset. */
+#define R_390_PLT32 8 /* 32 bit PC relative PLT address. */
+#define R_390_COPY 9 /* Copy symbol at runtime. */
+#define R_390_GLOB_DAT 10 /* Create GOT entry. */
+#define R_390_JMP_SLOT 11 /* Create PLT entry. */
+#define R_390_RELATIVE 12 /* Adjust by program base. */
+#define R_390_GOTOFF32 13 /* 32 bit offset to GOT. */
+#define R_390_GOTPC 14 /* 32 bit PC rel. offset to GOT. */
+#define R_390_GOT16 15 /* 16 bit GOT offset. */
+#define R_390_PC16 16 /* PC relative 16 bit. */
+#define R_390_PC16DBL 17 /* PC relative 16 bit shifted by 1. */
+#define R_390_PLT16DBL 18 /* 16 bit PC rel. PLT shifted by 1. */
+#define R_390_PC32DBL 19 /* PC relative 32 bit shifted by 1. */
+#define R_390_PLT32DBL 20 /* 32 bit PC rel. PLT shifted by 1. */
+#define R_390_GOTPCDBL 21 /* 32 bit PC rel. GOT shifted by 1. */
+#define R_390_64 22 /* Direct 64 bit. */
+#define R_390_PC64 23 /* PC relative 64 bit. */
+#define R_390_GOT64 24 /* 64 bit GOT offset. */
+#define R_390_PLT64 25 /* 64 bit PC relative PLT address. */
+#define R_390_GOTENT 26 /* 32 bit PC rel. to GOT entry >> 1. */
+#define R_390_GOTOFF16 27 /* 16 bit offset to GOT. */
+#define R_390_GOTOFF64 28 /* 64 bit offset to GOT. */
+#define R_390_GOTPLT12 29 /* 12 bit offset to jump slot. */
+#define R_390_GOTPLT16 30 /* 16 bit offset to jump slot. */
+#define R_390_GOTPLT32 31 /* 32 bit offset to jump slot. */
+#define R_390_GOTPLT64 32 /* 64 bit offset to jump slot. */
+#define R_390_GOTPLTENT 33 /* 32 bit rel. offset to jump slot. */
+#define R_390_PLTOFF16 34 /* 16 bit offset from GOT to PLT. */
+#define R_390_PLTOFF32 35 /* 32 bit offset from GOT to PLT. */
+#define R_390_PLTOFF64 36 /* 16 bit offset from GOT to PLT. */
+#define R_390_TLS_LOAD 37 /* Tag for load insn in TLS code. */
+#define R_390_TLS_GDCALL 38 /* Tag for function call in general
+ dynamic TLS code. */
+#define R_390_TLS_LDCALL 39 /* Tag for function call in local
+ dynamic TLS code. */
+#define R_390_TLS_GD32 40 /* Direct 32 bit for general dynamic
+ thread local data. */
+#define R_390_TLS_GD64 41 /* Direct 64 bit for general dynamic
+ thread local data. */
+#define R_390_TLS_GOTIE12 42 /* 12 bit GOT offset for static TLS
+ block offset. */
+#define R_390_TLS_GOTIE32 43 /* 32 bit GOT offset for static TLS
+ block offset. */
+#define R_390_TLS_GOTIE64 44 /* 64 bit GOT offset for static TLS
+ block offset. */
+#define R_390_TLS_LDM32 45 /* Direct 32 bit for local dynamic
+ thread local data in LD code. */
+#define R_390_TLS_LDM64 46 /* Direct 64 bit for local dynamic
+ thread local data in LD code. */
+#define R_390_TLS_IE32 47 /* 32 bit address of GOT entry for
+ negated static TLS block offset. */
+#define R_390_TLS_IE64 48 /* 64 bit address of GOT entry for
+ negated static TLS block offset. */
+#define R_390_TLS_IEENT 49 /* 32 bit rel. offset to GOT entry for
+ negated static TLS block offset. */
+#define R_390_TLS_LE32 50 /* 32 bit negated offset relative to
+ static TLS block. */
+#define R_390_TLS_LE64 51 /* 64 bit negated offset relative to
+ static TLS block. */
+#define R_390_TLS_LDO32 52 /* 32 bit offset relative to TLS
+ block. */
+#define R_390_TLS_LDO64 53 /* 64 bit offset relative to TLS
+ block. */
+#define R_390_TLS_DTPMOD 54 /* ID of module containing symbol. */
+#define R_390_TLS_DTPOFF 55 /* Offset in TLS block. */
+#define R_390_TLS_TPOFF 56 /* Negate offset in static TLS
+ block. */
+#define R_390_20 57 /* Direct 20 bit. */
+#define R_390_GOT20 58 /* 20 bit GOT offset. */
+#define R_390_GOTPLT20 59 /* 20 bit offset to jump slot. */
+#define R_390_TLS_GOTIE20 60 /* 20 bit GOT offset for static TLS
+ block offset. */
+/* Keep this the last entry. */
+#define R_390_NUM 61
+
+/* MIPS relocations defined by the ABIs */
+#define R_MIPS_NONE 0
+#define R_MIPS_16 1
+#define R_MIPS_32 2
+#define R_MIPS_REL32 3
+#define R_MIPS_26 4
+#define R_MIPS_HI16 5
+#define R_MIPS_LO16 6
+#define R_MIPS_GPREL16 7
+#define R_MIPS_LITERAL 8
+#define R_MIPS_GOT16 9
+#define R_MIPS_PC16 10
+#define R_MIPS_CALL16 11
+#define R_MIPS_GPREL32 12
+/* The remaining relocs are defined on Irix, although they are not
+ in the MIPS ELF ABI. */
+#define R_MIPS_UNUSED1 13
+#define R_MIPS_UNUSED2 14
+#define R_MIPS_UNUSED3 15
+#define R_MIPS_SHIFT5 16
+#define R_MIPS_SHIFT6 17
+#define R_MIPS_64 18
+#define R_MIPS_GOT_DISP 19
+#define R_MIPS_GOT_PAGE 20
+#define R_MIPS_GOT_OFST 21
+/*
+ * The following two relocation types are specified in the MIPS ABI
+ * conformance guide version 1.2 but not yet in the psABI.
+ */
+#define R_MIPS_GOTHI16 22
+#define R_MIPS_GOTLO16 23
+#define R_MIPS_SUB 24
+#define R_MIPS_INSERT_A 25
+#define R_MIPS_INSERT_B 26
+#define R_MIPS_DELETE 27
+#define R_MIPS_HIGHER 28
+#define R_MIPS_HIGHEST 29
+/*
+ * The following two relocation types are specified in the MIPS ABI
+ * conformance guide version 1.2 but not yet in the psABI.
+ */
+#define R_MIPS_CALLHI16 30
+#define R_MIPS_CALLLO16 31
+/*
+ * Introduced for MIPSr6.
+ */
+#define R_MIPS_PC21_S2 60
+#define R_MIPS_PC26_S2 61
+#define R_MIPS_PC18_S3 62
+#define R_MIPS_PC19_S2 63
+#define R_MIPS_PCHI16 64
+#define R_MIPS_PCLO16 65
+/*
+ * This range is reserved for vendor specific relocations.
+ */
+#define R_MIPS_LOVENDOR 100
+#define R_MIPS_HIVENDOR 127
+
+#define R_MIPS_PC32 248
+
+/*
+ * Sparc ELF relocation types
+ */
+#define R_SPARC_NONE 0
+#define R_SPARC_8 1
+#define R_SPARC_16 2
+#define R_SPARC_32 3
+#define R_SPARC_DISP8 4
+#define R_SPARC_DISP16 5
+#define R_SPARC_DISP32 6
+#define R_SPARC_WDISP30 7
+#define R_SPARC_WDISP22 8
+#define R_SPARC_HI22 9
+#define R_SPARC_22 10
+#define R_SPARC_13 11
+#define R_SPARC_LO10 12
+#define R_SPARC_GOT10 13
+#define R_SPARC_GOT13 14
+#define R_SPARC_GOT22 15
+#define R_SPARC_PC10 16
+#define R_SPARC_PC22 17
+#define R_SPARC_WPLT30 18
+#define R_SPARC_COPY 19
+#define R_SPARC_GLOB_DAT 20
+#define R_SPARC_JMP_SLOT 21
+#define R_SPARC_RELATIVE 22
+#define R_SPARC_UA32 23
+#define R_SPARC_PLT32 24
+#define R_SPARC_HIPLT22 25
+#define R_SPARC_LOPLT10 26
+#define R_SPARC_PCPLT32 27
+#define R_SPARC_PCPLT22 28
+#define R_SPARC_PCPLT10 29
+#define R_SPARC_10 30
+#define R_SPARC_11 31
+#define R_SPARC_64 32
+#define R_SPARC_OLO10 33
+#define R_SPARC_WDISP16 40
+#define R_SPARC_WDISP19 41
+#define R_SPARC_7 43
+#define R_SPARC_5 44
+#define R_SPARC_6 45
+#define R_SPARC_UA64 54
+
+#endif /* _UAPI_LINUX_ELF_R_H */
diff --git a/tools/include/uapi/linux/elf.h b/tools/include/uapi/linux/elf.h
index 5834b83d7f9a4..88bdcbb526c16 100644
--- a/tools/include/uapi/linux/elf.h
+++ b/tools/include/uapi/linux/elf.h
@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/elf-em.h>
+#include <linux/elf-r.h>
/* 32-bit ELF base types. */
typedef __u32 Elf32_Addr;
@@ -32,9 +33,9 @@ typedef __u16 Elf64_Versym;
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
-#define PT_TLS 7 /* Thread local storage segment */
-#define PT_LOOS 0x60000000 /* OS-specific */
-#define PT_HIOS 0x6fffffff /* OS-specific */
+#define PT_TLS 7 /* Thread local storage segment */
+#define PT_LOOS 0x60000000 /* OS-specific */
+#define PT_HIOS 0x6fffffff /* OS-specific */
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
#define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550)
@@ -95,7 +96,7 @@ typedef __u16 Elf64_Versym;
#define DT_SONAME 14
#define DT_RPATH 15
#define DT_SYMBOLIC 16
-#define DT_REL 17
+#define DT_REL 17
#define DT_RELSZ 18
#define DT_RELENT 19
#define DT_PLTREL 20
@@ -299,8 +300,18 @@ typedef struct elf64_phdr {
#define SHF_WRITE 0x1
#define SHF_ALLOC 0x2
#define SHF_EXECINSTR 0x4
+#define SHF_MERGE 0x10
+#define SHF_STRINGS 0x20
+#define SHF_INFO_LINK 0x40
+#define SHF_LINK_ORDER 0x80
+#define SHF_OS_NONCONFORMING 0x100
+#define SHF_GROUP 0x200
+#define SHF_TLS 0x400
#define SHF_RELA_LIVEPATCH 0x00100000
#define SHF_RO_AFTER_INIT 0x00200000
+#define SHF_ORDERED 0x04000000
+#define SHF_EXCLUDE 0x08000000
+#define SHF_MASKOS 0x0ff00000
#define SHF_MASKPROC 0xf0000000
/* special section indexes */
@@ -312,7 +323,7 @@ typedef struct elf64_phdr {
#define SHN_ABS 0xfff1
#define SHN_COMMON 0xfff2
#define SHN_HIRESERVE 0xffff
-
+
typedef struct elf32_shdr {
Elf32_Word sh_name;
Elf32_Word sh_type;
@@ -376,101 +387,180 @@ typedef struct elf64_shdr {
#define ELF_OSABI ELFOSABI_NONE
#endif
+/* Note definitions: NN_ defines names. NT_ defines types. */
+
+#define NN_GNU_PROPERTY_TYPE_0 "GNU"
+#define NT_GNU_PROPERTY_TYPE_0 5
+
/*
* Notes used in ET_CORE. Architectures export some of the arch register sets
* using the corresponding note types via the PTRACE_GETREGSET and
* PTRACE_SETREGSET requests.
- * The note name for these types is "LINUX", except NT_PRFPREG that is named
- * "CORE".
*/
+#define NN_PRSTATUS "CORE"
#define NT_PRSTATUS 1
+#define NN_PRFPREG "CORE"
#define NT_PRFPREG 2
+#define NN_PRPSINFO "CORE"
#define NT_PRPSINFO 3
+#define NN_TASKSTRUCT "CORE"
#define NT_TASKSTRUCT 4
+#define NN_AUXV "CORE"
#define NT_AUXV 6
/*
* Note to userspace developers: size of NT_SIGINFO note may increase
* in the future to accomodate more fields, don't assume it is fixed!
*/
+#define NN_SIGINFO "CORE"
#define NT_SIGINFO 0x53494749
-#define NT_FILE 0x46494c45
+#define NN_FILE "CORE"
+#define NT_FILE 0x46494c45
+#define NN_PRXFPREG "LINUX"
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
+#define NN_PPC_VMX "LINUX"
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
+#define NN_PPC_SPE "LINUX"
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
+#define NN_PPC_VSX "LINUX"
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
+#define NN_PPC_TAR "LINUX"
#define NT_PPC_TAR 0x103 /* Target Address Register */
+#define NN_PPC_PPR "LINUX"
#define NT_PPC_PPR 0x104 /* Program Priority Register */
+#define NN_PPC_DSCR "LINUX"
#define NT_PPC_DSCR 0x105 /* Data Stream Control Register */
+#define NN_PPC_EBB "LINUX"
#define NT_PPC_EBB 0x106 /* Event Based Branch Registers */
+#define NN_PPC_PMU "LINUX"
#define NT_PPC_PMU 0x107 /* Performance Monitor Registers */
+#define NN_PPC_TM_CGPR "LINUX"
#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
+#define NN_PPC_TM_CFPR "LINUX"
#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
+#define NN_PPC_TM_CVMX "LINUX"
#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
+#define NN_PPC_TM_CVSX "LINUX"
#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
+#define NN_PPC_TM_SPR "LINUX"
#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
+#define NN_PPC_TM_CTAR "LINUX"
#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */
+#define NN_PPC_TM_CPPR "LINUX"
#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */
+#define NN_PPC_TM_CDSCR "LINUX"
#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */
+#define NN_PPC_PKEY "LINUX"
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */
+#define NN_PPC_DEXCR "LINUX"
#define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */
+#define NN_PPC_HASHKEYR "LINUX"
#define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */
+#define NN_386_TLS "LINUX"
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
+#define NN_386_IOPERM "LINUX"
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
+#define NN_X86_XSTATE "LINUX"
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
/* Old binutils treats 0x203 as a CET state */
+#define NN_X86_SHSTK "LINUX"
#define NT_X86_SHSTK 0x204 /* x86 SHSTK state */
+#define NN_X86_XSAVE_LAYOUT "LINUX"
#define NT_X86_XSAVE_LAYOUT 0x205 /* XSAVE layout description */
+#define NN_S390_HIGH_GPRS "LINUX"
#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
+#define NN_S390_TIMER "LINUX"
#define NT_S390_TIMER 0x301 /* s390 timer register */
+#define NN_S390_TODCMP "LINUX"
#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
+#define NN_S390_TODPREG "LINUX"
#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
+#define NN_S390_CTRS "LINUX"
#define NT_S390_CTRS 0x304 /* s390 control registers */
+#define NN_S390_PREFIX "LINUX"
#define NT_S390_PREFIX 0x305 /* s390 prefix register */
+#define NN_S390_LAST_BREAK "LINUX"
#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
+#define NN_S390_SYSTEM_CALL "LINUX"
#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
+#define NN_S390_TDB "LINUX"
#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
+#define NN_S390_VXRS_LOW "LINUX"
#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */
+#define NN_S390_VXRS_HIGH "LINUX"
#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */
+#define NN_S390_GS_CB "LINUX"
#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */
+#define NN_S390_GS_BC "LINUX"
#define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */
+#define NN_S390_RI_CB "LINUX"
#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */
+#define NN_S390_PV_CPU_DATA "LINUX"
#define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data */
+#define NN_ARM_VFP "LINUX"
#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
+#define NN_ARM_TLS "LINUX"
#define NT_ARM_TLS 0x401 /* ARM TLS register */
+#define NN_ARM_HW_BREAK "LINUX"
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
+#define NN_ARM_HW_WATCH "LINUX"
#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
+#define NN_ARM_SYSTEM_CALL "LINUX"
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
+#define NN_ARM_SVE "LINUX"
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */
+#define NN_ARM_PAC_MASK "LINUX"
#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */
+#define NN_ARM_PACA_KEYS "LINUX"
#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */
+#define NN_ARM_PACG_KEYS "LINUX"
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */
+#define NN_ARM_TAGGED_ADDR_CTRL "LINUX"
#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */
+#define NN_ARM_PAC_ENABLED_KEYS "LINUX"
#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */
+#define NN_ARM_SSVE "LINUX"
#define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers */
+#define NN_ARM_ZA "LINUX"
#define NT_ARM_ZA 0x40c /* ARM SME ZA registers */
+#define NN_ARM_ZT "LINUX"
#define NT_ARM_ZT 0x40d /* ARM SME ZT registers */
+#define NN_ARM_FPMR "LINUX"
#define NT_ARM_FPMR 0x40e /* ARM floating point mode register */
+#define NN_ARM_POE "LINUX"
#define NT_ARM_POE 0x40f /* ARM POE registers */
+#define NN_ARM_GCS "LINUX"
#define NT_ARM_GCS 0x410 /* ARM GCS state */
+#define NN_ARC_V2 "LINUX"
#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */
+#define NN_VMCOREDD "LINUX"
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */
+#define NN_MIPS_DSP "LINUX"
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
+#define NN_MIPS_FP_MODE "LINUX"
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
+#define NN_MIPS_MSA "LINUX"
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */
+#define NN_RISCV_CSR "LINUX"
#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
+#define NN_RISCV_VECTOR "LINUX"
#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
+#define NN_RISCV_TAGGED_ADDR_CTRL "LINUX"
#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address control (prctl()) */
+#define NN_LOONGARCH_CPUCFG "LINUX"
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */
+#define NN_LOONGARCH_CSR "LINUX"
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */
+#define NN_LOONGARCH_LSX "LINUX"
#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */
+#define NN_LOONGARCH_LASX "LINUX"
#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */
+#define NN_LOONGARCH_LBT "LINUX"
#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */
+#define NN_LOONGARCH_HW_BREAK "LINUX"
#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */
+#define NN_LOONGARCH_HW_WATCH "LINUX"
#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
-/* Note types with note name "GNU" */
-#define NT_GNU_PROPERTY_TYPE_0 5
-
/* Note header in a PT_NOTE section */
typedef struct elf32_note {
Elf32_Word n_namesz; /* Name size */
|
| 3/2 | 2026/09/08 07:44 | llm | patch-evaluator |
0mModel:gemini-3.7-flash Args: null Results: null Tokens: input: 68387 output: 109 thoughts: 1084 Thoughts: **Patch Analysis: vDSO Relocation Verification** Okay, let's break this down. My initial thought is to determine if this patch warrants fuzzing. I need to go through the changes methodically. First, I see the modifications involve the build system, header files, and a new host tool, `vdsocheck`, written in Rust. It's designed to validate ELF files *during* the build process, specifically checking for illegal dynamic relocations within vDSO objects and libraries. The Makefiles are updated to include this check. Headers are being reorganized, moving ELF relocation constants into a dedicated `elf-r.h` file and linking it in the standard `elf.h` header. The tools directory also gets updated with the necessary ELF headers. Now, let's apply the "WorthFuzzing" guidelines. The key phrase here is "compiled kernel image (vmlinux) or kernel modules." The checklist explicitly says that build system changes, Kconfig changes that don't alter C logic, and user-space tools are generally *not* worth fuzzing. I'm seeing a lot of build system adjustments and a new host tool that's run at build time. There *are* C code changes in the form of removed `#define` statements from architecture-specific `elf.h` files and the addition of the new `elf-r.h` header, but this is purely a *reorganization* of existing definitions. It *doesn't* introduce new runtime kernel code logic, or modify any runtime data structures or the behavior of any existing runtime code. The Rust tool itself is a host program; it doesn't affect the compiled kernel image. Thus, the compiled kernel image's code logic is completely untouched. It is a build time check, and that is not subject to fuzzing. Therefore, "WorthFuzzing" is *false* here. I have a concise explanation and have identified the reasoning clearly. There are no specific symbols, configurations, or other fuzzing parameters to set. Now, I'm ready to prepare the `set-results` tool call. |
| 4/2 | 2026/09/08 07:44 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch series introduces a build-time ELF relocation checker tool (vdsocheck host program written in Rust), adjusts Makefiles to run this build-time check on vDSO images, and refactors ELF relocation macro definitions across architecture headers into a unified uapi header (linux/elf-r.h). No runtime kernel executable code, data structures, or logic are modified.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series introduces a build-time ELF relocation checker tool (vdsocheck host program written in Rust), adjusts Makefiles to run this build-time check on vDSO images, and refactors ELF relocation macro definitions across architecture headers into a unified uapi header (linux/elf-r.h). No runtime kernel executable code, data structures, or logic are modified.",
"WorthFuzzing": false
} |
| 5/1 | 2026/09/08 07:44 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|