github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/objabi/reloctype/reloctype.1.17.go (about) 1 //go:build go1.17 && !go1.20 2 // +build go1.17,!go1.20 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_CALL = (int)(objabi.R_CALL) 18 R_CALLARM = (int)(objabi.R_CALLARM) 19 R_CALLARM64 = (int)(objabi.R_CALLARM64) 20 R_CALLIND = (int)(objabi.R_CALLIND) 21 R_PCREL = (int)(objabi.R_PCREL) 22 // R_TLS_LE, used on 386, amd64, and ARM, resolves to the offset of the 23 // thread-local symbol from the thread local base and is used to implement the 24 // "local exec" model for tls access (r.Sym is not set on intel platforms but is 25 // set to a TLS symbol -- runtime.tlsg -- in the linker when externally linking). 26 R_TLS_LE = (int)(objabi.R_TLS_LE) 27 // R_TLS_IE, used 386, amd64, and ARM resolves to the PC-relative offset to a GOT 28 // slot containing the offset from the thread-local symbol from the thread local 29 // base and is used to implemented the "initial exec" model for tls access (r.Sym 30 // is not set on intel platforms but is set to a TLS symbol -- runtime.tlsg -- in 31 // the linker when externally linking). 32 R_TLS_IE = (int)(objabi.R_TLS_IE) 33 R_USEFIELD = (int)(objabi.R_USEFIELD) 34 // R_USETYPE resolves to an *rtype, but no relocation is created. The 35 // linker uses this as a signal that the pointed-to type information 36 // should be linked into the final binary, even if there are no other 37 // direct references. (This is used for types reachable by reflection.) 38 R_USETYPE = (int)(objabi.R_USETYPE) 39 // R_USEIFACE marks a type is converted to an interface in the function this 40 // relocation is applied to. The target is a type descriptor. 41 // This is a marker relocation (0-sized), for the linker's reachabililty 42 // analysis. 43 R_USEIFACE = (int)(objabi.R_USEIFACE) 44 // R_USEIFACEMETHOD marks an interface method that is used in the function 45 // this relocation is applied to. The target is an interface type descriptor. 46 // The addend is the offset of the method in the type descriptor. 47 // This is a marker relocation (0-sized), for the linker's reachabililty 48 // analysis. 49 R_USEIFACEMETHOD = (int)(objabi.R_USEIFACEMETHOD) 50 // R_METHODOFF resolves to a 32-bit offset from the beginning of the section 51 // holding the data being relocated to the referenced symbol. 52 // It is a variant of R_ADDROFF used when linking from the uncommonType of a 53 // *rtype, and may be set to zero by the linker if it determines the method 54 // text is unreachable by the linked program. 55 R_METHODOFF = (int)(objabi.R_METHODOFF) 56 57 // R_ADDRCUOFF resolves to a pointer-sized offset from the start of the 58 // symbol's DWARF compile unit. 59 R_ADDRCUOFF = (int)(objabi.R_ADDRCUOFF) 60 61 // R_KEEP tells the linker to keep the referred-to symbol in the final binary 62 // if the symbol containing the R_KEEP relocation is in the final binary. 63 R_KEEP = (int)(objabi.R_KEEP) 64 65 R_GOTPCREL = (int)(objabi.R_GOTPCREL) 66 67 // Set a MOV[NZ] immediate field to bits [15:0] of the offset from the thread 68 // local base to the thread local variable defined by the referenced (thread 69 // local) symbol. Error if the offset does not fit into 16 bits. 70 R_ARM64_TLS_LE = (int)(objabi.R_ARM64_TLS_LE) 71 72 // Relocates an ADRP; LD64 instruction sequence to load the offset between 73 // the thread local base and the thread local variable defined by the 74 // referenced (thread local) symbol from the GOT. 75 R_ARM64_TLS_IE = int(objabi.R_ARM64_TLS_IE) 76 77 // R_ARM64_GOTPCREL relocates an adrp, ld64 pair to compute the address of the GOT 78 // slot of the referenced symbol. 79 R_ARM64_GOTPCREL = (int)(objabi.R_ARM64_GOTPCREL) 80 81 R_WEAK = 0x8000 82 83 R_WEAKADDR = R_WEAK | R_ADDR 84 R_WEAKADDROFF = R_WEAK | R_ADDROFF 85 ) 86 87 const ( 88 //not used, only adapter golang higher version 89 R_INITORDER = 0x10000000 - 9 90 R_ARM64_PCREL_LDST8 = 0x10000000 - 8 91 R_ARM64_PCREL_LDST16 = 0x10000000 - 7 92 R_ARM64_PCREL_LDST32 = 0x10000000 - 6 93 R_ARM64_PCREL_LDST64 = 0x10000000 - 5 94 )