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

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 27 12:46:26 UTC 2017


On 27/02/17 13:40, Jan.Sommer at dlr.de wrote:
> 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

Is this reference generated by the compiler or some GCC runtime source 
code? The atomic operations are implemented via the libatomic, so you 
should only have __atomic_() references.

>
> 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.

They implement this atomic operation in hardware.

> Is that correct behavior? If yes, which library do I need to add to the linker?

It is a compiler or GCC runtime configuration issue.

>
>
> 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
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list