This issue applies to DTS binutils build as well, cloning the RHEL8 bug to include Nick's comments, especially the upstream report & the patch.
With devtoolset-8-binutils-2.30-54:
CFLAGS='-m32 -fstack-protector-all -fsanitize=address' CXXFLAGS='-m32 -fstack-protector-all -fsanitize=address' ./configure --disable-shared --disable-gdb --disable-libdecnumber --disable-readline --disable-sim && make all-binutils
ends with:
gcc -DHAVE_CONFIG_H -I. -I. -I. -I../bfd -I./config -I./../include -I./.. -I./../bfd -DLOCALEDIR="\"/usr/local/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I./../zlib -m32 -fstack-protector-all -fsanitize=address -MT atof-ieee.o -MD -MP -MF .deps/atof-ieee.Tpo -c -o atof-ieee.o `test -f 'config/atof-ieee.c' || echo './'`config/atof-ieee.c
mv -f .deps/atof-ieee.Tpo .deps/atof-ieee.Po
/bin/sh ./libtool --tag=CC --mode=link gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I./../zlib -m32 -fstack-protector-all -fsanitize=address -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o ../opcodes/libopcodes.la ../bfd/libbfd.la ../libiberty/libiberty.a
libtool: link: gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wwrite-strings -I./../zlib -m32 -fstack-protector-all -fsanitize=address -o as-new app.o as.o atof-generic.o compress-debug.o cond.o depend.o dwarf2dbg.o dw2gencfi.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o output-file.o read.o remap.o sb.o stabs.o subsegs.o symbols.o write.o tc-i386.o obj-elf.o atof-ieee.o ../opcodes/.libs/libopcodes.a -L/root/rpmbuild/BUILD/binutils-2.30/zlib /root/rpmbuild/BUILD/binutils-2.30/bfd/.libs/libbfd.a ../bfd/.libs/libbfd.a -lz ../libiberty/libiberty.a
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: /root/rpmbuild/BUILD/binutils-2.30/bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.0'
//lib/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:800: as-new] Error 1
make[4]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30/gas'
make[3]: *** [Makefile:2288: all-recursive] Error 1
make[3]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30/gas'
make[2]: *** [Makefile:730: all] Error 2
make[2]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30/gas'
make[1]: *** [Makefile:4864: all-gas] Error 2
make[1]: Leaving directory '/root/rpmbuild/BUILD/binutils-2.30'
I'm using this build to verify some (not major) CVEs. My two cents - not that important to cause a respin, but nice to get a fix in the next DTS round. Feel free to postpone.
+++ This bug was initially created as a clone of Bug #1678323 +++
Description of problem:
binutils fails to compile with CFLAGS='-fsanitize=address -ggdb' CXXFLAGS='-fsanitize=address -ggdb' LDFLAGS='-fsanitize=address'
Version-Release number of selected component (if applicable):
binutils-2.30-49.el8.x86_64
How reproducible:
for binutils-2.30-49.el8.src.rpm
Steps to Reproduce:
1. CFLAGS='-fsanitize=address -ggdb' CXXFLAGS='-fsanitize=address -ggdb' LDFLAGS='-fsanitize=address' ./configure
2. LSAN_OPTIONS=detect_leaks=0 make all-binutils
Actual results:
/usr/bin/ld: /root/rpmbuild/BUILD/binutils-2.30/bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5'
//usr/lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:800: as-new] Error 1
--- Additional comment from Nick Clifton on 2019-02-18 17:19:41 CET ---
Hi Alexandra,
This is basically a duplicate of https://sourceware.org/bugzilla/show_bug.cgi?id=22318.
I am pushing fixing this problem out to 8.1.0 since the binutils are not normally built
with sanitization enabled.
Cheers
Nick
--- Additional comment from Nick Clifton on 2019-02-18 17:21 CET ---
This is the patch used in the GNU Binutils sources to fix this problem.
Note - in order for this patch to be effective it is necessary to configure the binutils with --enable-plugins option.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHEA-2019:4139