GCC build is broken due to invalid crt0.o selection

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Dec 5 07:29:27 UTC 2016


Hello,

I noticed that the ARM libgomp is built without TLS support for RTEMS, 
since the thread-local storage detection fails, due to missing symbols 
in the crt0.o. I added the missing symbols to newlib/libc/sys/rtems/crt0.c:

https://sourceware.org/ml/newlib/2016/msg01138.html

However, this still didn't work. The reason is that during GCC build the 
random crt0.o of the prefix is used. GCC searches in:

Breakpoint 10, file_at_path (path=0x72a960 
"/build/git-build/b-gcc-git-arm-rtems4.12/./gcc/arm-rtems4.12/7.0.0/thumb/", 
data=0x7fffffffc8c0) at /home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$70 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/build/git-build/b-gcc-git-arm-rtems4.12/./gcc/thumb/", 
data=0x7fffffffc8c0) at /home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$71 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/build/git-build/b-gcc-git-arm-rtems4.12/arm-rtems4.12/thumb/newlib/arm-rtems4.12/7.0.0/thumb/", 
data=0x7fffffffc8c0) at /home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$72 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/build/git-build/b-gcc-git-arm-rtems4.12/arm-rtems4.12/thumb/newlib/thumb/", 
data=0x7fffffffc8c0) at /home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$73 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/opt/rtems-4.12/arm-rtems4.12/bin/arm-rtems4.12/7.0.0/thumb/", 
data=0x7fffffffc8c0) at /home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$74 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/opt/rtems-4.12/arm-rtems4.12/bin/thumb/", data=0x7fffffffc8c0) at 
/home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$75 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/opt/rtems-4.12/arm-rtems4.12/lib/arm-rtems4.12/7.0.0/thumb/", 
data=0x7fffffffc8c0) at /home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$76 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Breakpoint 10, file_at_path (path=0x72a960 
"/opt/rtems-4.12/arm-rtems4.12/lib/thumb/", data=0x7fffffffc8c0) at 
/home/EB/sebastian_h/archive/gcc-git/gcc/gcc.c:2733
2733    {
$77 = {name = 0x728d00 "crt0.o", suffix = 0x4d2257 "", name_len = 6, 
suffix_len = 0, mode = 4}

Since all previous attempts to find the file failed, it picks up 
"/opt/rtems-4.12/arm-rtems4.12/lib/thumb/crt0.o".

Is this a bug in the Newlib build, e.g. crt0.o is placed in the wrong 
build directory? We have in the build tree:

find -name crt0.o
./arm-rtems4.12/newlib/crt0.o
./arm-rtems4.12/newlib/libc/crt0.o
./arm-rtems4.12/newlib/libc/sys/crt0.o
./arm-rtems4.12/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/newlib/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/newlib/libc/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/newlib/libc/sys/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/vfpv3-d16/hard/newlib/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/vfpv3-d16/hard/newlib/libc/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/vfpv3-d16/hard/newlib/libc/sys/crt0.o
./arm-rtems4.12/eb/thumb/armv7-r/vfpv3-d16/hard/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/newlib/crt0.o
./arm-rtems4.12/thumb/newlib/libc/crt0.o
./arm-rtems4.12/thumb/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/cortex-m7/fpv5-d16/hard/newlib/crt0.o
./arm-rtems4.12/thumb/cortex-m7/fpv5-d16/hard/newlib/libc/crt0.o
./arm-rtems4.12/thumb/cortex-m7/fpv5-d16/hard/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/cortex-m7/fpv5-d16/hard/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv6-m/newlib/crt0.o
./arm-rtems4.12/thumb/armv6-m/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv6-m/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv6-m/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv7-m/newlib/crt0.o
./arm-rtems4.12/thumb/armv7-m/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv7-m/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv7-m/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv7-m/fpv4-sp-d16/hard/newlib/crt0.o
./arm-rtems4.12/thumb/armv7-m/fpv4-sp-d16/hard/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv7-m/fpv4-sp-d16/hard/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv7-m/fpv4-sp-d16/hard/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv7-r/newlib/crt0.o
./arm-rtems4.12/thumb/armv7-r/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv7-r/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv7-r/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv7-r/vfpv3-d16/hard/newlib/crt0.o
./arm-rtems4.12/thumb/armv7-r/vfpv3-d16/hard/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv7-r/vfpv3-d16/hard/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv7-r/vfpv3-d16/hard/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv7-a/newlib/crt0.o
./arm-rtems4.12/thumb/armv7-a/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv7-a/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv7-a/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/thumb/armv7-a/neon/hard/newlib/crt0.o
./arm-rtems4.12/thumb/armv7-a/neon/hard/newlib/libc/crt0.o
./arm-rtems4.12/thumb/armv7-a/neon/hard/newlib/libc/sys/crt0.o
./arm-rtems4.12/thumb/armv7-a/neon/hard/newlib/libc/sys/rtems/crt0.o
./arm-rtems4.12/vfp/hard/newlib/crt0.o
./arm-rtems4.12/vfp/hard/newlib/libc/crt0.o
./arm-rtems4.12/vfp/hard/newlib/libc/sys/crt0.o
./arm-rtems4.12/vfp/hard/newlib/libc/sys/rtems/crt0.o

None of the crt0.o is in a search directory of GCC.

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