cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mfonseca
Visitor
Visitor
11,848 Views
Registered: ‎04-28-2010

BFD 2.16 assertion fail when cross compilng certain pkgs (e.g. libpam) with microblaze toolchain

Hello,

 

Has anyone come across this problem when cross compiling with the microblaze toolchain?  I've noticed it when compilng a number of packages, (eg libpam, zlib, etc.).

 

Heres some error output:

 

microblaze-unknown-linux-gnu-gcc -I../../../libpam/include -I../../../libpamc/include -I./.. -fpie -Os -W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wwrite-strings -Winline -Wshadow -pie -Wl,-O1 -Wl,--as-needed -Wl,-O1 -o .libs/upperLOWER upperLOWER.o  -L/home/mfonseca/views/all/TOOLS/Linux_Toolchains/fortress/build/work/microblaze-rootfs/prod/flex-2.5.35 -L/home/mfonseca/views/all/TOOLS/Linux_Toolchains/fortress/build/work/microblaze-rootfs/prod/Linux-PAM-0.99.9.0/libpam /home/mfonseca/views/all/TOOLS/Linux_Toolchains/fortress/build/work/microblaze-rootfs/prod/Linux-PAM-0.99.9.0/libpam/.libs/libpam.so -ldl
/tools/gcc-4.1.2-glibc-2.3.6/microblaze.Apr.30.1272651460/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: BFD 2.16 assertion fail ../../binutils-2.16/bfd/elf32-microblaze.c:1095
/tools/gcc-4.1.2-glibc-2.3.6/microblaze.Apr.30.1272651460/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: upperLOWER.o: probably compiled without -fPIC?
/tools/gcc-4.1.2-glibc-2.3.6/microblaze.Apr.30.1272651460/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

 

 

Thanks,

 

Marco

0 Kudos
Reply
11 Replies
jpl@xiphos.ca
Adventurer
Adventurer
11,840 Views
Registered: ‎10-28-2007

I've not had this problem with building zlib from buildroot.  I have not tried this with pam.

 

I've attached the build log for the zlib part of buildroot.  What are the configuration options and source for pam?  Perhaps I could try to replicate your error.

 

Joshua

0 Kudos
Reply
mfonseca
Visitor
Visitor
11,836 Views
Registered: ‎04-28-2010

Can you try zlib again with -Os optimization?

 

(specificly this is what I am doing)


CC=microblaze-unknown-linux-gnu-gcc ./configure --prefix=/tmp/foo --shared


make CFLAGS="-Os"

 

I noticed with -O2 it works, but -Os it doesn't.

0 Kudos
Reply
jpl@xiphos.ca
Adventurer
Adventurer
11,830 Views
Registered: ‎10-28-2007

Hmm, I don't know if I trust anything other than -O2.  I'm working within a system that has 100's of megabytes of RAM, so there isn't any advantage to using -Os.  What type of size improvement do you get when you build with Os?  What are your platform constraints?

 

Joshua

0 Kudos
Reply
mfonseca
Visitor
Visitor
11,829 Views
Registered: ‎04-28-2010

I think I spoke to soon.  Another look shows that CFLAGS is changing more then optimzation, its also removing -fpic from the compile line.  I will double check these with the problems I'm having with other utilities as well and post back.

 

It is strage that other toolchains didn't error out with this.

 

Thanks,

 

Marco

0 Kudos
Reply
mfonseca
Visitor
Visitor
11,825 Views
Registered: ‎04-28-2010

So I went ahead and tried libpam again, this time removing all of my input, be it flags or patches:

wget ftp://ftp.kernel.org/pub/linux/libs/pam/library/Linux-PAM-1.1.1.tar.bz2

tar xf Linux-PAM-1.1.1.tar.bz2

cd Linux-PAM-1.1.1

./configure --build=i686-pc-linux-gnu --host=microblaze-unknown-linux-gnu

make


... bla ...


libtool: link: microblaze-unknown-linux-gnu-gcc -I../../../libpam/include -I../../../libpamc/include -I./.. -fpie -g -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wwrite-strings -Winline -Wshadow -pie -Wl,--as-needed -Wl,-O1 -o .libs/upperLOWER upperLOWER.o  -L/home/mfonseca/slks/Linux-PAM-1.1.1/libpam /home/mfonseca/slks/Linux-PAM-1.1.1/libpam/.libs/libpam.so -ldl -lcrypt -Wl,-rpath -Wl,/lib64
/tools/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: BFD 2.16 assertion fail /home/ddeboni/src/Linux/crosstool/crosstool-ng-1.4.1/targets/src/binutils-2.16/bfd/elf32-microblaze.c:1095
/tools/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: upperLOWER.o: probably compiled without -fPIC?
/tools/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: final link failed: Bad value

 

