Skip to content

Commit 76d7ffa

Browse files
committed
add reloc type R_KEEP
1 parent 3b6cea6 commit 76d7ffa

8 files changed

+16
-2
lines changed

Diff for: objabi/reloctype/reloctype.1.16.go

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const (
6363

6464
const (
6565
//not used, only adapter golang higher version
66+
R_KEEP = 0x10000000 - 10
6667
R_INITORDER = 0x10000000 - 9
6768
R_ARM64_PCREL_LDST8 = 0x10000000 - 8
6869
R_ARM64_PCREL_LDST16 = 0x10000000 - 7

Diff for: objabi/reloctype/reloctype.1.17.go

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ const (
5353
// *rtype, and may be set to zero by the linker if it determines the method
5454
// text is unreachable by the linked program.
5555
R_METHODOFF = (int)(objabi.R_METHODOFF)
56+
// R_KEEP tells the linker to keep the referred-to symbol in the final binary
57+
// if the symbol containing the R_KEEP relocation is in the final binary.
58+
R_KEEP = (int)(objabi.R_KEEP)
5659

5760
R_GOTPCREL = (int)(objabi.R_GOTPCREL)
5861

@@ -70,6 +73,7 @@ const (
7073

7174
const (
7275
//not used, only adapter golang higher version
76+
7377
R_INITORDER = 0x10000000 - 9
7478
R_ARM64_PCREL_LDST8 = 0x10000000 - 8
7579
R_ARM64_PCREL_LDST16 = 0x10000000 - 7

Diff for: objabi/reloctype/reloctype.1.20.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ const (
5353
// *rtype, and may be set to zero by the linker if it determines the method
5454
// text is unreachable by the linked program.
5555
R_METHODOFF = (int)(objabi.R_METHODOFF)
56-
56+
// R_KEEP tells the linker to keep the referred-to symbol in the final binary
57+
// if the symbol containing the R_KEEP relocation is in the final binary.
58+
R_KEEP = (int)(objabi.R_KEEP)
5759
// R_ADDRCUOFF resolves to a pointer-sized offset from the start of the
5860
// symbol's DWARF compile unit.
5961
R_ADDRCUOFF = (int)(objabi.R_ADDRCUOFF)

Diff for: objabi/reloctype/reloctype.1.21.go

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ const (
5353
// *rtype, and may be set to zero by the linker if it determines the method
5454
// text is unreachable by the linked program.
5555
R_METHODOFF = (int)(objabi.R_METHODOFF)
56+
// R_KEEP tells the linker to keep the referred-to symbol in the final binary
57+
// if the symbol containing the R_KEEP relocation is in the final binary.
58+
R_KEEP = (int)(objabi.R_KEEP)
5659

5760
// R_ADDRCUOFF resolves to a pointer-sized offset from the start of the
5861
// symbol's DWARF compile unit.

Diff for: objabi/reloctype/reloctype.1.8.go

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const (
4949

5050
const (
5151
//not used, only adapter golang higher version
52+
R_KEEP = 0x10000000 - 10
5253
R_INITORDER = 0x10000000 - 9
5354
R_ARM64_PCREL_LDST8 = 0x10000000 - 8
5455
R_ARM64_PCREL_LDST16 = 0x10000000 - 7

Diff for: objabi/reloctype/reloctype.1.9.go

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const (
4949

5050
const (
5151
//not used, only adapter golang higher version
52+
R_KEEP = 0x10000000 - 10
5253
R_INITORDER = 0x10000000 - 9
5354
R_ARM64_PCREL_LDST8 = 0x10000000 - 8
5455
R_ARM64_PCREL_LDST16 = 0x10000000 - 7

Diff for: register.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func typelinksRegister(symPtr map[string]uintptr) {
2626
if int(f.funcoff) < len(md.pclntable) {
2727
_func := (*_func)(unsafe.Pointer(&(md.pclntable[f.funcoff])))
2828
name := getfuncname(_func, &md)
29-
if !strings.HasPrefix(name, constants.TypeDoubleDotPrefix) && name != EmptyString {
29+
if name != EmptyString {
3030
if _, ok := symPtr[name]; !ok {
3131
symPtr[name] = getfuncentry(_func, md.text)
3232
}

Diff for: relocate.go

+2
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ func (linker *Linker) relocate(codeModule *CodeModule, symbolMap, symPtr map[str
332332
reloctype.R_ADDRCUOFF,
333333
reloctype.R_INITORDER:
334334
//nothing todo
335+
case reloctype.R_KEEP:
336+
//nothing todo
335337
default:
336338
err = fmt.Errorf("unknown reloc type:%s sym:%s", reloctype.RelocTypeString(loc.Type), loc.SymName)
337339
}

0 commit comments

Comments
 (0)