All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] bfin c++ problem
@ 2016-07-21  0:04 Waldemar Brodkorb
       [not found] ` <20160721030504.GN4023@csltok.swansea.ac.uk>
  0 siblings, 1 reply; 3+ messages in thread
From: Waldemar Brodkorb @ 2016-07-21  0:04 UTC (permalink / raw)
  To: buildroot

Hi,

recently Thomas Petazzoni reported an issue for the internal
toolchain support in Buildroot targeting Blackfin to me.

It seem a simple c++ hello world program can't be compiled:
cat t.c
#include <iostream>
int main(void) { std::cout << "hello, world\n"; }

./output/host/usr/bin/bfin-buildroot-linux-uclibc-g++ -o t t.c                                                                                                         
/home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/../../../../bfin-buildroot-linux-uclibc/bin/ld:
t: hidden symbol `___gtdf2' in
/home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/libgcc.a(_gt_df.o)
is referenced by DSO
/home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/../../../../bfin-buildroot-linux-uclibc/bin/ld:
final link failed: Bad value
collect2: error: ld returned 1 exit status

It seems not specific to ___gtdf2, I have seen other symbols in
other buildsystems.

./output/host/usr/bin/bfin-buildroot-linux-uclibc-g++ -v                                                                                                               
Using built-in specs.
COLLECT_GCC=/home/wbx/buildroot/output/host/usr/bin/bfin-buildroot-linux-uclibc-g++.br_real
COLLECT_LTO_WRAPPER=/home/wbx/buildroot/output/host/usr/libexec/gcc/bfin-buildroot-linux-uclibc/6.1.0/lto-wrapper
Target: bfin-buildroot-linux-uclibc
Configured with: ./configure
--prefix=/home/wbx/buildroot/output/host/usr
--sysconfdir=/home/wbx/buildroot/output/host/etc --enable-static
--target=bfin-buildroot-linux-uclibc
--with-sysroot=/home/wbx/buildroot/output/host/usr/bfin-buildroot-linux-uclibc/sysroot
--disable-__cxa_atexit --with-gnu-ld --disable-libssp
--disable-multilib --with-gmp=/home/wbx/buildroot/output/host/usr
--with-mpfr=/home/wbx/buildroot/output/host/usr
--with-pkgversion='Buildroot 2016.08-git-01367-gdf60d48'
--with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath
--disable-libsanitizer --disable-tls --disable-libmudflap
--enable-threads --with-mpc=/home/wbx/buildroot/output/host/usr
--without-isl --without-cloog --disable-decimal-float
--enable-languages=c,c++
--with-build-time-tools=/home/wbx/buildroot/output/host/usr/bfin-buildroot-linux-uclibc/bin
--enable-shared --disable-libgomp
Thread model: posix
gcc version 6.1.0 (Buildroot 2016.08-git-01367-gdf60d48) 

binutils 2.26.1, gcc 6.1.0 is used.

At least two patches are applied on top of gcc 6.1.0,
one for Bug 68468 and one for Bug 71721.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68468
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71721

ADI GNU Toolchain 2014R1 can compile the test program.

Does anyone have an idea?

best regards
 Waldemar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] bfin c++ problem
       [not found]         ` <20160721121643.GP4023@csltok.swansea.ac.uk>
@ 2016-07-21 16:47           ` Waldemar Brodkorb
  2016-07-25 17:24             ` Waldemar Brodkorb
  0 siblings, 1 reply; 3+ messages in thread
From: Waldemar Brodkorb @ 2016-07-21 16:47 UTC (permalink / raw)
  To: buildroot

Hi Oliver,
Oliver Kullmann wrote,

> On Thu, Jul 21, 2016 at 12:40:43PM +0100, Jonathan Wakely wrote:
> > On 21 July 2016 at 12:12, Oliver Kullmann wrote:
> > > On Thu, Jul 21, 2016 at 11:26:42AM +0100, Jonathan Wakely wrote:
> > >> On 21 July 2016 at 04:05, Oliver Kullmann wrote:
> > >> > Hello,
> > >> >
> > >> > a C++ compiler is not required to recognise "main(void)":
> > >>
> > >> That's incorrect.

Thanks for any advice about correct usage of C++, but I am afraid
it does not help in any way to fix my original problem.
Please open up a new thread to discuss this. Thanks.

Anyway, even a simple C application does compile with gcc, but not
with g++:

./output/host/usr/bin/bfin-buildroot-linux-uclibc-g++ -o t test.c
/home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/../../../../bfin-buildroot-linux-uclibc/bin/ld:
t: hidden symbol `___gtdf2' in
/home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/libgcc.a(_gt_df.o)
is referenced by DSO
/home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/../../../../bfin-buildroot-linux-uclibc/bin/ld:
final link failed: Bad value
collect2: error: ld returned 1 exit status
$ cat test.c
int main() {
 return(0);
}

