/[packages]/cauldron/binutils/current/SPECS/binutils.spec
ViewVC logotype

Contents of /cauldron/binutils/current/SPECS/binutils.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1752057 - (show annotations) (download)
Mon Oct 18 12:40:59 2021 UTC (2 years, 6 months ago) by tmb
File size: 11671 byte(s)
PR28459, readelf issues bogus warning
1 %define lib_major 2
2 %define lib_name_orig %{package_prefix}%mklibname binutils
3 %define lib_name %{lib_name_orig}%{lib_major}
4 %define dev_name %mklibname binutils -d
5
6 %define rpm_ver 2.37
7 %define tar_ver 2.37
8 %define rel 16
9
10 # Define if building a cross-binutils
11 %define build_cross 0
12 %{expand: %{?cross: %%global build_cross 1}}
13
14 %if %{build_cross}
15 %define target_cpu %{cross}
16 %define target_platform %{target_cpu}-%_real_vendor-linux%{gnuext}
17 %define program_prefix %{target_platform}-
18 %define package_prefix cross-%{target_cpu}-
19 %else
20 %define target_cpu %{_target_cpu}
21 %define target_platform %{_target_platform}
22 %define program_prefix %{nil}
23 %define package_prefix %{nil}
24 %endif
25
26 %define arch %(echo %{target_cpu}|sed -e "s/\(i.86\|athlon\)/i386/" -e "s/amd64/x86_64/")
27 %define isarch() %(case " %* " in (*" %{arch} "*) echo 1;; (*) echo 0;; esac)
28
29 %if %{build_cross}
30 %if %isarch %arm
31 %define gnuext -gnueabi
32 %else
33 %define gnuext -gnu
34 %endif
35 %endif
36
37 # List of targets where gold can be enabled
38 %define gold_arches %{ix86} x86_64 %{arm} aarch64
39
40 Summary: GNU Binary Utility Development Utilities
41 Name: %{package_prefix}binutils
42 Epoch: 1
43 Version: %{rpm_ver}
44 Release: %mkrel %{rel}
45 License: GPLv3+
46 Group: Development/Other
47 URL: https://www.gnu.org/software/binutils/
48 Source0: https://ftp.gnu.org/gnu/binutils/binutils-%{tar_ver}.tar.xz
49 Source1: build_cross_binutils.sh
50 Source2: binutils-2.19.50.0.1-output-format.sed
51 Source3: binutils-git.sh
52 %if "%{name}" == "binutils"
53 Provides: %{lib_name} = %{epoch}:%{version}-%{release}
54 %endif
55 # (tmb) force build with gcc 11.2
56 BuildRequires: gcc >= 11.2.0
57 # (tmb) force fixed binutils
58 BuildRequires: binutils >= 1:2.37-1
59 BuildRequires: autoconf
60 BuildRequires: automake
61 BuildRequires: bison
62 BuildRequires: flex
63 BuildRequires: gettext
64 BuildRequires: texinfo-tex
65 BuildRequires: dejagnu
66 BuildRequires: pkgconfig(zlib)
67 # make check'ing requires libdl.a
68 BuildRequires: glibc-static-devel
69 # gold make check'ing requires libstdc++.a
70 BuildRequires: libstdc++-static-devel
71
72 # revert devel enabling on branch
73 Source101: binutils-disable-development.patch
74
75 # upstream 2.37 branch
76 Patch001: 0001-Change-uint-to-unsigned.patch
77 Patch002: 0002-PR28106-build-of-2.37-fails-on-FreeBSD-and-Clang.patch
78 Patch003: 0003-Updated-Russian-translation-for-the-bfd-library.patch
79 Patch004: 0004-Re-ld-script-expression-parsing.patch
80 Patch005: 0005-Revert-PowerPC-Don-t-generate-unused-section-symbols.patch
81 Patch006: 0006-texi2pod.pl-add-no-op-no-split-option-support-PR2814.patch
82 Patch007: 0007-Re-opcodes-constify-local-meps-macros.patch
83 Patch008: 0008-bfd-Close-the-file-descriptor-if-there-is-no-archive.patch
84 Patch009: 0009-PR28186-SEGV-elf.c-7991-30-in-_bfd_elf_fixup_group_s.patch
85 Patch010: 0010-Revert-Re-ld-script-expression-parsing.patch
86 Patch011: 0011-Revert-ld-defsym.patch
87 Patch012: 0012-Revert-ld-script-expression-parsing.patch
88 Patch013: 0013-PR28391-strip-objcopy-preserve-dates-.a-cannot-set-t.patch
89 Patch014: 0014-ld-pru-Fix-resource_table-output-section-alignment.patch
90 Patch015: 0015-PR28422-build_id-use-after-free.patch
91 Patch016: 0016-PR28459-readelf-issues-bogus-warning.patch
92
93 # upstream master branch
94 Patch100: 0100-PR28264-ld.bfd-crash-on-linking-efivar-with-LTO.patch
95 Patch101: 0101-PR28250-Null-pointer-dereference-in-debug_class_type.patch
96
97 # patches once liberated from Fedora:
98 # NOTE! Do not add more without maintainer approval
99 Patch301: binutils-2.20.51.0.2-libtool-lib64.patch
100 Patch302: binutils-2.37-export-demangle.h.patch
101 Patch303: binutils-2.22.52.0.4-no-config-h-check.patch
102 Patch304: binutils-2.37-filename-in-error-messages.patch
103
104 # Mageia patches
105 Patch401: binutils-2.37-linux32.patch
106 Patch402: binutils-2.37-skip-gold-check.patch
107
108 # security fixes
109
110 %description
111 Binutils is a collection of binary utilities, including:
112
113 * ar: creating modifying and extracting from archives
114 * nm: for listing symbols from object files
115 * objcopy: for copying and translating object files
116 * objdump: for displaying information from object files
117 * ranlib: for generating an index for the contents of an archive
118 * size: for listing the section sizes of an object or archive file
119 * strings: for listing printable strings from files
120 * strip: for discarding symbols (a filter for demangling encoded C++ symbols
121 * addr2line: for converting addresses to file and line
122 * nlmconv: for converting object code into an NLM
123
124 Install binutils if you need to perform any of these types of actions on
125 binary files. Most programmers will want to install binutils.
126
127 %package -n %{dev_name}
128 Summary: Main library for %{name}
129 Group: Development/Other
130 Provides: %{name}-devel = %{epoch}:%{version}-%{release}
131 Provides: %{lib_name}-devel = %{epoch}:%{version}-%{release}
132 Requires: zlib-devel
133 # filter out self-requries
134 %global __requires_exclude ^devel\\(libbfd-%{version}
135
136 %description -n %{dev_name}
137 This package contains BFD and opcodes static libraries and associated
138 header files. Only *.a libraries are included, because BFD doesn't
139 have a stable ABI. Developers starting new projects are strongly encouraged
140 to consider using libelf instead of BFD.
141
142 %prep
143 %setup -q -n binutils-%{tar_ver}
144 %autopatch -p1
145 # remove to force regenerating it because of reverts in P10-P12
146 rm -f ld/ldlex.c
147
148 %build
149 # Additional targets
150 ADDITIONAL_TARGETS=""
151 case %{target_cpu} in
152 i*86 | athlon*)
153 ADDITIONAL_TARGETS="x86_64-%{_target_vendor}-%{_target_os}"
154 ;;
155 esac
156 if [[ -n "$ADDITIONAL_TARGETS" ]]; then
157 TARGET_CONFIG="$TARGET_CONFIG --enable-targets=$ADDITIONAL_TARGETS"
158 fi
159
160 case %{target_cpu} in
161 i*86 | athlon* | aarch64*)
162 TARGET_CONFIG="$TARGET_CONFIG --enable-64-bit-bfd"
163 ;;
164 esac
165
166 case %{target_cpu} in x86_64*|i?86*|arm*|aarch64*)
167 TARGET_CONFIG="$TARGET_CONFIG --enable-targets=x86_64-pep"
168 ;;
169 esac
170
171 %if "%{name}" != "binutils"
172 %define _program_prefix %{program_prefix}
173 TARGET_CONFIG="$TARGET_CONFIG --target=%{target_platform}"
174 %endif
175
176 # Don't build shared libraries in cross binutils
177 %if "%{name}" == "binutils"
178 TARGET_CONFIG="$TARGET_CONFIG --enable-shared --with-pic"
179 %endif
180
181 # Binutils comes with its own custom libtool
182 # [gb] FIXME: but system libtool also works and has relink fix
183 %define __libtoolize /bin/true
184
185 # Build main binaries
186 rm -rf objs
187 mkdir objs
188 pushd objs
189 CONFIGURE_TOP=.. %configure $TARGET_CONFIG --with-bugurl=https://bugs.mageia.org/ \
190 --enable-gold \
191 --enable-plugins \
192 --enable-compressed-debug-sections=none \
193 --enable-relro=yes
194 # There seems to be some problems with builds of gold randomly failing whenever
195 # going through the build system, so let's try workaround this by trying to do
196 # make once again when it happens...
197 %make_build tooldir=%{_prefix} || make tooldir=%{_prefix}
198 popd
199
200 %check
201 # All Tests must pass on x86 and x86_64
202 # rtp: some ld-arm tests are failing.
203 # they're fixed in 2.21 but didn't find the fixes
204 echo ====================TESTING=========================
205 %if %isarch i386 x86_64
206 %make_build -C objs check LDFLAGS="" || :
207 # random build failures with gold seems to happen during check as well...
208 make -k -C objs gold-check LDFLAGS="" || :
209 %else
210 %make_build -C objs -k check LDFLAGS="" || :
211 %endif
212 echo ====================TESTING END=====================
213
214 logfile="%{name}-%{version}-%{release}.log"
215 rm -f $logfile; find . -name "*.sum" | xargs cat >> $logfile
216
217 %install
218 # disable 'check-rpaths' only from warning about standard RPATHs (0x0001)
219 # (tmb) TODO / FIXME better ???
220 export QA_RPATHS=0x0001
221
222
223 mkdir -p $RPM_BUILD_ROOT%{_prefix}
224 %make_install -C objs
225
226 rm -f $RPM_BUILD_ROOT%{_mandir}/man1/{dlltool,nlmconv,windres}*
227 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
228 rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
229 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{bfd,opcodes}.so
230
231 %if "%{name}" == "binutils"
232 make -C objs prefix=$RPM_BUILD_ROOT%{_prefix} infodir=$RPM_BUILD_ROOT%{_infodir} install-info
233 install -m 644 include/libiberty.h $RPM_BUILD_ROOT%{_includedir}/
234 %if %isarch %mips
235 install -m 644 objs/libiberty/libiberty.a $RPM_BUILD_ROOT%{_libdir}/
236 # Ship with the PIC libiberty
237 %else
238 install -m 644 objs/libiberty/pic/libiberty.a $RPM_BUILD_ROOT%{_libdir}/
239 %endif
240 rm -rf $RPM_BUILD_ROOT%{_prefix}/%{_target_platform}/
241
242 # Sanity check --enable-64-bit-bfd really works.
243 %if %isarch i*86 athlon*
244 grep '^#define BFD_ARCH_SIZE 64$' %{buildroot}%{_prefix}/include/bfd.h
245 %endif
246
247 # Fix multilib conflicts of generated values by __WORDSIZE-based expressions.
248 %if %isarch %{ix86} x86_64
249 sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
250 -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
251 -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
252 -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
253 #define BFD_HOST_64_BIT long long\
254 #else\
255 #define BFD_HOST_64_BIT long\
256 #endif/' \
257 -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \
258 %{buildroot}%{_prefix}/include/bfd.h
259 %endif
260 touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h
261
262 # Generate .so linker scripts for dependencies; imported from glibc/Makerules:
263
264 # This fragment of linker script gives the OUTPUT_FORMAT statement
265 # for the configuration we are building.
266 OUTPUT_FORMAT="\
267 /* Ensure this .so library will not be used by a link for a different format
268 on a multi-architecture system. */
269 $(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE2}")"
270
271 tee %{buildroot}%{_libdir}/libbfd.so <<EOH
272 /* GNU ld script */
273
274 $OUTPUT_FORMAT
275
276 /* The libz dependency is unexpected by legacy build scripts. */
277 INPUT ( %{_libdir}/libbfd.a -liberty -lz )
278 EOH
279
280 tee %{buildroot}%{_libdir}/libopcodes.so <<EOH
281 /* GNU ld script */
282
283 $OUTPUT_FORMAT
284
285 INPUT ( %{_libdir}/libopcodes.a -lbfd -lz )
286 EOH
287
288 %else
289 rm -f $RPM_BUILD_ROOT%{_libdir}/libiberty.a
290 rm -rf $RPM_BUILD_ROOT%{_infodir}
291 rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/
292 rm -f $RPM_BUILD_ROOT%{_prefix}/%{_target_platform}/%{target_cpu}-linux/lib/*.la
293 %endif
294
295 %find_lang binutils
296 %find_lang gas
297 %find_lang ld
298 %find_lang gold
299 %find_lang gprof
300 cat gas.lang >> binutils.lang
301 cat ld.lang >> binutils.lang
302 cat gold.lang>> binutils.lang
303 cat gprof.lang >> binutils.lang
304
305 %find_lang opcodes
306 %find_lang bfd
307 cat opcodes.lang >> binutils.lang
308 cat bfd.lang >> binutils.lang
309
310 %files -f binutils.lang
311 %{_bindir}/%{program_prefix}addr2line
312 %{_bindir}/%{program_prefix}ar
313 %{_bindir}/%{program_prefix}as
314 %{_bindir}/%{program_prefix}c++filt
315 %{_bindir}/%{program_prefix}dwp
316 %{_bindir}/%{program_prefix}elfedit
317 %{_bindir}/%{program_prefix}gprof
318 %{_bindir}/%{program_prefix}ld
319 %{_bindir}/%{program_prefix}ld.bfd
320 %if %isarch %{gold_arches}
321 %{_bindir}/%{program_prefix}ld.gold
322 %endif
323 %{_bindir}/%{program_prefix}nm
324 %{_bindir}/%{program_prefix}objcopy
325 %{_bindir}/%{program_prefix}objdump
326 %{_bindir}/%{program_prefix}ranlib
327 %{_bindir}/%{program_prefix}readelf
328 %{_bindir}/%{program_prefix}size
329 %{_bindir}/%{program_prefix}strings
330 %{_bindir}/%{program_prefix}strip
331 %{_mandir}/man1/*
332 %if "%{name}" == "binutils"
333 %{_infodir}/*info*
334 %{_libdir}/libbfd-%{version}*.so
335 %{_libdir}/libctf.so.0
336 %{_libdir}/libctf.so.0.0.0
337 %{_libdir}/libctf-nobfd.so.0
338 %{_libdir}/libctf-nobfd.so.0.0.0
339 %{_libdir}/libopcodes-%{version}*.so
340 %{_libdir}/bfd-plugins/libdep.so
341 %else
342 %{_prefix}/%{target_platform}/bin/*
343 %{_prefix}/%{target_platform}/lib/ldscripts
344 %endif
345
346 %if "%{name}" == "binutils"
347 %files -n %{dev_name}
348 %{_includedir}/*.h
349 %{_libdir}/libbfd.a
350 %{_libdir}/libbfd.so
351 %{_libdir}/libctf.a
352 %{_libdir}/libctf.so
353 %{_libdir}/libctf-nobfd.a
354 %{_libdir}/libctf-nobfd.so
355 %{_libdir}/libiberty.a
356 %{_libdir}/libopcodes.a
357 %{_libdir}/libopcodes.so
358 %endif

  ViewVC Help
Powered by ViewVC 1.1.30