Undefined reference to `__sync_bool_compare_and_swap_4' for some Leon configurations with gfortran

Jan.Sommer at dlr.de Jan.Sommer at dlr.de
Mon Feb 27 12:40:11 UTC 2017


Hello,

I tried compiling the RTEMS with fortran  support for the Leon2/3 processors.
Building the cross-compiler with gfortran and the bsp worked both fine (I set the bsp to compile with --mhard-float).
A small example program for the Leon3 compiles and runs as expected, however for the leon2 I ran into a weird problem.
The linking of the example program fails with:

sparc-rtems4.12-gcc -B../../../../../leon2/lib/ -specs bsp_specs -qrtems -mcpu=cypress -mhard-float -O2 -g -ffunction-sections -fdata-sections -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs  -Wl,--gc-sections  -mcpu=cypress -mhard-float   -o ticker.exe init.o tasks.o -L/localdata/somm_ja/rtems-fortran/install/bsps/4.12/sparc/sparc-rtems4.12/leon2/lib/ -llapack -lrefblas -ltmglib -lcblas -lm -lgfortran -lgcc
/localdata/somm_ja/rtems-fortran/install/tools/4.12/sparc/lib/gcc/sparc-rtems4.12/6.3.0/libgfortran.a(elf.o): In function `backtrace_initialize':
/localdata/somm_ja/rtems-fortran/rtems-source-builder/rtems/build/sparc-rtems4.12-gcc-6.3.0-newlib-2.5.0-x86_64-linux-gnu-1/build/sparc-rtems4.12/libbacktrace/../../../gcc-6.3.0/libbacktrace/elf.c:960: undefined reference to `__sync_bool_compare_and_swap_4'
/localdata/somm_ja/rtems-fortran/install/tools/4.12/sparc/lib/gcc/sparc-rtems4.12/6.3.0/libgfortran.a(elf.o): In function `elf_add_syminfo_data':
/localdata/somm_ja/rtems-fortran/rtems-source-builder/rtems/build/sparc-rtems4.12-gcc-6.3.0-newlib-2.5.0-x86_64-linux-gnu-1/build/sparc-rtems4.12/libbacktrace/../../../gcc-6.3.0/libbacktrace/elf.c:456: undefined reference to `__sync_bool_compare_and_swap_4'
/localdata/somm_ja/rtems-fortran/install/tools/4.12/sparc/lib/gcc/sparc-rtems4.12/6.3.0/libgfortran.a(dwarf.o): In function `backtrace_dwarf_add':
/localdata/somm_ja/rtems-fortran/rtems-source-builder/rtems/build/sparc-rtems4.12-gcc-6.3.0-newlib-2.5.0-x86_64-linux-gnu-1/build/sparc-rtems4.12/libbacktrace/../../../gcc-6.3.0/libbacktrace/dwarf.c:3030: undefined reference to `__sync_bool_compare_and_swap_4'
collect2: error: ld returned 1 exit status
Makefile:627: recipe for target 'ticker.exe' failed
make: *** [ticker.exe] Error 1

If I check the different libgfortran.a libraries of sparc-rtems4.12/6.3.0 with nm I get
libgfortran.a
         U __sync_bool_compare_and_swap_4
         U __sync_bool_compare_and_swap_4

for the ones in the leon, soft and v8 directory.

The libgfortran.a in the leon3  and leon3v7 directory do not have this undefined symbol.
Is that correct behavior? If yes, which library do I need to add to the linker?


Best regards,

   Jan



Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR)
German Aerospace Center
Simulation and Software Technology | Software for Space Systems and Interactive Visualization | Lilienthalplatz 7 | 38108 Braunschweig | Germany

Jan Sommer
Telephone +49 531 295-2494 | Telefax 0531 295-2767 | jan.sommer at dlr.de
DLR.de/SC



More information about the devel mailing list