$ ./output/host/usr/bin/bfin-buildroot-linux-uclibc-gcc -o t test.c
$ file t
t: ELF 32-bit LSB executable, Analog Devices Blackfin, version 1
(SYSV), dynamically linked (uses shared libs), not stripped
$ 

Any advice? Why does the hidden symbols in libgcc.a from the
first-stage gcc, doesn't make it into libstdc++ shared library?

Buildroot first compiles gcc with --disable-shared and have then a
libgcc.a. Afterwards the C library (uClibc-ng) is build. In the next
step a full --enable-shared gcc including libstdc++ is build.
This one is then somehow mislinked and then g++ can not compile 
a simple application.

It must be some architecture specific problem, because we are not
seeing this kind of issues on any other architecture at the moment.

Thanks in advance
 Waldemar

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] bfin c++ problem
  2016-07-21 16:47           ` Waldemar Brodkorb
@ 2016-07-25 17:24             ` Waldemar Brodkorb
  0 siblings, 0 replies; 3+ messages in thread
From: Waldemar Brodkorb @ 2016-07-25 17:24 UTC (permalink / raw)
  To: buildroot

Hi,
Waldemar Brodkorb wrote,

> Hi Oliver,
> Oliver Kullmann wrote,
> 
> > On Thu, Jul 21, 2016 at 12:40:43PM +0100, Jonathan Wakely wrote:
> > > On 21 July 2016 at 12:12, Oliver Kullmann wrote:
> > > > On Thu, Jul 21, 2016 at 11:26:42AM +0100, Jonathan Wakely wrote:
> > > >> On 21 July 2016 at 04:05, Oliver Kullmann wrote:
> > > >> > Hello,
> > > >> >
> > > >> > a C++ compiler is not required to recognise "main(void)":
> > > >>
> > > >> That's incorrect.
> 
> Thanks for any advice about correct usage of C++, but I am afraid
> it does not help in any way to fix my original problem.
> Please open up a new thread to discuss this. Thanks.
> 
> Anyway, even a simple C application does compile with gcc, but not
> with g++:
> 
> ./output/host/usr/bin/bfin-buildroot-linux-uclibc-g++ -o t test.c
> /home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/../../../../bfin-buildroot-linux-uclibc/bin/ld:
> t: hidden symbol `___gtdf2' in
> /home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/libgcc.a(_gt_df.o)
> is referenced by DSO
> /home/wbx/buildroot/output/host/usr/lib/gcc/bfin-buildroot-linux-uclibc/6.1.0/../../../../bfin-buildroot-linux-uclibc/bin/ld:
> final link failed: Bad value
> collect2: error: ld returned 1 exit status
> $ cat test.c
> int main() {
>  return(0);
> }
> 
> $ ./output/host/usr/bin/bfin-buildroot-linux-uclibc-gcc -o t test.c
> $ file t
> t: ELF 32-bit LSB executable, Analog Devices Blackfin, version 1
> (SYSV), dynamically linked (uses shared libs), not stripped
> $ 
> 
> Any advice? Why does the hidden symbols in libgcc.a from the
> first-stage gcc, doesn't make it into libstdc++ shared library?
> 
> Buildroot first compiles gcc with --disable-shared and have then a
> libgcc.a. Afterwards the C library (uClibc-ng) is build. In the next
> step a full --enable-shared gcc including libstdc++ is build.
> This one is then somehow mislinked and then g++ can not compile 
> a simple application.
> 
> It must be some architecture specific problem, because we are not
> seeing this kind of issues on any other architecture at the moment.

I think this might be solved by using a linker script for
libgcc_so.so as described here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40134

But now I am fighting again with:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68468

How can the libgcc dwarf or sjlj execptions needed for C++ can be
compiled for FDPIC toolchains?

best regards
 Waldemar

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-25 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21  0:04 [Buildroot] bfin c++ problem Waldemar Brodkorb
     [not found] ` <20160721030504.GN4023@csltok.swansea.ac.uk>
     [not found]   ` <CAH6eHdRNcLv9iT8dKN_zneVp2=P=yakUH=p8wq5dz5q2gNL-xQ@mail.gmail.com>
     [not found]     ` <20160721111244.GO4023@csltok.swansea.ac.uk>
     [not found]       ` <CAH6eHdT-H+4qUe3uU268uG8O_7KQLoOZchtsW3AdFAVaeuN6cg@mail.gmail.com>
     [not found]         ` <20160721121643.GP4023@csltok.swansea.ac.uk>
2016-07-21 16:47           ` Waldemar Brodkorb
2016-07-25 17:24             ` Waldemar Brodkorb

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.