Still the same problem.  *Maybe(?)* it can be made to work with enough tweaking to flags, but I would think it should be able to compile without the toolchain asserting.

 

Think you could verfity this?

 

Thanks,

 

Marco

0 Kudos
Reply
jpl@xiphos.ca
Adventurer
Adventurer
11,813 Views
Registered: ‎10-28-2007

I'll give it a shot when I'm at my build host, but I just want to confirm your build environment.  What linux installation are you running? If it is 64-bit, I won't be able to offer you a full replication since I'm still hanging out in a 32-bit universe.  I also run somewhat of a Fedora shop.

 

Joshua

0 Kudos
Reply
jpl@xiphos.ca
Adventurer
Adventurer
11,804 Views
Registered: ‎10-28-2007

Yeah, I get exactly the same output.

 

 

libtool: link: microblaze-unknown-linux-gnu-gcc -I../../../libpam/include -I../../../libpamc/include -I./.. -fpie -g -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wwrite-strings -Winline -Wshadow -pie -Wl,--as-needed -Wl,-O1 -o .libs/upperLOWER upperLOWER.o  -L/home/jpl/dev/exnet/Q6/xilinx/microblaze_v1.0/xbr-q6-svn/build/Linux-PAM-1.1.1/libpam /home/jpl/dev/exnet/Q6/xilinx/microblaze_v1.0/xbr-q6-svn/build/Linux-PAM-1.1.1/libpam/.libs/libpam.so -ldl -lcrypt
/home/jpl/dev/exnet/Q6/xilinx/microblaze_v1.0/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: BFD 2.16 assertion fail /home/ddeboni/src/Linux/crosstool/crosstool-ng-1.4.1/targets/src/binutils-2.16/bfd/elf32-microblaze.c:1095
/home/jpl/dev/exnet/Q6/xilinx/microblaze_v1.0/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: upperLOWER.o: probably compiled without -fPIC?
/home/jpl/dev/exnet/Q6/xilinx/microblaze_v1.0/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.1.2/../../../../microblaze-unknown-linux-gnu/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status

 I tried a couple of quick different configures with adding --disable-pie or --with-gnu-ld, and it failed with some unresolved symbol (yywrap) or with the same error, respectively.

 

Sorry it wasn't better news.

 

Joshua

 

 

0 Kudos
Reply
mfonseca
Visitor
Visitor
11,434 Views
Registered: ‎04-28-2010

For those who might benefit from this:

 

The problem with building pam with the xilinx toolchain, is that it doesn't support the -pie gcc flag.  If you configure pam with --disable-pie , it will get around the BFD assertions.  It seems like most of the BFD assertion problems have to do with pic.

 

 

0 Kudos
Reply
linnj
Xilinx Employee
Xilinx Employee
11,420 Views
Registered: ‎09-10-2008

Thanks for that update, that may help others.

0 Kudos
Reply
Anonymous
Not applicable
4,332 Views

Hi,

 

I got assertion failures  when compiling the linux kernel.  I checked the makefile and saw:

 

 

ifdef CONFIG_DEBUG_INFO
KBUILD_CFLAGS   += -g
KBUILD_AFLAGS   += -gdwarf-2

endif

 

 

 

 

 

ifdef

CONFIG_DEBUG_INFO

KBUILD_CFLAGS   += -gKBUILD_AFLAGS   += -gdwarf-2

endif

 

So I disabled CONFIG_DEBUG_INFO in the .config and the assertion failures went away.  PROBLEM SOLVED!!

 

Ideally I'd play around with the flags to get rid of the error so the debug info works but if anyone needs a quick fix perhaps this will be useful info.

 

Billy.

0 Kudos
Reply
patoh
Xilinx Employee
Xilinx Employee
4,199 Views
Registered: ‎08-05-2008

Something additional to be aware of, which I came across while build libpcap with the Xilinx MicroBlaze LDK.

You may need to verify if the -fpic inclusion is in upper or lowercase.

 

While building with -fpic did not work and produced the same BFD assertion failure. Building with -fPIC resolved the issue.

 

So for sharing purposes the configure command line used to build libpcap was as follows:

tar xvf libpcap-1.1.1.tar

cd libpcap-1.1.1

mkdir build

cd build

../configure --host=microblaze-unknown-linux-gnu --with-pcap=linux ac_cv_linux_vers=2

 

After which I hand editing the CCOPT to replace:

CCOPT = -O2 -fpic

with

CCOPT = -O2 -fPIC

 

Then ran make, and make install.

Hope this saves someone else some time.

 

0 Kudos
Reply