Skip to content

Commit 84da0e1

Browse files
committed
[builtins] Use aliases for function redirects
Symbol aliases are supported by all platforms that compiler-rt builtins target, and we can use these instead of function redirects to avoid the extra indirection. This is part of the cleanup proposed in "[RFC] compiler-rt builtins cleanup and refactoring". Differential Revision: https://reviews.llvm.org/D60931 llvm-svn: 359413
1 parent aec5dcc commit 84da0e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+85
-95
lines changed

compiler-rt/lib/builtins/adddf3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ COMPILER_RT_ABI double __adddf3(double a, double b) { return __addXf3__(a, b); }
2020
#if defined(COMPILER_RT_ARMHF_TARGET)
2121
AEABI_RTABI double __aeabi_dadd(double a, double b) { return __adddf3(a, b); }
2222
#else
23-
AEABI_RTABI double __aeabi_dadd(double a, double b) COMPILER_RT_ALIAS(__adddf3);
23+
COMPILER_RT_ALIAS(__adddf3, __aeabi_dadd)
2424
#endif
2525
#endif

compiler-rt/lib/builtins/addsf3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ COMPILER_RT_ABI float __addsf3(float a, float b) { return __addXf3__(a, b); }
2020
#if defined(COMPILER_RT_ARMHF_TARGET)
2121
AEABI_RTABI float __aeabi_fadd(float a, float b) { return __addsf3(a, b); }
2222
#else
23-
AEABI_RTABI float __aeabi_fadd(float a, float b) COMPILER_RT_ALIAS(__addsf3);
23+
COMPILER_RT_ALIAS(__addsf3, __aeabi_fadd)
2424
#endif
2525
#endif

compiler-rt/lib/builtins/ashldi3.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@ COMPILER_RT_ABI di_int __ashldi3(di_int a, si_int b) {
3434
}
3535

3636
#if defined(__ARM_EABI__)
37-
AEABI_RTABI di_int __aeabi_llsl(di_int a, si_int b)
38-
COMPILER_RT_ALIAS(__ashldi3);
37+
COMPILER_RT_ALIAS(__ashldi3, __aeabi_llsl)
3938
#endif

compiler-rt/lib/builtins/ashrdi3.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@ COMPILER_RT_ABI di_int __ashrdi3(di_int a, si_int b) {
3535
}
3636

3737
#if defined(__ARM_EABI__)
38-
AEABI_RTABI di_int __aeabi_lasr(di_int a, si_int b)
39-
COMPILER_RT_ALIAS(__ashrdi3);
38+
COMPILER_RT_ALIAS(__ashrdi3, __aeabi_lasr)
4039
#endif

