g++ re-ordering of libraries causing linker errors

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

g++ re-ordering of libraries causing linker errors

Christoph Conrads
When building a program for an embedded system, linking fails with g++
but not with gcc because g++ is re-ordering the libraries passed on the
command line.

The target is arm-none-eabi and the toolchain is the GNU Arm Embedded
Toolchain, release 7-2018-q2-update (GCC 7.3.1). Consider the following
program in a file called `main.c`:

  #include <stdlib.h>
  int main(void) { exit(0); }

For a successful build, my target device requires the following command
line:

  ~/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc \
    -c main.c -o main.o
  ~/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc \
    -specs=nano.specs -Tscript.ld \
        main.o -o demo.elf -lc -lm -lnosys

`script.ld` is a manufacturer-provided linker script which I cannot
post. `nano.specs` is a specs file shipping with the GNU Arm Embedded
Toolchain (it might originate from newlib-nano). `libnosys` contains
implementations of functions that are usually provided by "the operating
system". In particular, it contains the symbol `_exit`.

The build succeeds with arm-none-eabi-gcc but fails with arm-none-eabi-g++:

/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
 -c main.c -o main.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
 -specs=nano.specs -Tscript.ld main.o -o demo.elf -lc -lm -lnosys
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o):
In function `exit':
exit.c:(.text.exit+0x34): undefined reference to `_exit'
collect2: error: ld returned 1 exit status

Passing `--verbose` on the compiler command line reveals a subtle
difference in the way gcc and g++ link the program (full output below).
With gcc:

  collect2 main.o \
     [snip] \
    -lc_nano -lm -lnosys \
    --start-group -lgcc -lc_nano --end-group \
    [snip]

With g++:

  collect2 main.o \
    [snip] \
    -lnosys -lstdc++_nano -lm -lc_nano \
    --start-group -lgcc -lc_nano --end-group \
    [snip]

The compilation fails because g++ re-ordered the list of libraries
such that `libnosys` appears first as a library to link against. I
expected to see the following order with g++:

    -lstdc++_nano -lm -lc_nano -lnosys \
    --start-group -lgcc -lc_nano --end-group


My questions are as follows:

1.) Is this a g++ bug?
2.) If this is a g++ bug, how can I work around it?
3.) If this is not a g++ bug, why not?


Complete build output gcc:

