From 0337fc7e0e084adeea58f333a8aa7dbc43363baf Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Wed, 3 Aug 2022 15:46:34 +0800 Subject: [PATCH] debug/elf: add new-style LoongArch reloc types LoongArch ELF psABI spec update: https://github.com/loongson/LoongArch-Documentation/pull/57 Corresponding binutils implementation: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6d13722a97cee3fd397e116bde3bcedbb1e220be https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9801120721c3a702ce3bd50433ef920f92a83502 For #54222 Change-Id: I51e72294205847a69c01d741a3126248f7a7e41c Reviewed-on: https://go-review.googlesource.com/c/go/+/420982 Reviewed-by: Meng Zhuo Run-TryBot: Meng Zhuo Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Reviewed-by: Cherry Mui TryBot-Result: Gopher Robot Reviewed-by: abner chenc --- api/next/54222.txt | 78 ++++++++++++++++++++++++++++++++++++++++++ src/debug/elf/elf.go | 80 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 api/next/54222.txt diff --git a/api/next/54222.txt b/api/next/54222.txt new file mode 100644 index 00000000000..73ae5a40ede --- /dev/null +++ b/api/next/54222.txt @@ -0,0 +1,78 @@ +pkg debug/elf, const R_LARCH_32_PCREL = 99 #54222 +pkg debug/elf, const R_LARCH_32_PCREL R_LARCH #54222 +pkg debug/elf, const R_LARCH_ABS64_HI12 = 70 #54222 +pkg debug/elf, const R_LARCH_ABS64_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_ABS64_LO20 = 69 #54222 +pkg debug/elf, const R_LARCH_ABS64_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_ABS_HI20 = 67 #54222 +pkg debug/elf, const R_LARCH_ABS_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_ABS_LO12 = 68 #54222 +pkg debug/elf, const R_LARCH_ABS_LO12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_B16 = 64 #54222 +pkg debug/elf, const R_LARCH_B16 R_LARCH #54222 +pkg debug/elf, const R_LARCH_B21 = 65 #54222 +pkg debug/elf, const R_LARCH_B21 R_LARCH #54222 +pkg debug/elf, const R_LARCH_B26 = 66 #54222 +pkg debug/elf, const R_LARCH_B26 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GNU_VTENTRY = 58 #54222 +pkg debug/elf, const R_LARCH_GNU_VTENTRY R_LARCH #54222 +pkg debug/elf, const R_LARCH_GNU_VTINHERIT = 57 #54222 +pkg debug/elf, const R_LARCH_GNU_VTINHERIT R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT64_HI12 = 82 #54222 +pkg debug/elf, const R_LARCH_GOT64_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT64_LO20 = 81 #54222 +pkg debug/elf, const R_LARCH_GOT64_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT64_PC_HI12 = 78 #54222 +pkg debug/elf, const R_LARCH_GOT64_PC_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT64_PC_LO20 = 77 #54222 +pkg debug/elf, const R_LARCH_GOT64_PC_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT_HI20 = 79 #54222 +pkg debug/elf, const R_LARCH_GOT_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT_LO12 = 80 #54222 +pkg debug/elf, const R_LARCH_GOT_LO12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT_PC_HI20 = 75 #54222 +pkg debug/elf, const R_LARCH_GOT_PC_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_GOT_PC_LO12 = 76 #54222 +pkg debug/elf, const R_LARCH_GOT_PC_LO12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_PCALA64_HI12 = 74 #54222 +pkg debug/elf, const R_LARCH_PCALA64_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_PCALA64_LO20 = 73 #54222 +pkg debug/elf, const R_LARCH_PCALA64_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_PCALA_HI20 = 71 #54222 +pkg debug/elf, const R_LARCH_PCALA_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_PCALA_LO12 = 72 #54222 +pkg debug/elf, const R_LARCH_PCALA_LO12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_RELAX = 100 #54222 +pkg debug/elf, const R_LARCH_RELAX R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_GD_HI20 = 98 #54222 +pkg debug/elf, const R_LARCH_TLS_GD_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_GD_PC_HI20 = 97 #54222 +pkg debug/elf, const R_LARCH_TLS_GD_PC_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_HI12 = 94 #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_LO20 = 93 #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_PC_HI12 = 90 #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_PC_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_PC_LO20 = 89 #54222 +pkg debug/elf, const R_LARCH_TLS_IE64_PC_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE_HI20 = 91 #54222 +pkg debug/elf, const R_LARCH_TLS_IE_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE_LO12 = 92 #54222 +pkg debug/elf, const R_LARCH_TLS_IE_LO12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE_PC_HI20 = 87 #54222 +pkg debug/elf, const R_LARCH_TLS_IE_PC_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_IE_PC_LO12 = 88 #54222 +pkg debug/elf, const R_LARCH_TLS_IE_PC_LO12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_LD_HI20 = 96 #54222 +pkg debug/elf, const R_LARCH_TLS_LD_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_LD_PC_HI20 = 95 #54222 +pkg debug/elf, const R_LARCH_TLS_LD_PC_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_LE64_HI12 = 86 #54222 +pkg debug/elf, const R_LARCH_TLS_LE64_HI12 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_LE64_LO20 = 85 #54222 +pkg debug/elf, const R_LARCH_TLS_LE64_LO20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_LE_HI20 = 83 #54222 +pkg debug/elf, const R_LARCH_TLS_LE_HI20 R_LARCH #54222 +pkg debug/elf, const R_LARCH_TLS_LE_LO12 = 84 #54222 +pkg debug/elf, const R_LARCH_TLS_LE_LO12 R_LARCH #54222 diff --git a/src/debug/elf/elf.go b/src/debug/elf/elf.go index 5b2e6d9d3fd..095c0898ec8 100644 --- a/src/debug/elf/elf.go +++ b/src/debug/elf/elf.go @@ -2152,7 +2152,7 @@ var rmipsStrings = []intName{ func (i R_MIPS) String() string { return stringName(uint32(i), rmipsStrings, false) } func (i R_MIPS) GoString() string { return stringName(uint32(i), rmipsStrings, true) } -// Relocation types for LARCH. +// Relocation types for LoongArch. type R_LARCH int const ( @@ -2206,6 +2206,45 @@ const ( R_LARCH_SUB24 R_LARCH = 54 R_LARCH_SUB32 R_LARCH = 55 R_LARCH_SUB64 R_LARCH = 56 + R_LARCH_GNU_VTINHERIT R_LARCH = 57 + R_LARCH_GNU_VTENTRY R_LARCH = 58 + R_LARCH_B16 R_LARCH = 64 + R_LARCH_B21 R_LARCH = 65 + R_LARCH_B26 R_LARCH = 66 + R_LARCH_ABS_HI20 R_LARCH = 67 + R_LARCH_ABS_LO12 R_LARCH = 68 + R_LARCH_ABS64_LO20 R_LARCH = 69 + R_LARCH_ABS64_HI12 R_LARCH = 70 + R_LARCH_PCALA_HI20 R_LARCH = 71 + R_LARCH_PCALA_LO12 R_LARCH = 72 + R_LARCH_PCALA64_LO20 R_LARCH = 73 + R_LARCH_PCALA64_HI12 R_LARCH = 74 + R_LARCH_GOT_PC_HI20 R_LARCH = 75 + R_LARCH_GOT_PC_LO12 R_LARCH = 76 + R_LARCH_GOT64_PC_LO20 R_LARCH = 77 + R_LARCH_GOT64_PC_HI12 R_LARCH = 78 + R_LARCH_GOT_HI20 R_LARCH = 79 + R_LARCH_GOT_LO12 R_LARCH = 80 + R_LARCH_GOT64_LO20 R_LARCH = 81 + R_LARCH_GOT64_HI12 R_LARCH = 82 + R_LARCH_TLS_LE_HI20 R_LARCH = 83 + R_LARCH_TLS_LE_LO12 R_LARCH = 84 + R_LARCH_TLS_LE64_LO20 R_LARCH = 85 + R_LARCH_TLS_LE64_HI12 R_LARCH = 86 + R_LARCH_TLS_IE_PC_HI20 R_LARCH = 87 + R_LARCH_TLS_IE_PC_LO12 R_LARCH = 88 + R_LARCH_TLS_IE64_PC_LO20 R_LARCH = 89 + R_LARCH_TLS_IE64_PC_HI12 R_LARCH = 90 + R_LARCH_TLS_IE_HI20 R_LARCH = 91 + R_LARCH_TLS_IE_LO12 R_LARCH = 92 + R_LARCH_TLS_IE64_LO20 R_LARCH = 93 + R_LARCH_TLS_IE64_HI12 R_LARCH = 94 + R_LARCH_TLS_LD_PC_HI20 R_LARCH = 95 + R_LARCH_TLS_LD_HI20 R_LARCH = 96 + R_LARCH_TLS_GD_PC_HI20 R_LARCH = 97 + R_LARCH_TLS_GD_HI20 R_LARCH = 98 + R_LARCH_32_PCREL R_LARCH = 99 + R_LARCH_RELAX R_LARCH = 100 ) var rlarchStrings = []intName{ @@ -2259,6 +2298,45 @@ var rlarchStrings = []intName{ {54, "R_LARCH_SUB24"}, {55, "R_LARCH_SUB32"}, {56, "R_LARCH_SUB64"}, + {57, "R_LARCH_GNU_VTINHERIT"}, + {58, "R_LARCH_GNU_VTENTRY"}, + {64, "R_LARCH_B16"}, + {65, "R_LARCH_B21"}, + {66, "R_LARCH_B26"}, + {67, "R_LARCH_ABS_HI20"}, + {68, "R_LARCH_ABS_LO12"}, + {69, "R_LARCH_ABS64_LO20"}, + {70, "R_LARCH_ABS64_HI12"}, + {71, "R_LARCH_PCALA_HI20"}, + {72, "R_LARCH_PCALA_LO12"}, + {73, "R_LARCH_PCALA64_LO20"}, + {74, "R_LARCH_PCALA64_HI12"}, + {75, "R_LARCH_GOT_PC_HI20"}, + {76, "R_LARCH_GOT_PC_LO12"}, + {77, "R_LARCH_GOT64_PC_LO20"}, + {78, "R_LARCH_GOT64_PC_HI12"}, + {79, "R_LARCH_GOT_HI20"}, + {80, "R_LARCH_GOT_LO12"}, + {81, "R_LARCH_GOT64_LO20"}, + {82, "R_LARCH_GOT64_HI12"}, + {83, "R_LARCH_TLS_LE_HI20"}, + {84, "R_LARCH_TLS_LE_LO12"}, + {85, "R_LARCH_TLS_LE64_LO20"}, + {86, "R_LARCH_TLS_LE64_HI12"}, + {87, "R_LARCH_TLS_IE_PC_HI20"}, + {88, "R_LARCH_TLS_IE_PC_LO12"}, + {89, "R_LARCH_TLS_IE64_PC_LO20"}, + {90, "R_LARCH_TLS_IE64_PC_HI12"}, + {91, "R_LARCH_TLS_IE_HI20"}, + {92, "R_LARCH_TLS_IE_LO12"}, + {93, "R_LARCH_TLS_IE64_LO20"}, + {94, "R_LARCH_TLS_IE64_HI12"}, + {95, "R_LARCH_TLS_LD_PC_HI20"}, + {96, "R_LARCH_TLS_LD_HI20"}, + {97, "R_LARCH_TLS_GD_PC_HI20"}, + {98, "R_LARCH_TLS_GD_HI20"}, + {99, "R_LARCH_32_PCREL"}, + {100, "R_LARCH_RELAX"}, } func (i R_LARCH) String() string { return stringName(uint32(i), rlarchStrings, false) }