|
|
|
|
#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__)
|
|
|
|
|
#define FP_SUFFIX "-sf"
|
|
|
|
|
#else
|
|
|
|
|
#define FP_SUFFIX ""
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define LDSO_ARCH "powerpc" FP_SUFFIX
|
|
|
|
|
|
|
|
|
|
#define TPOFF_K (-0x7000)
|
|
|
|
|
|
|
|
|
|
#define REL_SYMBOLIC R_PPC_ADDR32
|
add support for powerpc/powerpc64 unaligned relocations
R_PPC_UADDR32 (R_PPC64_UADDR64) has the same meaning as R_PPC_ADDR32
(R_PPC64_ADDR64), except that its address need not be aligned. For
powerpc64, BFD ld(1) will automatically convert between ADDR<->UADDR
relocations when the address is/isn't at its native alignment. This
will happen if, for example, there is a pointer in a packed struct.
gold and lld do not currently generate R_PPC64_UADDR64, but pass
through misaligned R_PPC64_ADDR64 relocations from object files,
possibly relaxing them to misaligned R_PPC64_RELATIVE. In both cases
(relaxed or not) this violates the PSABI, which defines the relevant
field type as "a 64-bit field occupying 8 bytes, the alignment of
which is 8 bytes unless otherwise specified."
All three linkers violate the PSABI on 32-bit powerpc, where the only
difference is that the field is 32 bits wide, aligned to 4 bytes.
Currently musl fails to load executables linked by BFD ld containing
R_PPC64_UADDR64, with the error "unsupported relocation type 43".
This change provides compatibility with BFD ld on powerpc64, and any
static linker on either architecture that starts following the PSABI
more closely.
7 years ago
|
|
|
#define REL_USYMBOLIC R_PPC_UADDR32
|
|
|
|
|
#define REL_GOT R_PPC_GLOB_DAT
|
|
|
|
|
#define REL_PLT R_PPC_JMP_SLOT
|
|
|
|
|
#define REL_RELATIVE R_PPC_RELATIVE
|
|
|
|
|
#define REL_COPY R_PPC_COPY
|
|
|
|
|
#define REL_DTPMOD R_PPC_DTPMOD32
|
|
|
|
|
#define REL_DTPOFF R_PPC_DTPREL32
|
|
|
|
|
#define REL_TPOFF R_PPC_TPREL32
|
|
|
|
|
|
|
|
|
|
#define CRTJMP(pc,sp) __asm__ __volatile__( \
|
|
|
|
|
"mr 1,%1 ; mtlr %0 ; blr" : : "r"(pc), "r"(sp) : "memory" )
|
|
|
|
|
|
|
|
|
|
#define GETFUNCSYM(fp, sym, got) __asm__ ( \
|
|
|
|
|
".hidden " #sym " \n" \
|
|
|
|
|
" bl 1f \n" \
|
|
|
|
|
" .long " #sym "-. \n" \
|
|
|
|
|
"1: mflr %1 \n" \
|
|
|
|
|
" lwz %0, 0(%1) \n" \
|
|
|
|
|
" add %0, %0, %1 \n" \
|
|
|
|
|
: "=r"(*(fp)), "=r"((int){0}) : : "memory", "lr" )
|