]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link/internal/loadelf: add additional relocations for riscv64
authorJoel Sing <joel@sing.id.au>
Sat, 17 Sep 2022 16:32:42 +0000 (02:32 +1000)
committerJoel Sing <joel@sing.id.au>
Wed, 28 Sep 2022 16:43:13 +0000 (16:43 +0000)
These relocations are produced by clang/llvm.

Change-Id: I4820e7ed805d1b7341023b263c167a285ca32cf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/431755
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/link/internal/loadelf/ldelf.go

index da02223212c0f3f1a8fc06c831c25c98f9250a92..7ac769999663d0390c8217a8ee935c47d13a0c96 100644 (file)
@@ -1086,8 +1086,16 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
                S390X | uint32(elf.R_390_PLT64)<<16:
                return 8, 8, nil
 
+       case RISCV64 | uint32(elf.R_RISCV_SET6)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SUB6)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SET8)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SUB8)<<16:
+               return 1, 1, nil
+
        case RISCV64 | uint32(elf.R_RISCV_RVC_BRANCH)<<16,
-               RISCV64 | uint32(elf.R_RISCV_RVC_JUMP)<<16:
+               RISCV64 | uint32(elf.R_RISCV_RVC_JUMP)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SET16)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SUB16)<<16:
                return 2, 2, nil
 
        case RISCV64 | uint32(elf.R_RISCV_32)<<16,
@@ -1099,6 +1107,10 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
                RISCV64 | uint32(elf.R_RISCV_PCREL_HI20)<<16,
                RISCV64 | uint32(elf.R_RISCV_PCREL_LO12_I)<<16,
                RISCV64 | uint32(elf.R_RISCV_PCREL_LO12_S)<<16,
+               RISCV64 | uint32(elf.R_RISCV_ADD32)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SET32)<<16,
+               RISCV64 | uint32(elf.R_RISCV_SUB32)<<16,
+               RISCV64 | uint32(elf.R_RISCV_32_PCREL)<<16,
                RISCV64 | uint32(elf.R_RISCV_RELAX)<<16:
                return 4, 4, nil