compiler-rt/lib/builtins/comparedf2.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ COMPILER_RT_ABI enum LE_RESULT __ledf2(fp_t a, fp_t b) {
8383

8484
#if defined(__ELF__)
8585
// Alias for libgcc compatibility
86-
FNALIAS(__cmpdf2, __ledf2);
86+
COMPILER_RT_ALIAS(__ledf2, __cmpdf2)
8787
#endif
88+
COMPILER_RT_ALIAS(__ledf2, __eqdf2)
89+
COMPILER_RT_ALIAS(__ledf2, __ltdf2)
90+
COMPILER_RT_ALIAS(__ledf2, __nedf2)
8891

8992
enum GE_RESULT {
9093
GE_LESS = -1,
@@ -121,26 +124,19 @@ COMPILER_RT_ABI enum GE_RESULT __gedf2(fp_t a, fp_t b) {
121124
}
122125
}
123126

124-
COMPILER_RT_ABI int __unorddf2(fp_t a, fp_t b) {
125-
const rep_t aAbs = toRep(a) & absMask;
126-
const rep_t bAbs = toRep(b) & absMask;
127-
return aAbs > infRep || bAbs > infRep;
128-
}
129-
130-
// The following are alternative names for the preceding routines.
131-
132-
COMPILER_RT_ABI enum LE_RESULT __eqdf2(fp_t a, fp_t b) { return __ledf2(a, b); }
127+
COMPILER_RT_ALIAS(__gedf2, __gtdf2)
133128

134-
COMPILER_RT_ABI enum LE_RESULT __ltdf2(fp_t a, fp_t b) { return __ledf2(a, b); }
135-
136-
COMPILER_RT_ABI enum LE_RESULT __nedf2(fp_t a, fp_t b) { return __ledf2(a, b); }
137-
138-
COMPILER_RT_ABI enum GE_RESULT __gtdf2(fp_t a, fp_t b) { return __gedf2(a, b); }
129+
COMPILER_RT_ABI int
130+
__unorddf2(fp_t a, fp_t b) {
131+
const rep_t aAbs = toRep(a) & absMask;
132+
const rep_t bAbs = toRep(b) & absMask;
133+
return aAbs > infRep || bAbs > infRep;
134+
}
139135

140136
#if defined(__ARM_EABI__)
141137
#if defined(COMPILER_RT_ARMHF_TARGET)
142138
AEABI_RTABI int __aeabi_dcmpun(fp_t a, fp_t b) { return __unorddf2(a, b); }
143139
#else
144-
AEABI_RTABI int __aeabi_dcmpun(fp_t a, fp_t b) COMPILER_RT_ALIAS(__unorddf2);
140+
COMPILER_RT_ALIAS(__unorddf2, __aeabi_dcmpun)
145141
#endif
146142
#endif

compiler-rt/lib/builtins/comparesf2.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ COMPILER_RT_ABI enum LE_RESULT __lesf2(fp_t a, fp_t b) {
8383

8484
#if defined(__ELF__)
8585
// Alias for libgcc compatibility
86-
FNALIAS(__cmpsf2, __lesf2);
86+
COMPILER_RT_ALIAS(__lesf2, __cmpsf2)
8787
#endif
88+
COMPILER_RT_ALIAS(__lesf2, __eqsf2)
89+
COMPILER_RT_ALIAS(__lesf2, __ltsf2)
90+
COMPILER_RT_ALIAS(__lesf2, __nesf2)
8891

8992
enum GE_RESULT {
9093
GE_LESS = -1,
@@ -121,26 +124,19 @@ COMPILER_RT_ABI enum GE_RESULT __gesf2(fp_t a, fp_t b) {
121124
}
122125
}
123126

124-
COMPILER_RT_ABI int __unordsf2(fp_t a, fp_t b) {
125-
const rep_t aAbs = toRep(a) & absMask;
126-
const rep_t bAbs = toRep(b) & absMask;
127-
return aAbs > infRep || bAbs > infRep;
128-
}
129-
130-
// The following are alternative names for the preceding routines.
131-
132-
COMPILER_RT_ABI enum LE_RESULT __eqsf2(fp_t a, fp_t b) { return __lesf2(a, b); }
127+
COMPILER_RT_ALIAS(__gesf2, __gtsf2)
133128

134-
COMPILER_RT_ABI enum LE_RESULT __ltsf2(fp_t a, fp_t b) { return __lesf2(a, b); }
135-
136-
COMPILER_RT_ABI enum LE_RESULT __nesf2(fp_t a, fp_t b) { return __lesf2(a, b); }
137-
138-
COMPILER_RT_ABI enum GE_RESULT __gtsf2(fp_t a, fp_t b) { return __gesf2(a, b); }
129+
COMPILER_RT_ABI int
130+
__unordsf2(fp_t a, fp_t b) {
131+
const rep_t aAbs = toRep(a) & absMask;
132+
const rep_t bAbs = toRep(b) & absMask;
133+
return aAbs > infRep || bAbs > infRep;
134+
}
139135

140136
#if defined(__ARM_EABI__)
141137
#if defined(COMPILER_RT_ARMHF_TARGET)
142138
AEABI_RTABI int __aeabi_fcmpun(fp_t a, fp_t b) { return __unordsf2(a, b); }
143139
#else
144-
AEABI_RTABI int __aeabi_fcmpun(fp_t a, fp_t b) COMPILER_RT_ALIAS(__unordsf2);
140+
COMPILER_RT_ALIAS(__unordsf2, __aeabi_fcmpun)
145141
#endif
146142
#endif

compiler-rt/lib/builtins/comparetf2.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ COMPILER_RT_ABI enum LE_RESULT __letf2(fp_t a, fp_t b) {
8282

8383
#if defined(__ELF__)
8484
// Alias for libgcc compatibility
85-
FNALIAS(__cmptf2, __letf2);
85+
COMPILER_RT_ALIAS(__letf2, __cmptf2)
8686
#endif
87+
COMPILER_RT_ALIAS(__letf2, __eqtf2)
88+
COMPILER_RT_ALIAS(__letf2, __lttf2)
89+
COMPILER_RT_ALIAS(__letf2, __netf2)
8790

8891
enum GE_RESULT {
8992
GE_LESS = -1,
@@ -120,20 +123,12 @@ COMPILER_RT_ABI enum GE_RESULT __getf2(fp_t a, fp_t b) {
120123
}
121124
}
122125

126+
COMPILER_RT_ALIAS(__getf2, __gttf2)
127+
123128
COMPILER_RT_ABI int __unordtf2(fp_t a, fp_t b) {
124129
const rep_t aAbs = toRep(a) & absMask;
125130
const rep_t bAbs = toRep(b) & absMask;
126131
return aAbs > infRep || bAbs > infRep;
127132
}
128133

129-
// The following are alternative names for the preceding routines.
130-
131-
COMPILER_RT_ABI enum LE_RESULT __eqtf2(fp_t a, fp_t b) { return __letf2(a, b); }
132-
133-
COMPILER_RT_ABI enum LE_RESULT __lttf2(fp_t a, fp_t b) { return __letf2(a, b); }
134-
135-
COMPILER_RT_ABI enum LE_RESULT __netf2(fp_t a, fp_t b) { return __letf2(a, b); }
136-
137-
COMPILER_RT_ABI enum GE_RESULT __gttf2(fp_t a, fp_t b) { return __getf2(a, b); }
138-
139134
#endif

compiler-rt/lib/builtins/divdf3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,6 @@ COMPILER_RT_ABI fp_t __divdf3(fp_t a, fp_t b) {
207207
#if defined(COMPILER_RT_ARMHF_TARGET)
208208
AEABI_RTABI fp_t __aeabi_ddiv(fp_t a, fp_t b) { return __divdf3(a, b); }
209209
#else
210-
AEABI_RTABI fp_t __aeabi_ddiv(fp_t a, fp_t b) COMPILER_RT_ALIAS(__divdf3);
210+
COMPILER_RT_ALIAS(__divdf3, __aeabi_ddiv)
211211
#endif
212212
#endif

compiler-rt/lib/builtins/divsf3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,6 @@ COMPILER_RT_ABI fp_t __divsf3(fp_t a, fp_t b) {
191191
#if defined(COMPILER_RT_ARMHF_TARGET)
192192
AEABI_RTABI fp_t __aeabi_fdiv(fp_t a, fp_t b) { return __divsf3(a, b); }
193193
#else
194-
AEABI_RTABI fp_t __aeabi_fdiv(fp_t a, fp_t b) COMPILER_RT_ALIAS(__divsf3);
194+
COMPILER_RT_ALIAS(__divsf3, __aeabi_fdiv)
195195
#endif
196196
#endif

compiler-rt/lib/builtins/divsi3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b) {
3131
}
3232

3333
#if defined(__ARM_EABI__)
34-
AEABI_RTABI si_int __aeabi_idiv(si_int a, si_int b) COMPILER_RT_ALIAS(__divsi3);
34+
COMPILER_RT_ALIAS(__divsi3, __aeabi_idiv)
3535
#endif

compiler-rt/lib/builtins/extendhfsf2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ COMPILER_RT_ABI float __gnu_h2f_ieee(uint16_t a) { return __extendhfsf2(a); }
2222
#if defined(COMPILER_RT_ARMHF_TARGET)
2323
AEABI_RTABI float __aeabi_h2f(uint16_t a) { return __extendhfsf2(a); }
2424
#else
25-
AEABI_RTABI float __aeabi_h2f(uint16_t a) COMPILER_RT_ALIAS(__extendhfsf2);
25+
COMPILER_RT_ALIAS(__extendhfsf2, __aeabi_h2f)
2626
#endif
2727
#endif

compiler-rt/lib/builtins/extendsfdf2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ COMPILER_RT_ABI double __extendsfdf2(float a) { return __extendXfYf2__(a); }
1616
#if defined(COMPILER_RT_ARMHF_TARGET)
1717
AEABI_RTABI double __aeabi_f2d(float a) { return __extendsfdf2(a); }
1818
#else
19-
AEABI_RTABI double __aeabi_f2d(float a) COMPILER_RT_ALIAS(__extendsfdf2);
19+
COMPILER_RT_ALIAS(__extendsfdf2, __aeabi_f2d)
2020
#endif
2121
#endif

compiler-rt/lib/builtins/fixdfdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ COMPILER_RT_ABI di_int __fixdfdi(fp_t a) { return __fixint(a); }
3939
#if defined(COMPILER_RT_ARMHF_TARGET)
4040
AEABI_RTABI di_int __aeabi_d2lz(fp_t a) { return __fixdfdi(a); }
4141
#else
42-
AEABI_RTABI di_int __aeabi_d2lz(fp_t a) COMPILER_RT_ALIAS(__fixdfdi);
42+
COMPILER_RT_ALIAS(__fixdfdi, __aeabi_d2lz)
4343
#endif
4444
#endif

compiler-rt/lib/builtins/fixdfsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ COMPILER_RT_ABI si_int __fixdfsi(fp_t a) { return __fixint(a); }
1818
#if defined(COMPILER_RT_ARMHF_TARGET)
1919
AEABI_RTABI si_int __aeabi_d2iz(fp_t a) { return __fixdfsi(a); }
2020
#else
21-
AEABI_RTABI si_int __aeabi_d2iz(fp_t a) COMPILER_RT_ALIAS(__fixdfsi);
21+
COMPILER_RT_ALIAS(__fixdfsi, __aeabi_d2iz)
2222
#endif
2323
#endif

compiler-rt/lib/builtins/fixsfdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ COMPILER_RT_ABI di_int __fixsfdi(fp_t a) { return __fixint(a); }
3939
#if defined(COMPILER_RT_ARMHF_TARGET)
4040
AEABI_RTABI di_int __aeabi_f2lz(fp_t a) { return __fixsfdi(a); }
4141
#else
42-
AEABI_RTABI di_int __aeabi_f2lz(fp_t a) COMPILER_RT_ALIAS(__fixsfdi);
42+
COMPILER_RT_ALIAS(__fixsfdi, __aeabi_f2lz)
4343
#endif
4444
#endif

compiler-rt/lib/builtins/fixsfsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ COMPILER_RT_ABI si_int __fixsfsi(fp_t a) { return __fixint(a); }
1818
#if defined(COMPILER_RT_ARMHF_TARGET)
1919
AEABI_RTABI si_int __aeabi_f2iz(fp_t a) { return __fixsfsi(a); }
2020
#else
21-
AEABI_RTABI si_int __aeabi_f2iz(fp_t a) COMPILER_RT_ALIAS(__fixsfsi);
21+
COMPILER_RT_ALIAS(__fixsfsi, __aeabi_f2iz)
2222
#endif
2323
#endif

compiler-rt/lib/builtins/fixunsdfdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ COMPILER_RT_ABI du_int __fixunsdfdi(fp_t a) { return __fixuint(a); }
3737
#if defined(COMPILER_RT_ARMHF_TARGET)
3838
AEABI_RTABI du_int __aeabi_d2ulz(fp_t a) { return __fixunsdfdi(a); }
3939
#else
40-
AEABI_RTABI du_int __aeabi_d2ulz(fp_t a) COMPILER_RT_ALIAS(__fixunsdfdi);
40+
COMPILER_RT_ALIAS(__fixunsdfdi, __aeabi_d2ulz)
4141
#endif
4242
#endif

compiler-rt/lib/builtins/fixunsdfsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ COMPILER_RT_ABI su_int __fixunsdfsi(fp_t a) { return __fixuint(a); }
1717
#if defined(COMPILER_RT_ARMHF_TARGET)
1818
AEABI_RTABI su_int __aeabi_d2uiz(fp_t a) { return __fixunsdfsi(a); }
1919
#else
20-
AEABI_RTABI su_int __aeabi_d2uiz(fp_t a) COMPILER_RT_ALIAS(__fixunsdfsi);
20+
COMPILER_RT_ALIAS(__fixunsdfsi, __aeabi_d2uiz)
2121
#endif
2222
#endif

compiler-rt/lib/builtins/fixunssfdi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ COMPILER_RT_ABI du_int __fixunssfdi(fp_t a) { return __fixuint(a); }
3838
#if defined(COMPILER_RT_ARMHF_TARGET)
3939
AEABI_RTABI du_int __aeabi_f2ulz(fp_t a) { return __fixunssfdi(a); }
4040
#else
41-
AEABI_RTABI du_int __aeabi_f2ulz(fp_t a) COMPILER_RT_ALIAS(__fixunssfdi);
41+
COMPILER_RT_ALIAS(__fixunssfdi, __aeabi_f2ulz)
4242
#endif
4343
#endif

compiler-rt/lib/builtins/fixunssfsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ COMPILER_RT_ABI su_int __fixunssfsi(fp_t a) { return __fixuint(a); }
2121
#if defined(COMPILER_RT_ARMHF_TARGET)
2222
AEABI_RTABI su_int __aeabi_f2uiz(fp_t a) { return __fixunssfsi(a); }
2323
#else
24-
AEABI_RTABI su_int __aeabi_f2uiz(fp_t a) COMPILER_RT_ALIAS(__fixunssfsi);
24+
COMPILER_RT_ALIAS(__fixunssfsi, __aeabi_f2uiz)
2525
#endif
2626
#endif

compiler-rt/lib/builtins/floatdidf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,6 @@ COMPILER_RT_ABI double __floatdidf(di_int a) {
9898
#if defined(COMPILER_RT_ARMHF_TARGET)
9999
AEABI_RTABI double __aeabi_l2d(di_int a) { return __floatdidf(a); }
100100
#else
101-
AEABI_RTABI double __aeabi_l2d(di_int a) COMPILER_RT_ALIAS(__floatdidf);
101+
COMPILER_RT_ALIAS(__floatdidf, __aeabi_l2d)
102102
#endif
103103
#endif

compiler-rt/lib/builtins/floatdisf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ COMPILER_RT_ABI float __floatdisf(di_int a) {
7070
#if defined(COMPILER_RT_ARMHF_TARGET)
7171
AEABI_RTABI float __aeabi_l2f(di_int a) { return __floatdisf(a); }
7272
#else
73-
AEABI_RTABI float __aeabi_l2f(di_int a) COMPILER_RT_ALIAS(__floatdisf);
73+
COMPILER_RT_ALIAS(__floatdisf, __aeabi_l2f)
7474
#endif
7575
#endif

compiler-rt/lib/builtins/floatsidf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ COMPILER_RT_ABI fp_t __floatsidf(int a) {
5252
#if defined(COMPILER_RT_ARMHF_TARGET)
5353
AEABI_RTABI fp_t __aeabi_i2d(int a) { return __floatsidf(a); }
5454
#else
55-
AEABI_RTABI fp_t __aeabi_i2d(int a) COMPILER_RT_ALIAS(__floatsidf);
55+
COMPILER_RT_ALIAS(__floatsidf, __aeabi_i2d)
5656
#endif
5757
#endif

compiler-rt/lib/builtins/floatsisf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ COMPILER_RT_ABI fp_t __floatsisf(int a) {
6060
#if defined(COMPILER_RT_ARMHF_TARGET)
6161
AEABI_RTABI fp_t __aeabi_i2f(int a) { return __floatsisf(a); }
6262
#else
63-
AEABI_RTABI fp_t __aeabi_i2f(int a) COMPILER_RT_ALIAS(__floatsisf);
63+
COMPILER_RT_ALIAS(__floatsisf, __aeabi_i2f)
6464
#endif
6565
#endif

compiler-rt/lib/builtins/floatundidf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ COMPILER_RT_ABI double __floatundidf(du_int a) {
101101
#if defined(COMPILER_RT_ARMHF_TARGET)
102102
AEABI_RTABI double __aeabi_ul2d(du_int a) { return __floatundidf(a); }
103103
#else
104-
AEABI_RTABI double __aeabi_ul2d(du_int a) COMPILER_RT_ALIAS(__floatundidf);
104+
COMPILER_RT_ALIAS(__floatundidf, __aeabi_ul2d)
105105
#endif
106106
#endif

compiler-rt/lib/builtins/floatundisf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ COMPILER_RT_ABI float __floatundisf(du_int a) {
6767
#if defined(COMPILER_RT_ARMHF_TARGET)
6868
AEABI_RTABI float __aeabi_ul2f(du_int a) { return __floatundisf(a); }
6969
#else
70-
AEABI_RTABI float __aeabi_ul2f(du_int a) COMPILER_RT_ALIAS(__floatundisf);
70+
COMPILER_RT_ALIAS(__floatundisf, __aeabi_ul2f)
7171
#endif
7272
#endif

compiler-rt/lib/builtins/floatunsidf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ COMPILER_RT_ABI fp_t __floatunsidf(unsigned int a) {
4242
#if defined(COMPILER_RT_ARMHF_TARGET)
4343
AEABI_RTABI fp_t __aeabi_ui2d(unsigned int a) { return __floatunsidf(a); }
4444
#else
45-
AEABI_RTABI fp_t __aeabi_ui2d(unsigned int a) COMPILER_RT_ALIAS(__floatunsidf);
45+
COMPILER_RT_ALIAS(__floatunsidf, __aeabi_ui2d)
4646
#endif
4747
#endif

compiler-rt/lib/builtins/floatunsisf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ COMPILER_RT_ABI fp_t __floatunsisf(unsigned int a) {
5252
#if defined(COMPILER_RT_ARMHF_TARGET)
5353
AEABI_RTABI fp_t __aeabi_ui2f(unsigned int a) { return __floatunsisf(a); }
5454
#else
55-
AEABI_RTABI fp_t __aeabi_ui2f(unsigned int a) COMPILER_RT_ALIAS(__floatunsisf);
55+
COMPILER_RT_ALIAS(__floatunsisf, __aeabi_ui2f)
5656
#endif
5757
#endif

compiler-rt/lib/builtins/int_lib.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
// Assumption: Right shift of signed negative is arithmetic shift.
1919
// Assumption: Endianness is little or big (not mixed).
2020

21-
#if defined(__ELF__)
22-
#define FNALIAS(alias_name, original_name) \
23-
void alias_name() __attribute__((__alias__(#original_name)))
24-
#define COMPILER_RT_ALIAS(aliasee) __attribute__((__alias__(#aliasee)))
25-
#else
26-
#define FNALIAS(alias, name) \
27-
_Pragma("GCC error(\"alias unsupported on this file format\")")
28-
#define COMPILER_RT_ALIAS(aliasee) \
29-
_Pragma("GCC error(\"alias unsupported on this file format\")")
30-
#endif
31-
3221
// ABI macro definitions
3322

3423
#if __ARM_EABI__
@@ -55,6 +44,24 @@
5544
#define UNUSED __attribute__((unused))
5645
#endif
5746

47+
#define STR(a) #a
48+
#define XSTR(a) STR(a)
49+
#define SYMBOL_NAME(name) XSTR(__USER_LABEL_PREFIX__) #name
50+
51+
#if defined(__ELF__) || defined(__MINGW32__) || defined(__wasm__)
52+
#define COMPILER_RT_ALIAS(name, aliasname) \
53+
COMPILER_RT_ABI __typeof(name) aliasname __attribute__((__alias__(#name)));
54+
#elif defines(__MACH__)
55+
#define COMPILER_RT_ALIAS(name, aliasname) \
56+
__asm__(".globl " SYMBOL_NAME(aliasname)); \
57+
__asm__(SYMBOL_NAME(aliasname) " = " SYMBOL_NAME(name)) \
58+
COMPILER_RT_ABI __typeof(name) aliasname;
59+
#elif defined(_WIN32)
60+
#define COMPILER_RT_ALIAS(name, aliasname)
61+
#else
62+
#error Unsupported target
63+
#endif
64+
5865
#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
5966
//
6067
// Kernel and boot environment can't use normal headers,

compiler-rt/lib/builtins/lshrdi3.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@ COMPILER_RT_ABI di_int __lshrdi3(di_int a, si_int b) {
3434
}
3535

3636
#if defined(__ARM_EABI__)
37-
AEABI_RTABI di_int __aeabi_llsr(di_int a, si_int b)
38-
COMPILER_RT_ALIAS(__lshrdi3);
37+
COMPILER_RT_ALIAS(__lshrdi3, __aeabi_llsr)
3938
#endif

compiler-rt/lib/builtins/muldf3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ COMPILER_RT_ABI fp_t __muldf3(fp_t a, fp_t b) { return __mulXf3__(a, b); }
2020
#if defined(COMPILER_RT_ARMHF_TARGET)
2121
AEABI_RTABI fp_t __aeabi_dmul(fp_t a, fp_t b) { return __muldf3(a, b); }
2222
#else
23-
AEABI_RTABI fp_t __aeabi_dmul(fp_t a, fp_t b) COMPILER_RT_ALIAS(__muldf3);
23+
COMPILER_RT_ALIAS(__muldf3, __aeabi_dmul)
2424
#endif
2525
#endif

compiler-rt/lib/builtins/muldi3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ COMPILER_RT_ABI di_int __muldi3(di_int a, di_int b) {
4747
}
4848

4949
#if defined(__ARM_EABI__)
50-
AEABI_RTABI di_int __aeabi_lmul(di_int a, di_int b) COMPILER_RT_ALIAS(__muldi3);
50+
COMPILER_RT_ALIAS(__muldi3, __aeabi_lmul)
5151
#endif

0 commit comments

Comments
 (0)