arm: Use _dl_find_object on __gnu_Unwind_Find_exidx (BZ 31405)
[glibc.git] / sysdeps / powerpc / powerpc64 / le / Makefile
blob9d568d4f442300e1cc6c7a159333180c4c582724
1 # When building float128 we need to ensure -mfloat128 is
2 # passed to all such object files.
3 type-float128-CFLAGS := -mfloat128
5 # Bootstrapping code for enabling IEEE 128. This can be removed and
6 # any indirections simplified once IEEE 128 long double is enabled.
7 type-ldouble-CFLAGS =
8 no-gnu-attribute-CFLAGS =
9 ifeq ($(ibm128-fcts),yes)
10 ibm128-abi-CFLAGS := -mabi=ibmlongdouble
11 type-ldouble-CFLAGS += $(ibm128-abi-CFLAGS)
12 no-gnu-attribute-CFLAGS = -mno-gnu-attribute
14 # This is a very gnarly workaround to static libgcc providing a .gnu.attribute
15 # in ibm128 functions. This is not a bug in static libgcc as normal users
16 # should only ever link ibm128 or ieee128 routines, never both. We are the
17 # exception which allows the decision to be deferred to user libraries or
18 # applications.
20 # We built an object file and extract the desired .gnu.attributes section
21 # to be inserted into lib{c,m}.so.
22 ifeq ($(build-shared),yes)
24 # Build everything with IEEE 128-bit long double.
25 sysdep-CFLAGS += -mabi=ieeelongdouble -Wno-psabi $(no-gnu-attribute-CFLAGS)
27 before-compile += $(common-objpfx)no_ldbl_gnu_attribute.bin
29 $(common-objpfx)no_ldbl_gnu_attribute.bin: $(..)sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
30 $(filter-out $(no-gnu-attribute-CFLAGS),$(compile.c)) -o $(basename $@).o
31 $(OBJCOPY) --dump-section=.gnu.attributes=$@.tmp $(basename $@).o
32 mv $@.tmp $@
34 define after-link
35 if [ ! -z "$(filter libm.so libc.so,$(notdir $1))" ]; then \
36 echo "Replacing .gnu.attributes in $1"; \
37 $(OBJCOPY) --update-section=.gnu.attributes=$(common-objpfx)no_ldbl_gnu_attribute.bin $1; \
39 endef
41 # Ensure a .gnu.attributes section is present by building an ibm128 file with
42 # -mgnu-attribute in both libm and libc shared libraries. Prior to GCC 11 this
43 # section was implicitly included via static libgcc ibm128 routines.
44 ifeq ($(subdir),math)
45 $(objpfx)m_ldexpl.os: CFLAGS += -mgnu-attribute
46 $(objpfx)s_ldexpl.os: CFLAGS += -mgnu-attribute
47 endif
49 endif # ifeq ($(build-shared),yes)
50 endif # ifeq ($(ibm128-fcts),yes)
52 # All _Float128 files should be built assuming an ibm128 long double.
53 # Likewise, this avoids some old GCC 7 compiler bugs whereby calls
54 # to __mulkc3 are swapped with __multc3, or worse. This is noted in
55 # GCC BZ 84914, and marked as will-not-fix.
56 type-float128-CFLAGS += $(type-ldouble-CFLAGS)
58 ifeq ($(subdir),math)
59 # sqrtf128 requires emulation before POWER9.
60 CPPFLAGS += -I../soft-fp
62 # float128 requires adding a handful of extra flags.
63 # Similarly, disable
64 $(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
65 $(foreach suf,$(all-object-suffixes),%f128_r$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
66 $(foreach suf,$(all-object-suffixes),$(objpfx)test-float128%$(suf)): CFLAGS += $(type-float128-CFLAGS)
67 $(foreach suf,$(all-object-suffixes),$(objpfx)test-float64x%$(suf)): CFLAGS += $(type-float128-CFLAGS)
68 # Pairs of types with _Float128 / _Float64x as the wider type but not
69 # the narrower one.
70 f128-pairs = float32-float64x float32-float128 float64-float64x \
71 float64-float128 float32x-float64x float32x-float128
72 $(foreach suf,$(all-object-suffixes),$(foreach pair,$(f128-pairs),$(objpfx)test-$(pair)%$(suf))): CFLAGS += $(type-float128-CFLAGS)
73 CFLAGS-libm-test-support-float128.c += $(type-float128-CFLAGS)
74 CFLAGS-libm-test-support-float64x.c += $(type-float128-CFLAGS)
75 CFLAGS-test-math-iscanonical.cc += $(type-float128-CFLAGS)
76 CFLAGS-test-math-iseqsig.cc += $(type-float128-CFLAGS)
77 CFLAGS-test-math-issignaling.cc += $(type-float128-CFLAGS)
78 CFLAGS-test-math-iszero.cc += $(type-float128-CFLAGS)
80 CFLAGS-s_logbl-power7.c += $(type-ldouble-CFLAGS)
81 CFLAGS-s_logbl-ppc64.c += $(type-ldouble-CFLAGS)
83 $(foreach suf,$(all-object-suffixes),\
84 $(objpfx)s_copysignl$(suf) \
85 $(objpfx)s_fabsl$(suf)): \
86 ASFLAGS += $(type-ldouble-CFLAGS)
88 $(foreach suf,$(all-object-suffixes),\
89 $(objpfx)libm-test-%ibm128$(suf) \
90 $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf)): \
91 CFLAGS += $(type-ldouble-CFLAGS)
93 # Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
94 $(foreach suf,$(all-object-suffixes),\
95 $(objpfx)test-narrow-macros-ldbl-64$(suf) \
96 $(objpfx)test-nldbl-redirect$(suf) \
97 $(objpfx)test-redirection-ldbl-64$(suf) \
98 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
100 endif
102 # Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
103 ifeq ($(subdir),misc)
104 $(foreach suf,$(all-object-suffixes),\
105 $(objpfx)tst-nldbl-warn$(suf) \
106 $(objpfx)tst-nldbl-error$(suf) \
107 $(objpfx)tst-nldbl-errorfptr$(suf) \
108 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
109 endif
111 # Newer GCC (>7) doesn't like -mabi=* and -mlong-double-64
112 ifeq ($(subdir),argp)
113 $(foreach suf,$(all-object-suffixes),\
114 $(objpfx)tst-nldbl-argp$(suf) \
115 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
116 endif
119 # Append flags to string <-> _Float128 routines.
120 ifneq ($(filter $(subdir),wcsmbs stdlib),)
121 $(foreach suf,$(all-object-suffixes),%f128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
122 $(foreach suf,$(all-object-suffixes),%f128_l$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
123 $(foreach suf,$(all-object-suffixes),%f128_nan$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
124 $(foreach suf,$(all-object-suffixes),%float1282mpn$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
125 $(foreach suf,$(all-object-suffixes),%mpn2float128$(suf)): CFLAGS += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
126 CFLAGS-bug-strtod.c += $(type-float128-CFLAGS)
127 CFLAGS-bug-strtod2.c += $(type-float128-CFLAGS)
128 CFLAGS-tst-strtod-round.c += $(type-float128-CFLAGS)
129 CFLAGS-tst-wcstod-round.c += $(type-float128-CFLAGS)
130 CFLAGS-tst-strtod-nan-locale.c += $(type-float128-CFLAGS)
131 CFLAGS-tst-wcstod-nan-locale.c += $(type-float128-CFLAGS)
132 CFLAGS-tst-strtod6.c += $(type-float128-CFLAGS)
133 CFLAGS-tst-strfrom.c += $(type-float128-CFLAGS)
134 CFLAGS-tst-strfrom-locale.c += $(type-float128-CFLAGS)
135 CFLAGS-strfrom-skeleton.c += $(type-float128-CFLAGS)
136 CFLAGS-tst-strtod-nan-sign.c += $(type-float128-CFLAGS)
137 CFLAGS-tst-wcstod-nan-sign.c += $(type-float128-CFLAGS)
139 # When building glibc with support for _Float128, the powers of ten tables in
140 # fpioconst.c and in the string conversion functions must be extended. Some
141 # Makefiles (e.g.: wcsmbs/Makefile) override CFLAGS defined by the Makefiles in
142 # sysdeps. This is avoided with the use sysdep-CFLAGS instead of CFLAGS.
143 sysdep-CFLAGS += $(sysdep-CFLAGS-$(<F))
144 sysdep-CFLAGS-fpioconst.c += $(type-float128-CFLAGS)
145 sysdep-CFLAGS-strtod_l.c += $(type-float128-CFLAGS)
146 sysdep-CFLAGS-strtof_l.c += $(type-float128-CFLAGS)
147 sysdep-CFLAGS-strtold_l.c += $(type-float128-CFLAGS)
148 sysdep-CFLAGS-wcstod_l.c += $(type-float128-CFLAGS)
149 sysdep-CFLAGS-wcstof_l.c += $(type-float128-CFLAGS)
150 sysdep-CFLAGS-wcstold_l.c += $(type-float128-CFLAGS)
152 # Build any ibm128 specific stdlib tests with ibm128 ABI.
153 $(foreach suf,$(all-object-suffixes),%128ibm$(suf)): CFLAGS += $(type-ldouble-CFLAGS)
154 endif
156 # Append flags to printf routines.
157 ifeq ($(subdir),stdio-common)
158 CFLAGS-printf_fp.c = $(type-float128-CFLAGS)
159 CFLAGS-printf_fphex.c = $(type-float128-CFLAGS)
160 CFLAGS-printf_size.c = $(type-float128-CFLAGS)
161 #Older GCC (<10) doesn't like -mabi=ieeelongdouble and -mlong-double-64.
162 $(foreach suf,$(all-object-suffixes),\
163 $(objpfx)tst-nldbl-scanf-binary-c11$(suf) \
164 $(objpfx)tst-nldbl-scanf-binary-c23$(suf) \
165 $(objpfx)tst-nldbl-scanf-binary-gnu11$(suf) \
166 $(objpfx)tst-nldbl-scanf-binary-gnu89$(suf) \
167 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
168 endif
170 #Older GCC (<10) doesn't like -mabi=ieeelongdouble and -mlong-double-64.
171 ifeq ($(subdir), wcsmbs)
172 $(foreach suf,$(all-object-suffixes),\
173 $(objpfx)tst-nldbl-wscanf-binary-c11$(suf) \
174 $(objpfx)tst-nldbl-wscanf-binary-c23$(suf) \
175 $(objpfx)tst-nldbl-wscanf-binary-gnu11$(suf) \
176 $(objpfx)tst-nldbl-wscanf-binary-gnu89$(suf) \
177 ): sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
178 endif
180 # Disable linker noise on files using ieee128 long double internally
181 ifeq ($(subdir),time)
182 CFLAGS-difftime.c += $(no-gnu-attribute-CFLAGS)
183 endif
185 $(foreach suf,$(all-object-suffixes),$(objpfx)nldbl-%$(suf)): \
186 CFLAGS += $(type-ldouble-CFLAGS)
188 ldbl-ibm128-files = $(objpfx)nldbl-%$(suf) \
189 $(objpfx)libm-test-%ibm128$(suf) \
190 $(objpfx)test-iibm128%$(suf) $(objpfx)test-ibm128%$(suf) \
191 $(objpfx)test-tgmath3-%$(suf)
193 # Remove -mabi=ieeelongdouble from ldbl-ibm128 files.
194 $(foreach suf,$(all-object-suffixes), $(ldbl-ibm128-files)) \
195 $(foreach r,$(ldbl-128ibm-routines) $(ldbl-tests), \
196 $(objpfx)$(r)$(suf)): \
197 sysdep-CFLAGS := $(filter-out -mabi=ieeelongdouble,$(sysdep-CFLAGS))
199 # TODO: a bug in stdc++ will fail if -mabi=ieeelongdouble and -mfloat128
200 # are both enabled. The latter is enabled by default in GCC 8+. This is
201 # tracked via GCC BZ 94080.
202 ifeq ($(subdir),support)
203 CFLAGS-links-dso-program.cc += -mno-float128
204 endif
205 ifeq ($(subdir),nptl)
206 CFLAGS-tst-thread_local1.cc += -mno-float128
207 CFLAGS-tst-minstack-throw.cc += -mno-float128
208 endif
210 ifeq ($(subdir),elf)
211 $(objpfx)tst-glibc-hwcaps: \
212 $(objpfx)libmarkermod2-1.so $(objpfx)libmarkermod3-1.so
213 $(objpfx)tst-glibc-hwcaps.out: \
214 $(objpfx)libmarkermod2.so \
215 $(objpfx)glibc-hwcaps/power9/libmarkermod2.so \
216 $(objpfx)libmarkermod3.so \
217 $(objpfx)glibc-hwcaps/power9/libmarkermod3.so \
218 $(objpfx)glibc-hwcaps/power10/libmarkermod3.so \
220 $(objpfx)glibc-hwcaps/power9/libmarkermod2.so: $(objpfx)libmarkermod2-2.so
221 $(make-target-directory)
222 cp $< $@
223 $(objpfx)glibc-hwcaps/power9/libmarkermod3.so: $(objpfx)libmarkermod3-2.so
224 $(make-target-directory)
225 cp $< $@
226 $(objpfx)glibc-hwcaps/power10/libmarkermod3.so: $(objpfx)libmarkermod3-3.so
227 $(make-target-directory)
228 cp $< $@
230 ifeq (no,$(build-hardcoded-path-in-tests))
231 # This is an ld.so.cache test, and RPATH/RUNPATH in the executable
232 # interferes with its test objectives.
233 tests-container += tst-glibc-hwcaps-cache
234 endif
236 endif # $(subdir) == elf