summaryrefslogtreecommitdiff
path: root/libc/cbb-musl-elf.h
blob: 0f468238b4dc21e308abc53ed2e985d195bd0373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*************************************************************************/
/*  compiler building blocks: definitions for all musl-libc ELF targets  */
/*************************************************************************/

#ifndef __ASSEMBLER__

#include "cbb-common.h"

#ifdef __cplusplus
extern "C" {
#endif


/* features */
#undef	TARGET_C99_FUNCTIONS
#define	TARGET_C99_FUNCTIONS		(1)

#undef  TARGET_HAS_SINCOS
#define TARGET_HAS_SINCOS		(0)

#undef  TARGET_POSIX_IO
#define TARGET_POSIX_IO			(1)


/* preferences */
#undef  NO_IMPLICIT_EXTERN_C
#define NO_IMPLICIT_EXTERN_C		(1)

#undef  GTHREAD_USE_WEAK
#define GTHREAD_USE_WEAK		(0)

#undef  USE_PT_GNU_EH_FRAME
#define USE_PT_GNU_EH_FRAME		(1)

#undef  STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR		"/include"

#undef  LOCAL_INCLUDE_DIR
#define LOCAL_INCLUDE_DIR		"/local/include"

#undef  STANDARD_STARTFILE_PREFIX_1
#define STANDARD_STARTFILE_PREFIX_1	"/local/lib"

#undef  STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_2 	"/lib"


/* arch */
#define CBB_STR(s)		#s
#define CBB_XSTR(s)		CBB_STR(s)

#undef  MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER	"ld-musl-" CBB_XSTR(CBB_ARCH) ".so.1"

#ifndef CBB_LINK_EMULATION
#define CBB_LINK_EMULATION	""
#endif

#undef  LINK_EMULATION
#define LINK_EMULATION		CBB_LINK_EMULATION


/* specs */
#undef  CC1_SPEC
#define CC1_SPEC		"%(cc1_cpu) %{profile:-p}"

#undef  CPP_SPEC
#define CPP_SPEC		"%{posix:-D_POSIX_SOURCE}"

#undef  STARTFILE_PREFIX_SPEC
#define STARTFILE_PREFIX_SPEC	"%R/lib/"

#undef  LINK_EH_SPEC
#define LINK_EH_SPEC		" --eh-frame-hdr "

#undef  LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC						   \
				"%{static:--start-group} "			   \
				"%L %G "					   \
				"%{static:--end-group}%{!static:%G} "		   \
				"--as-needed -lc"

#undef  LIB_SPEC
#define LIB_SPEC		"%{pthread:-lpthread} "				   \
				"%{shared:-lc} "

#undef  STARTFILE_SPEC
#define STARTFILE_SPEC		"%{!shared: "					   \
					"%(startfile_prefix_spec)%{pie:S}crt1.o} " \
					"%(startfile_prefix_spec)crti.o "	   \
				"%{shared|pie:"					   \
					"crtbeginS.o%s;:crtbegin.o%s}"

#undef  ENDFILE_SPEC
#define ENDFILE_SPEC		"%{shared|pie:crtendS.o%s;:crtend.o%s} "	   \
				"%(startfile_prefix_spec)crtn.o"


#undef  LINK_EMULATION_SPEC
#define LINK_EMULATION_SPEC	{ "link_emulation", LINK_EMULATION }

#undef  DYNAMIC_LINKER_SPEC
#define DYNAMIC_LINKER_SPEC	{ "dynamic_linker", \
				  "%(startfile_prefix_spec)" MUSL_DYNAMIC_LINKER }

#undef  SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS	LINK_EMULATION_SPEC , DYNAMIC_LINKER_SPEC

#undef  LINK_SPEC
#define LINK_SPEC		"-dynamic-linker %(dynamic_linker) "		   \
				"%{shared:-shared} "				   \
				"%{static:-static} "				   \
				"%{rdynamic:-export-dynamic}"


#ifdef __cplusplus
}
#endif

#endif /* __ASSEMBLER__ */