[Buildroot] [RFC][PATCH] bfin: fix two issues with internal toolchain

Waldemar Brodkorb wbx at openadk.org
Fri Aug 5 22:40:48 UTC 2016


Hi Thomas,
Thomas Petazzoni wrote,

> Hello,
> 
> On Fri, 5 Aug 2016 21:52:47 +0200, Waldemar Brodkorb wrote:
> 
> > And libgcc_s.so.1 provides it:
> > ./output/host/usr/bin/bfin-buildroot-linux-uclibc-nm
> > ./output/host/usr/bfin-buildroot-linux-uclibc/sysroot/lib/libgcc_s.so.1|grep
> > _Unwind_GetRegionStart                         
> > 00005d0c t __Unwind_GetRegionStart
> 
> We are currently discussing it on IRC, but I believe the problem is
> that "t" indicates that the symbol is not visible. It should be a "T".

You are right, this seems to be the problem. You nailed it down!
It seems ELF has two different concepts for symbol visibility:
https://www.technovelty.org/code/why-symbol-visibility-is-good.html

The symbols in the libgcc_s.so.1 generated by internal toolchain are
bind "LOCAL", so not visible for linking the c++ application.
The Unwind* symbols in libgcc_s.so.1 from the external toolchain are
bind "GLOBAL".

Next thing is to find the reason for it.
 
> > diff --git a/package/gcc/6.1.0/892-fix-dwarf-fdpic.patch b/package/gcc/6.1.0/892-fix-dwarf-fdpic.patch
> > new file mode 100644
> > index 0000000..315b406
> > --- /dev/null
> > +++ b/package/gcc/6.1.0/892-fix-dwarf-fdpic.patch
> > @@ -0,0 +1,37 @@
> > +Fix DWARF compilation for FDPIC targets
> > +
> > +Signed-off-by: Waldemar Brodkorb <wbx at openadk.org>
> > +
> > +diff -Nur gcc-6.1.0.orig/libgcc/unwind-dw2-fde-dip.c gcc-6.1.0/libgcc/unwind-dw2-fde-dip.c
> > +--- gcc-6.1.0.orig/libgcc/unwind-dw2-fde-dip.c	2016-01-04 15:30:50.000000000 +0100
> > ++++ gcc-6.1.0/libgcc/unwind-dw2-fde-dip.c	2016-08-05 02:17:40.424195128 +0200
> > +@@ -124,7 +124,11 @@
> > + {
> > +   _Unwind_Ptr pc_low;
> > +   _Unwind_Ptr pc_high;
> > ++#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
> > ++  struct elf32_fdpic_loadaddr load_base;
> > ++#else
> 
> I'm surprised by this part of the patch, since you are changing the
> behavior for __FRV_FDPIC__ as well. It wasn't working before?

No, DWARF compiling for FR-V architecture is broken/bitrotted as
well. So this patch will be what I am suggesting upstream.
 
> In all other chunks you simply add __BFIN_FDPIC__ as behaving the same
> as __FRV_FDPIC__ but you're not doing the same here. Is this expected?
> 
> > ++#if defined __FRV_FDPIC__ || defined __BFIN_FDPIC__
> 
> Obvious question: is there a symbol that says "I'm using FDPIC" and
> which would make such conditions simpler?

There is a symbol __FDPIC__ for Bfin and FR-V, but it is exposed
_after_ the full gcc is build and can not be used while
bootstrapping the toolchain. I tried it.

best regards
 Waldemar



More information about the buildroot mailing list