Bug 17334 - building gcc-4.5.4 hits BFD (GNU Binutils) 2.25 assertion fail elf32-bfin.c:4457
Summary: building gcc-4.5.4 hits BFD (GNU Binutils) 2.25 assertion fail elf32-bfin.c:4457
Status: ASSIGNED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-01 19:56 UTC by wbx
Modified: 2016-03-29 09:25 UTC (History)
3 users (show)

See Also:
Host:
Target: bfin-linux-uclibc
Build:
Last reconfirmed:


Attachments
buildroot log (187.09 KB, text/plain)
2015-03-08 19:49 UTC, wbx
Details
buildroot config (7.64 KB, text/plain)
2015-03-08 19:49 UTC, wbx
Details
Proposed patch (251 bytes, patch)
2016-03-22 16:21 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description wbx 2014-09-01 19:56:14 UTC
Hi,

I use buildroot to create a cross-toolchain targeting blackfin.
Default is the usage of gcc 4.5.4 and binutils 2.22.
This works fine. When I reconfigure to use binutils 2.23.2 or binutils 2.24
the build fails with a log of failures like this one:
bfin-buildroot-linux-uclibc/bin/ld: fde encoding in _divdi3_s.o(.eh_frame) prevents .eh_frame_hdr table being created.

Seems like a regression or do we need some special options for gcc
when switching to a newer binutils version?

I can provide full logs, if required.

Thanks in advance
 Waldemar
Comment 1 Mike Frysinger 2015-03-07 20:48:24 UTC
you need to always provide logs as attachments

the warnings you refer to are, iirc, just warnings.  there is most likely an unrelated error message buried in there.
Comment 2 wbx 2015-03-08 19:49:31 UTC
Created attachment 8179 [details]
buildroot log
Comment 3 wbx 2015-03-08 19:49:56 UTC
Created attachment 8180 [details]
buildroot config
Comment 4 wbx 2015-03-08 19:51:05 UTC
Hi,

I added the buildroot config and full log.

best regards
 Waldemar
Comment 5 Mike Frysinger 2015-03-09 02:05:23 UTC
here's the failure:
/home/wbx/buildroot/output/host/usr/bfin-buildroot-linux-uclibc/bin/ld: BFD (GNU Binutils) 2.25 assertion fail elf32-bfin.c:4457
Comment 6 wbx 2016-02-27 10:12:46 UTC
I think the assert might be not required.
I used git bisect and found that following commit made
the assert to be fatal for toolchain creation:
2b56b3f35a62c569ff20889aa22aef7fde73f81d

When I just simply remove the assert I can just build
a toolchain and a Linux system including uClibc-ng and buildroot 
boots up fine in the GDB simulator. (FPIC)

So is this assert really required?

