FS#73928 - [binutils] libiberty.a should be compiled with PIC support (again)

Attached to Project: Arch Linux
Opened by gamezelda (gamezelda) - Tuesday, 22 February 2022, 23:58 GMT
Last edited by freswa (frederik) - Wednesday, 23 February 2022, 01:05 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



Recently the build of my "extrae" AUR package (https://aur.archlinux.org/packages/extrae) has started to fail with linking errors related to libiberty and -fPIC:

/usr/bin/ld: /usr/lib/libiberty.a(cp-demangle.o): relocation R_X86_64_PC32 against symbol `cplus_demangle_builtin_types' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:2937: libompitracef.la] Error 1

This is related to the recent binutils/gcc upgrades since downgrading to binutils 2.36.1-3, gcc 11.1.0-3, gcc-libs 11.1.0-3 & gcc fortran-11.1.0-3 fixes the build.

I found this bug report from back to 2014: https://bugs.archlinux.org/task/40174 suggesting to use the PIC version of libiberty, this was fixed by this commit:

However, libiberty was recently moved from gcc to binutils, and during the move the change was removed from gcc but not added to binutils:

The line appears to have been dropped accidentally. I can confirm re-introducing the change like so in binutils fixes the build of the "extrae" AUR package:

package() {
cd binutils-build
make prefix="$pkgdir/usr" tooldir="$pkgdir/usr" install
+ # install PIC version of libiberty
+ install -m644 libiberty/pic/libiberty.a "$pkgdir/usr/lib"

# Remove unwanted files
rm -f "$pkgdir"/usr/share/man/man1/{dlltool,nlmconv,windres,windmc}*

Additional info:
* package version(s): binutils 2.38-3, gcc 11.2.0-3, gcc-libs 11.2.0-3, gcc-fortran 11.2.0-3
* config and/or log files etc.: none
* link to upstream bug report, if any: not upstream

Steps to reproduce:

1. Set up a build environment on a fully updated Arch Linux install.
2. Try to build the extrae package from AUR by the usual procedure.
This task depends upon

Closed by  freswa (frederik)
Wednesday, 23 February 2022, 01:05 GMT
Reason for closing:  Implemented
Additional comments about closing:  revision 437975