$ make CC=~/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc
CFLAGS='--verbose'
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc
--verbose -c main.c -o main.o
Using built-in specs.
COLLECT_GCC=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc
Target: arm-none-eabi
Configured with:
/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/src/gcc/configure
--target=arm-none-eabi
--prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native
--libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/lib
--infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/info
--mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/man
--htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/html
--pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/pdf
--enable-languages=c,c++ --enable-plugins --disable-decimal-float
--disable-libffi --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libssp --disable-libstdcxx-pch
--disable-nls --disable-shared --disable-threads --disable-tls
--with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes
--with-python-dir=share/gcc-arm-none-eabi
--with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/arm-none-eabi
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm' --with-pkgversion='GNU Tools for Arm Embedded Processors
7-2018-q2-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'main.o'
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/cc1
-quiet -v -iprefix
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/
-isysroot /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi
-D__USES_INITFINI__ main.c -quiet -dumpbase main.c -auxbase-strip
main.o -version -o /tmp/ccRMTJfm.s
GNU C11 (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (arm-none-eabi)
        compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version
3.1.4, MPC version 1.0.3, isl version isl-0.15-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include"
ignoring nonexistent directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include-fixed"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/include
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/include-fixed
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include
End of search list.
GNU C11 (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (arm-none-eabi)
        compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version
3.1.4, MPC version 1.0.3, isl version isl-0.15-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: fe5c63cd00843f93f7875575edbc8726
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'main.o'
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/as
-v -meabi=5 -o main.o /tmp/ccRMTJfm.s
GNU assembler version 2.30.0 (arm-none-eabi) using BFD version (GNU
Tools for Arm Embedded Processors 7-2018-q2-update) 2.30.0.20180329
COMPILER_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'main.o'
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc
--verbose -specs=nano.specs -Tscript.ld main.o -o demo.elf -lc -lm
-lnosys
Using built-in specs.
Reading specs from
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/nano.specs
rename spec link to nano_link
rename spec link_gcc_c_sequence to nano_link_gcc_c_sequence
rename spec cpp_unique_options to nano_cpp_unique_options
COLLECT_GCC=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/lto-wrapper
Target: arm-none-eabi
Configured with:
/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/src/gcc/configure
--target=arm-none-eabi
--prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native
--libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/lib
--infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/info
--mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/man
--htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/html
--pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/pdf
--enable-languages=c,c++ --enable-plugins --disable-decimal-float
--disable-libffi --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libssp --disable-libstdcxx-pch
--disable-nls --disable-shared --disable-threads --disable-tls
--with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes
--with-python-dir=share/gcc-arm-none-eabi
--with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/arm-none-eabi
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm' --with-pkgversion='GNU Tools for Arm Embedded Processors
7-2018-q2-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
COMPILER_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-specs=nano.specs' '-T' 'script.ld' '-o' 'demo.elf'
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/collect2
-plugin /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/liblto_plugin.so
-plugin-opt=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccuxuBbu.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc_nano
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc_nano
--sysroot=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi
-X -o demo.elf /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crti.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crtbegin.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/crt0.o
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib
main.o -lc_nano -lm -lnosys --start-group -lgcc -lc_nano --end-group
--start-group -lgcc -lc_nano --end-group
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crtend.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crtn.o
-T script.ld
COLLECT_GCC_OPTIONS='-v' '-specs=nano.specs' '-T' 'script.ld' '-o' 'demo.elf'



Complete build output g++:

$ make CC=~/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
CFLAGS='--verbose'
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
--verbose -c main.c -o main.o
Using built-in specs.
COLLECT_GCC=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
Target: arm-none-eabi
Configured with:
/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/src/gcc/configure
--target=arm-none-eabi
--prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native
--libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/lib
--infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/info
--mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/man
--htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/html
--pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/pdf
--enable-languages=c,c++ --enable-plugins --disable-decimal-float
--disable-libffi --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libssp --disable-libstdcxx-pch
--disable-nls --disable-shared --disable-threads --disable-tls
--with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes
--with-python-dir=share/gcc-arm-none-eabi
--with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/arm-none-eabi
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm' --with-pkgversion='GNU Tools for Arm Embedded Processors
7-2018-q2-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'main.o'
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/cc1plus
-quiet -v -iprefix
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/
-isysroot /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi
-D__USES_INITFINI__ main.c -quiet -dumpbase main.c -auxbase-strip
main.o -version -o /tmp/ccGn8zQI.s
GNU C++14 (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (arm-none-eabi)
        compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version
3.1.4, MPC version 1.0.3, isl version isl-0.15-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1/arm-none-eabi"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1/backward"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include"
ignoring nonexistent directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/usr/local/include"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/include-fixed"
ignoring duplicate directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/../../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include"
ignoring nonexistent directory
"/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1/arm-none-eabi
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include/c++/7.3.1/backward
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/include
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/include-fixed
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/include
End of search list.
GNU C++14 (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (arm-none-eabi)
        compiled by GNU C version 4.8.4, GMP version 6.1.0, MPFR version
3.1.4, MPC version 1.0.3, isl version isl-0.15-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 62353cd5102bba936abfe473d9a75a86
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'main.o'
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/as
-v -meabi=5 -o main.o /tmp/ccGn8zQI.s
GNU assembler version 2.30.0 (arm-none-eabi) using BFD version (GNU
Tools for Arm Embedded Processors 7-2018-q2-update) 2.30.0.20180329
COMPILER_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-c' '-o' 'main.o'
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
--verbose -specs=nano.specs -Tscript.ld main.o -o demo.elf -lc -lm
-lnosys
Using built-in specs.
Reading specs from
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/nano.specs
rename spec link to nano_link
rename spec link_gcc_c_sequence to nano_link_gcc_c_sequence
rename spec cpp_unique_options to nano_cpp_unique_options
COLLECT_GCC=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-g++
COLLECT_LTO_WRAPPER=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/lto-wrapper
Target: arm-none-eabi
Configured with:
/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/src/gcc/configure
--target=arm-none-eabi
--prefix=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native
--libexecdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/lib
--infodir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/info
--mandir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/man
--htmldir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/html
--pdfdir=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/share/doc/gcc-arm-none-eabi/pdf
--enable-languages=c,c++ --enable-plugins --disable-decimal-float
--disable-libffi --disable-libgomp --disable-libmudflap
--disable-libquadmath --disable-libssp --disable-libstdcxx-pch
--disable-nls --disable-shared --disable-threads --disable-tls
--with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes
--with-python-dir=share/gcc-arm-none-eabi
--with-sysroot=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/install-native/arm-none-eabi
--build=x86_64-linux-gnu --host=x86_64-linux-gnu
--with-gmp=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpfr=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-mpc=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-isl=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-libelf=/tmp/jenkins/jenkins-GCC-7-build_toolchain_docker-775_20180622_1529687456/build-native/host-libs/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm' --with-pkgversion='GNU Tools for Arm Embedded Processors
7-2018-q2-update' --with-multilib-list=rmprofile
Thread model: single
gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch revision
261907] (GNU Tools for Arm Embedded Processors 7-2018-q2-update)
COMPILER_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/
LIBRARY_PATH=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/:/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-specs=nano.specs' '-T' 'script.ld' '-o' 'demo.elf'
 /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/collect2
-plugin /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/liblto_plugin.so
-plugin-opt=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccPoWixR.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc_nano
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc_nano
--sysroot=/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi
-X -o demo.elf /home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crti.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crtbegin.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/crt0.o
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib
-L/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../arm-none-eabi/lib
main.o -lnosys -lstdc++_nano -lm -lc_nano --start-group -lgcc -lc_nano
--end-group --start-group -lgcc -lc_nano --end-group
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crtend.o
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/crtn.o
-T script.ld
/home/christoph/gcc-arm-none-eabi-7-2018-q2-update/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o):
In function `exit':
exit.c:(.text.exit+0x34): undefined reference to `_exit'
collect2: error: ld returned 1 exit status
Makefile:9: recipe for target 'demo.elf' failed
make: *** [demo.elf] Error 1