musl/arch/sh/reloc.h
Rich Felker 1fb0878ebc fix ldso name for sh-nofpu subarch
previously it was using the same name as the default ABI with hard
float (floating point args and return value in registers).

the test __SH_FPU_ANY__ || __SH4__ matches what's used in the
configure script already, and seems correct under casual review
against gcc's config/sh.h, but may need tweaks. the logic for
predefined macros for sh, and what they all mean, is very complex.
eventually this should be documented in comments here.

configure already rejects "half-hard" configurations on sh where
double=float since these do not conform to Annex F and are not
suitable for musl, so these do not need to be considered here.
2015-04-24 13:05:21 -04:00

31 lines
727 B
C

#include <endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define ENDIAN_SUFFIX "eb"
#else
#define ENDIAN_SUFFIX ""
#endif
#if __SH_FPU_ANY__ || __SH4__
#define FP_SUFFIX ""
#else
#define FP_SUFFIX "-nofpu"
#endif
#define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX
#define TPOFF_K 8
#define REL_SYMBOLIC R_SH_DIR32
#define REL_OFFSET R_SH_REL32
#define REL_GOT R_SH_GLOB_DAT
#define REL_PLT R_SH_JMP_SLOT
#define REL_RELATIVE R_SH_RELATIVE
#define REL_COPY R_SH_COPY
#define REL_DTPMOD R_SH_TLS_DTPMOD32
#define REL_DTPOFF R_SH_TLS_DTPOFF32
#define REL_TPOFF R_SH_TLS_TPOFF32
#define CRTJMP(pc,sp) __asm__ __volatile__( \
"jmp @%0 ; mov %1,r15" : : "r"(pc), "r"(sp) : "memory" )