To: debian-gcc@lists.debian.org From: aivch...@gmail.com Subject: gcc-as-needed.diff patch broke mpx support in GCC
Package: gcc-5 Version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609 gcc-5 from Ubuntu is configured with MPX support, but it is broken due to always-added linker option "-as-needed". This happens because usual invokation of gcc for mpx (e.g gcc -fcheck-pointer-bounds -mmpx hello.c) would implicitely add -lmpx and -lmpxwrappers during linking, but those libraries are not actually linked: > ldd a.out linux-vdso.so.1 => (0x00007ffe725af000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3ed2513000) /lib64/ld-linux-x86-64.so.2 (0x000055922a9eb000) (if we add -Wl,--no-as-needed: > ldd a.out linux-vdso.so.1 => (0x00007ffe201e5000) libmpx.so.0 => /usr/lib/x86_64-linux-gnu/libmpx.so.0 (0x00007f9e76a76000) libmpxwrappers.so.0 => /usr/lib/x86_64-linux-gnu/libmpxwrappers.so.0 (0x00007f9e76873000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9e764a9000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9e7628c000) /lib64/ld-linux-x86-64.so.2 (0x000055f6e450d000)) The fix for that would be to add the same guards for as-needed as for sanitizer libraries