Install PIC version of libbfd.a

Bug #1154025 reported by Ryo Onodera
26
This bug affects 6 people
Affects Status Importance Assigned to Milestone
binutils (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Like Bug #50512, there should be the PIC version of libbfd.a.

The reason is as follows:

1. As required, we need to link statically to libbfd (see linux-tools: perf should link statically to libbfd Bug #783660)

2. we need to build libopagent correctly, which uses libbfd with static link (see oprofile: symbol lookup error: /usr/lib/libopagent.so: undefined symbol: bfd_init Bug #1148682)

3. But currently, libopagent aren't built correctly causing the symbol lookup error. That's because OProfile's patches/static-libbfd-libopagnet-makefile.patch disables static linking to libbfd (possibly, as a quick work around):

--- a/libopagent/Makefile.am
+++ b/libopagent/Makefile.am
@@ -15,7 +15,7 @@ libopagent_la_CPPFLAGS = -I ${top_srcdir
  -I ${top_srcdir}/libutil \
  @OP_CPPFLAGS@

-libopagent_la_LIBADD = $(BFD_LIBS)
+libopagent_la_LIBADD =

 # Do not increment the major version for this library except to
 # intentionally break backward ABI compatability. Use the

When I build OProfile with the preceeding work-around patch removed, I get following error. I want to fix this error.

/bin/bash ../libtool --tag=CC --mode=link x86_64-linux-gnu-gcc -fPIC -g -O2 -version-info 1:0:0 -Wl,--version-script=../libopagent/opagent_symbols.ver -o libopagent.la -rpath /usr/lib/oprofile libopagent_la-opagent.lo /usr/lib/libbfd.a -lz -liberty -ldl -liberty -lpopt -ldl -lz

*** Warning: Linking the shared library libopagent.la against the
*** static library /usr/lib/libbfd.a is not portable!
libtool: link: x86_64-linux-gnu-gcc -shared -fPIC -DPIC .libs/libopagent_la-opagent.o /usr/lib/libbfd.a -liberty /usr/lib/x86_64-linux-gnu/libpopt.so -ldl -lz -O2 -Wl,--version-script=../libopagent/opagent_symbols.ver -Wl,-soname -Wl,libopagent.so.1 -o .libs/libopagent.so.1.0.0
/usr/bin/ld: /usr/lib/libbfd.a(archures.o): relocation R_X86_64_32S against `_sch_istable' can not be used when making a shared object; recompile with -fPIC
/usr/lib/libbfd.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libopagent.la] Error 1

Ryo Onodera (ryoqun)
description: updated
description: updated
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in binutils (Ubuntu):
status: New → Confirmed
Revision history for this message
Riku Voipio (riku-voipio) wrote :

It seems oprofile was "fixed" - this by dynamically linking against libbfd, which explicitly isn't allowed.

libbfd_pic.a is needed for mutrace as well.

Revision history for this message
Matthias Klose (doko) wrote :

> which explicitly isn't allowed.

why?

Changed in binutils (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for binutils (Ubuntu) because there has been no activity for 60 days.]

Changed in binutils (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.