github.com/pkujhd/goloader@v0.0.0-20240411034752-1a28096bd7bd/objabi/reloctype/reloctype.1.9.go (about)

     1  //go:build go1.9 && !go1.16
     2  // +build go1.9,!go1.16
     3  
     4  package reloctype
     5  
     6  import "cmd/objfile/objabi"
     7  
     8  // copy from $GOROOT/src/cmd/internal/objabi/reloctype.go
     9  const (
    10  	R_ADDR = (int)(objabi.R_ADDR)
    11  	// R_ADDRARM64 relocates an adrp, add pair to compute the address of the
    12  	// referenced symbol.
    13  	R_ADDRARM64 = (int)(objabi.R_ADDRARM64)
    14  	// R_ADDROFF resolves to a 32-bit offset from the beginning of the section
    15  	// holding the data being relocated to the referenced symbol.
    16  	R_ADDROFF = (int)(objabi.R_ADDROFF)
    17  	// R_WEAKADDROFF resolves just like R_ADDROFF but is a weak relocation.
    18  	// A weak relocation does not make the symbol it refers to reachable,
    19  	// and is only honored by the linker if the symbol is in some other way
    20  	// reachable.
    21  	R_WEAKADDROFF = (int)(objabi.R_WEAKADDROFF)
    22  	R_CALL        = (int)(objabi.R_CALL)
    23  	R_CALLARM     = (int)(objabi.R_CALLARM)
    24  	R_CALLARM64   = (int)(objabi.R_CALLARM64)
    25  	R_CALLIND     = (int)(objabi.R_CALLIND)
    26  	R_PCREL       = (int)(objabi.R_PCREL)
    27  	// R_TLS_LE, used on 386, amd64, and ARM, resolves to the offset of the
    28  	// thread-local symbol from the thread local base and is used to implement the
    29  	// "local exec" model for tls access (r.Sym is not set on intel platforms but is
    30  	// set to a TLS symbol -- runtime.tlsg -- in the linker when externally linking).
    31  	R_TLS_LE = (int)(objabi.R_TLS_LE)
    32  	// R_TLS_IE, used 386, amd64, and ARM resolves to the PC-relative offset to a GOT
    33  	// slot containing the offset from the thread-local symbol from the thread local
    34  	// base and is used to implemented the "initial exec" model for tls access (r.Sym
    35  	// is not set on intel platforms but is set to a TLS symbol -- runtime.tlsg -- in
    36  	// the linker when externally linking).
    37  	R_TLS_IE = (int)(objabi.R_TLS_IE)
    38  	// R_METHODOFF resolves to a 32-bit offset from the beginning of the section
    39  	// holding the data being relocated to the referenced symbol.
    40  	// It is a variant of R_ADDROFF used when linking from the uncommonType of a
    41  	// *rtype, and may be set to zero by the linker if it determines the method
    42  	// text is unreachable by the linked program.
    43  	R_METHODOFF = (int)(objabi.R_METHODOFF)
    44  
    45  	R_GOTPCREL = (int)(objabi.R_GOTPCREL)
    46  
    47  	R_ARM64_GOTPCREL = (int)(objabi.R_ARM64_GOTPCREL)
    48  )
    49  
    50  const (
    51  	//not used, only adapter golang higher version
    52  	R_KEEP               = 0x10000000 - 10
    53  	R_INITORDER          = 0x10000000 - 9
    54  	R_ARM64_PCREL_LDST8  = 0x10000000 - 8
    55  	R_ARM64_PCREL_LDST16 = 0x10000000 - 7
    56  	R_ARM64_PCREL_LDST32 = 0x10000000 - 6
    57  	R_ARM64_PCREL_LDST64 = 0x10000000 - 5
    58  	R_USETYPE            = 0x10000000 - 4
    59  	R_USEIFACE           = 0x10000000 - 3
    60  	R_USEIFACEMETHOD     = 0x10000000 - 2
    61  	R_ADDRCUOFF          = 0x10000000 - 1
    62  	R_WEAKADDR           = 0x20000000
    63  	R_WEAK               = 0x8000
    64  )
    65  
    66  func RelocTypeString(relocType int) string {
    67  	return (objabi.RelocType)(relocType).String()
    68  }