diff -Nur binutils-2.26.orig/bfd/elf32-bfin.c binutils-2.26/bfd/elf32-bfin.c
--- binutils-2.26.orig/bfd/elf32-bfin.c 2015-11-13 09:27:40.000000000 +0100
+++ binutils-2.26/bfd/elf32-bfin.c      2016-02-08 01:14:15.360648022 +0100
@@ -4456,9 +4456,6 @@
 
   if (bfinfdpic_got_section (info))
     {
-      BFD_ASSERT (bfinfdpic_gotrel_section (info)->size
-                 == (bfinfdpic_gotrel_section (info)->reloc_count
-                     * sizeof (Elf32_External_Rel)));
 
       if (bfinfdpic_gotfixup_section (info))
        {
Comment 7 Nick Clifton 2016-03-18 13:34:58 UTC
Hi Waldemar,

> I think the assert might be not required.

I think that it is needed.  At the very least I would like to know why
the assertion is wrong before removing it.

Please can you create a testcase that we can use to reproduce the problem ?

It would also be very helpful to know if the problem still persists with the current mainline development binutils sources, and not just the old 2.24 sources.

Cheers
  Nick
Comment 8 wbx 2016-03-19 09:28:21 UTC
Hi Nick,

it still happens with gcc/binutils git from today:
/bin/bash /home/wbx/bfin/toolchain_build_sim-bfin_uclibc-ng_bf512/w-gcc-git-1/gcc-git/libgcc/../mkinstalldirs .
/home/wbx/bfin/toolchain_build_sim-bfin_uclibc-ng_bf512/w-gcc-git-1/gcc-git-final/./gcc/xgcc -B/home/wbx/bfin/toolchain_build_sim-bfin_uclibc-ng_bf512/w-gcc-git-1/gcc-git-final/./gcc/ -B/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ -B/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/lib/ -isystem /home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/include -isystem /home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/sys-include --sysroot=/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/../../target_sim-bfin_uclibc-ng_bf512   -O2  -fwrapv -fno-ident -mcpu=bf512 -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -fwrapv -fno-ident -mcpu=bf512 -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -B./ _divsi3_s.o _udivsi3_s.o _umodsi3_s.o _modsi3_s.o _muldi3_s.o _umulsi3_highpart_s.o _smulsi3_highpart_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o _pack_sf_s.o _unpack_sf_s.o _addsub_sf_s.o _mul_sf_s.o _div_sf_s.o _fpcmp_parts_sf_s.o _compare_sf_s.o _eq_sf_s.o _ne_sf_s.o _gt_sf_s.o _ge_sf_s.o _lt_sf_s.o _le_sf_s.o _unord_sf_s.o _si_to_sf_s.o _sf_to_si_s.o _negate_sf_s.o _make_sf_s.o _sf_to_df_s.o _thenan_sf_s.o _sf_to_usi_s.o _usi_to_sf_s.o _pack_df_s.o _unpack_df_s.o _addsub_df_s.o _mul_df_s.o _div_df_s.o _fpcmp_parts_df_s.o _compare_df_s.o _eq_df_s.o _ne_df_s.o _gt_df_s.o _ge_df_s.o _lt_df_s.o _le_df_s.o _unord_df_s.o _si_to_df_s.o _df_to_si_s.o _negate_df_s.o _make_df_s.o _df_to_sf_s.o _thenan_df_s.o _df_to_usi_s.o _usi_to_df_s.o enable-execute-stack_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in _divdi3_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in _moddi3_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in _udivdi3_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in _umoddi3_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in _udiv_w_sdiv_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in _udivmoddi4_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in unwind-dw2_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in unwind-dw2_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in unwind-dw2_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: FDE encoding in unwind-dw2_s.o(.eh_frame) prevents .eh_frame_hdr table being created.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: Further warnings about FDE encoding preventing .eh_frame_hdr generation dropped.
/home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512/usr/bfin-openadk-linux-uclibc/bin/ld: BFD (GNU Binutils) 2.26.51.20160319 assertion fail elf32-bfin.c:4461
collect2: error: ld returned 1 exit status
make[8]: *** [libgcc_s.so] Error 1
make[7]: *** [all-target-libgcc] Error 2
make[6]: *** [all] Error 2
make[5]: *** [/home/wbx/bfin/toolchain_build_sim-bfin_uclibc-ng_bf512/w-gcc-git-1/gcc-git/.compiled] Error 2
make[4]: *** [gcc-compile] Error 2
make[3]: *** [toolchain/final] Error 2
make[2]: *** [world] Error 2

I am not sure how to make a simple test case out of it.

best regards
 Waldemar
Comment 9 Nick Clifton 2016-03-22 16:21:38 UTC
Created attachment 9118 [details]
Proposed patch

Hi Waldemar,

  Does this patch fix the problem ?

  I still do not like removing this assert, or even changing it in the way that this patch changes it, without knowing what is really going on.  But at least maybe this change will let you carry on building your toolchains whilst we try to find a test case that can let us investigate the problem properly.

Cheers
  Nick
Comment 10 wbx 2016-03-25 18:25:46 UTC
Hi,

yes, this change works for me. Tested with binutils 2.26 and git.

best regards
 Waldemar
Comment 11 cvs-commit@gcc.gnu.org 2016-03-29 09:25:24 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ed3056ebdb9795446157af03d3e08fbb93c1b01d

commit ed3056ebdb9795446157af03d3e08fbb93c1b01d
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Mar 29 10:24:16 2016 +0100

    Relax assertion in BFIN linker to allow for discard GOT relocs.
    
    	PR 17334
    	* elf32-bfin.c (elf32_bfinfdpic_finish_dynamic_sections): Relax
    	assertion on the size of the got section to allow it to be bigger
    	than the number of relocs.