grisp / grisp2-rtems-toolchain

Basic tools and libraries to get an RTEMS system running on GRiSP2.
Other
13 stars 6 forks source link

error: implicit declaration of function 'mallopt'; did you mean 'malloc'? #11

Closed eproxus closed 4 years ago

eproxus commented 4 years ago

Seems mallopt is missing somehow. I get this error when compiling the Erlang VM:

beam/utils.c:4313:6: error: implicit declaration of function 'mallopt'; did you mean 'malloc'? [-Werror=implicit-function-declaration]
   if(mallopt(m_opt, value)) {
      ^~~~~~~
      malloc

That file includes malloc.h. In our main file we include the following header files:

#include <assert.h>
#include <bsp.h>
#include <machine/rtems-bsd-commands.h>
#include <rtems.h>
#include <rtems/bdbuf.h>
#include <rtems/bsd/bsd.h>
#include <rtems/console.h>
#include <rtems/console.h>
#include <rtems/ftpd.h>
#include <rtems/libio.h>
#include <rtems/malloc.h>
#include <rtems/media.h>
#include <rtems/score/armv7m.h>
#include <rtems/shell.h>
#include <rtems/stringto.h>
#include <sys/mman.h>
#include <sysexits.h>

Is mallopt available in our RTEMS toolchain?

c-mauderer commented 4 years ago

mallopt seems to be a Linux function. I didn't find it in Posix:

http://man7.org/linux/man-pages/man3/mallopt.3.html

It seems that newlib at least knows it. It's declared in malloc.h.

But to be honest: I never needed that function and I don't know whether we support it in RTEMS. It sounds like a lot of fine grained stuff about how an allocation is done could be controlled by the application. @sebhub: Do we support that?

sebhub commented 4 years ago

This function is not supported by RTEMS.

eproxus commented 4 years ago

:+1: Okay, thanks for the information. Then I'll have a look at why the Erlang build system detects it as available.

eproxus commented 4 years ago

After some more digging our theory is that the configure script creates a test program with a main function that tries to call mallopt. When this compiles it is optimised away by the RTEMS compiler and the test is seen as successful.

Do you know if there is any way to control the compiler so that main functions are included (without having to "manually" edit the test program that configure generates)?

sebhub commented 4 years ago

Could you please look into the configure log to check which program code is used for the check, is it only compiled or also linked, does it use the same compiler flags as used later to build the library objects?

peerst commented 4 years ago

We did not succeed to extract the source code (its not included in config.log) but it is linked for sure (seeing it from the command line).

Hypothethis: main() is not called and therefore removed by the linker so linking doesn't fail

We also tried linking rtemsdefaultconfig but that didn't make a difference.

Do you know a trick how we could provoke linking of main() from the command line (one that doesn't hurt later when we actually build since the same flags are used there of course)

eproxus commented 4 years ago

More digging and hacking exposed the failing program:

conftest.c ```c /* confdefs.h */ #define PACKAGE_NAME "" #define PACKAGE_TARNAME "" #define PACKAGE_VERSION "" #define PACKAGE_STRING "" #define PACKAGE_BUGREPORT "" #define PACKAGE_URL "" #define ASSUMED_CACHE_LINE_SIZE 64 #define ERTS_SAVED_COMPILE_TIME 1 #define ERTS_ENABLE_MSACC 1 #define ERTS_NO_RETPOLINE #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_STDINT_H 1 #define HAVE_UNISTD_H 1 #define SIZEOF_VOID_P 4 #define HAVE_LIBM 1 #define ETHR_TRUST_GCC_ATOMIC_BUILTINS_MEMORY_BARRIERS 0 #define HAVE_PTHREAD_H 1 #define HAVE_CLOCK_GETRES 1 #define HAVE_CLOCK_GET_ATTRIBUTES 1 #define HAVE_GETHRTIME 1 #define ETHR_HAVE_CLOCK_GETTIME_MONOTONIC 1 #define ETHR_MONOTONIC_CLOCK_ID CLOCK_MONOTONIC #define ETHR_PTHREADS 1 #define ETHR_HAVE_PTHREAD_H 1 #define ETHR_HAVE_SCHED_H 1 #define ETHR_HAVE_SYS_TIME_H 1 #define ETHR_TIME_WITH_SYS_TIME 1 #define ETHR_HAVE_USABLE_PTHREAD_STACK_MIN 1 #define ETHR_HAVE_PTHREAD_SPIN_LOCK 1 #define ETHR_HAVE_SCHED_YIELD 1 #define ETHR_SCHED_YIELD_RET_INT 1 #define ETHR_HAVE_PTHREAD_YIELD 1 #define ETHR_HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1 #define ETHR_HAVE_PTHREAD_ATTR_SETGUARDSIZE 1 #define ETHR_HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC 1 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF___INT128_T 0 #define ETHR_HAVE___sync_synchronize ~0 #define ETHR_HAVE___sync_add_and_fetch 12 #define ETHR_HAVE___sync_fetch_and_and 12 #define ETHR_HAVE___sync_fetch_and_or 12 #define ETHR_HAVE___sync_val_compare_and_swap 12 #define ETHR_HAVE___atomic_store_n 12 #define ETHR_HAVE___atomic_load_n 12 #define ETHR_HAVE___atomic_add_fetch 12 #define ETHR_HAVE___atomic_fetch_and 12 #define ETHR_HAVE___atomic_fetch_or 12 #define ETHR_HAVE___atomic_compare_exchange_n 12 #define ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION 1 #define ETHR_HAVE_GCC___ATOMIC_BUILTINS 1 #define SIZEOF_VOID_P 4 #define ETHR_SIZEOF_PTR 4 #define SIZEOF_INT 4 #define ETHR_SIZEOF_INT 4 #define SIZEOF_LONG 4 #define ETHR_SIZEOF_LONG 4 #define SIZEOF_LONG_LONG 8 #define ETHR_SIZEOF_LONG_LONG 8 #define SIZEOF___INT64 0 #define ETHR_SIZEOF___INT64 0 #define SIZEOF___INT128_T 0 #define ETHR_SIZEOF___INT128_T 0 #define ETHR_HAVE_ETHREAD_DEFINES 1 #define ETHR_SMP_REQUIRE_NATIVE_IMPLS 1 #define HAVE_POSIX_FADVISE 1 #define HAVE_CLOSEFROM 1 #define HAVE_WCWIDTH 1 #define HAVE_LIBZ 1 #define HAVE_ZLIB_INFLATEGETDICTIONARY 1 #define HAVE_LOCALTIME_R 1 #define HAVE_STRFTIME 1 #define ESOCK_COUNTER_SIZE 64 #define HAVE_WORKING_POSIX_OPENPT 1 #define HAVE_SOCKLEN_T 1 #define H_ERRNO_DECLARED 1 #define HAVE_DIRENT_H 1 #define STDC_HEADERS 1 #define HAVE_SYS_WAIT_H 1 #define TIME_WITH_SYS_TIME 1 #define HAVE_FCNTL_H 1 #define HAVE_LIMITS_H 1 #define HAVE_UNISTD_H 1 #define HAVE_SYSLOG_H 1 #define HAVE_DLFCN_H 1 #define HAVE_IEEEFP_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_SYSCTL_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_UIO_H 1 #define HAVE_SYS_MMAN_H 1 #define HAVE_SYS_SOCKET_H 1 #define HAVE_SYS_SOCKIO_H 1 #define HAVE_MALLOC_H 1 #define HAVE_ARPA_NAMESER_H 1 #define HAVE_LANGINFO_H 1 #define HAVE_POLL_H 1 #define HAVE_SYS_RESOURCE_H 1 #define HAVE_DECL_GETRLIMIT 0 #define HAVE_DECL_SETRLIMIT 0 #define HAVE_DECL_RLIMIT_STACK 0 #define HAVE_GETRUSAGE 1 #define HAVE_SCTP_H 1 #define HAVE_SCTP_BINDX 1 #define HAVE_SCTP_PEELOFF 1 #define HAVE_SCTP_GETLADDRS 1 #define HAVE_SCTP_FREELADDRS 1 #define HAVE_SCTP_GETPADDRS 1 #define HAVE_SCTP_FREEPADDRS 1 #define HAVE_DECL_SCTP_UNORDERED 1 #define HAVE_DECL_SCTP_ADDR_OVER 1 #define HAVE_DECL_SCTP_ABORT 1 #define HAVE_DECL_SCTP_EOF 1 #define HAVE_DECL_SCTP_SENDALL 1 #define HAVE_DECL_SCTP_ADDR_CONFIRMED 1 #define HAVE_DECL_SCTP_DELAYED_ACK_TIME 0 #define HAVE_DECL_SCTP_EMPTY 0 #define HAVE_DECL_SCTP_UNCONFIRMED 1 #define HAVE_DECL_SCTP_CLOSED 1 #define HAVE_DECL_SCTPS_IDLE 0 #define HAVE_DECL_SCTP_BOUND 1 #define HAVE_DECL_SCTPS_BOUND 0 #define HAVE_DECL_SCTP_LISTEN 1 #define HAVE_DECL_SCTPS_LISTEN 0 #define HAVE_DECL_SCTP_COOKIE_WAIT 1 #define HAVE_DECL_SCTPS_COOKIE_WAIT 0 #define HAVE_DECL_SCTP_COOKIE_ECHOED 1 #define HAVE_DECL_SCTPS_COOKIE_ECHOED 0 #define HAVE_DECL_SCTP_ESTABLISHED 1 #define HAVE_DECL_SCTPS_ESTABLISHED 0 #define HAVE_DECL_SCTP_SHUTDOWN_PENDING 1 #define HAVE_DECL_SCTPS_SHUTDOWN_PENDING 0 #define HAVE_DECL_SCTP_SHUTDOWN_SENT 1 #define HAVE_DECL_SCTPS_SHUTDOWN_SENT 0 #define HAVE_DECL_SCTP_SHUTDOWN_RECEIVED 1 #define HAVE_DECL_SCTPS_SHUTDOWN_RECEIVED 0 #define HAVE_DECL_SCTP_SHUTDOWN_ACK_SENT 1 #define HAVE_DECL_SCTPS_SHUTDOWN_ACK_SENT 0 #define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_PATHMTU 1 #define HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_FLAGS 1 #define HAVE_STRUCT_SCTP_REMOTE_ERROR_SRE_DATA 1 #define HAVE_STRUCT_SCTP_SEND_FAILED_SSF_DATA 1 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_AUTHENTICATION_EVENT 1 #define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE_SCTP_SENDER_DRY_EVENT 1 #define HAVE_SCHED_H 1 #define HAVE_SETNS 1 #define RETSIGTYPE void #define SIZEOF_CHAR 1 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 #define SIZEOF_LONG 4 #define SIZEOF_VOID_P 4 #define SIZEOF_LONG_LONG 8 #define SIZEOF_SIZE_T 4 #define SIZEOF_OFF_T 8 #define SIZEOF_TIME_T 8 #define SIZEOF_SUSECONDS_T 4 #define ERTS_RESTRICT restrict #define ERTS_ENDIANNESS -1 #define HAVE_FDATASYNC 1 #define HAVE_GETADDRINFO 1 #define HAVE_GETNAMEINFO 1 #define HAVE_GETIPNODEBYNAME 1 #define HAVE_GETIPNODEBYADDR 1 #define HAVE_GETHOSTBYNAME2 1 #define HAVE_IEEE_HANDLER 1 #define HAVE_FPSETMASK 1 #define HAVE_FINITE 1 #define HAVE_ISNAN 1 #define HAVE_ISINF 1 #define HAVE_RES_GETHOSTBYNAME 1 #define HAVE_DLOPEN 1 #define HAVE_PREAD 1 #define HAVE_PWRITE 1 #define HAVE_MEMMOVE 1 #define HAVE_STRERROR 1 #define HAVE_STRERROR_R 1 #define HAVE_STRNCASECMP 1 #define HAVE_GETHRTIME 1 #define HAVE_LOCALTIME_R 1 #define HAVE_GMTIME_R 1 #define HAVE_INET_PTON 1 #define HAVE_MPROTECT 1 #define HAVE_MMAP 1 #define HAVE_MREMAP 1 #define HAVE_MEMCPY 1 /* end confdefs.h. */ /* Define mallopt to an innocuous variant, in case declares mallopt. For example, HP-UX 11i declares gettimeofday. */ #define mallopt innocuous_mallopt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mallopt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef mallopt /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char mallopt (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_mallopt || defined __stub___mallopt choke me #endif int main () { return mallopt (); ; return 0; } ```

Compiled with the following command line:

$ /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/bin/arm-rtems5-gcc --pipe -B /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/arm-rtems5/imx7/lib -specs bsp_specs -qrtems -o conftest -fno-common -MT imx7 -MD -MP -MF imx7.d -Wall -Wextra -Wconversion -Wformat-security -Wformat=2 -Wshadow -Wcast-qual -Wcast-align -Wredundant-decls -Wstrict-prototypes -Wbad-function-cast -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a7 -O2 -g -ffunction-sections -fdata-sections -I/Users/user/GRiSP/test/_grisp/otp/22.3.3/build/erts/arm-unknown-rtems5  -fno-tree-copyrename   -DUSE_THREADS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a7 -O2 -g -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-Map,imx7.map -qnolinkcmds conftest.c -lm -lgrisp -lbsd -lrtemsdefaultconfig
conftest.c:222:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 char mallopt ();
 ^~~~
conftest.c:231:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 main ()
 ^~~~
/Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: warning: cannot find entry symbol _start; defaulting to 000000000000800c

This generated

imx7.map
Discarded input sections

 .text          0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
 .data          0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
 .bss           0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
 .data          0x0000000000000000        0x4 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 .text          0x0000000000000000        0x0 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .data          0x0000000000000000        0x0 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .bss           0x0000000000000000        0x0 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .text.startup.main
                0x0000000000000000        0x8 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_info    0x0000000000000000       0x5b /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_abbrev  0x0000000000000000       0x55 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_aranges
                0x0000000000000000       0x20 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_ranges  0x0000000000000000       0x10 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_line    0x0000000000000000       0x3d /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_str     0x0000000000000000      0x163 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .comment       0x0000000000000000       0x48 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .debug_frame   0x0000000000000000       0x28 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .text          0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o
 .data          0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o
 .bss           0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o
 .text          0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o
 .data          0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o
 .bss           0x0000000000000000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o

Memory Configuration

Name             Origin             Length             Attributes
*default*        0x0000000000000000 0xffffffffffffffff

Linker script and memory map

LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
LOAD /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/lib/thumb/armv7-a/neon/hard/libm.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/arm-rtems5/imx7/lib/libgrisp.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/arm-rtems5/imx7/lib/libbsd.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/arm-rtems5/imx7/lib/librtemsdefaultconfig.a
START GROUP
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/libgcc.a
START GROUP
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/arm-rtems5/imx7/lib/librtemsbsp.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/arm-rtems5/imx7/lib/librtemscpu.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/libatomic.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/lib/thumb/armv7-a/neon/hard/libc.a
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/libgcc.a
END GROUP
END GROUP
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o
LOAD /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o
                [!provide]                        PROVIDE (__executable_start = SEGMENT_START ("text-segment", 0x8000))
                0x0000000000008000                . = SEGMENT_START ("text-segment", 0x8000)

.interp
 *(.interp)

.note.gnu.build-id
 *(.note.gnu.build-id)

.hash
 *(.hash)

.gnu.hash
 *(.gnu.hash)

.dynsym
 *(.dynsym)

.dynstr
 *(.dynstr)

.gnu.version
 *(.gnu.version)

.gnu.version_d
 *(.gnu.version_d)

.gnu.version_r
 *(.gnu.version_r)

.rel.dyn        0x0000000000008000        0x0
 *(.rel.init)
 *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
 *(.rel.fini)
 *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
 *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
 *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
 *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
 *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
 *(.rel.ctors)
 *(.rel.dtors)
 *(.rel.got)
 *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
                [!provide]                        PROVIDE (__rel_iplt_start = .)
 *(.rel.iplt)
 .rel.iplt      0x0000000000008000        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
                [!provide]                        PROVIDE (__rel_iplt_end = .)

.rela.dyn       0x0000000000008000        0x0
 *(.rela.init)
 *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
 *(.rela.fini)
 *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
 *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
 *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
 *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
 *(.rela.ctors)
 *(.rela.dtors)
 *(.rela.got)
 *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
                [!provide]                        PROVIDE (__rela_iplt_start = .)
 *(.rela.iplt)
                [!provide]                        PROVIDE (__rela_iplt_end = .)

.rel.plt
 *(.rel.plt)

.rela.plt
 *(.rela.plt)

.init           0x0000000000008000        0xc
 *(SORT_NONE(.init))
 .init          0x0000000000008000        0x4 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
                0x0000000000008000                _init
 .init          0x0000000000008004        0x8 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o

.plt
 *(.plt)

.iplt           0x000000000000800c        0x0
 *(.iplt)
 .iplt          0x000000000000800c        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o

.text           0x000000000000800c       0xa8
 *(.text.unlikely .text.*_unlikely .text.unlikely.*)
 *(.text.exit .text.exit.*)
 *(.text.startup .text.startup.*)
 *(.text.hot .text.hot.*)
 *(SORT_BY_NAME(.text.sorted.*))
 *(.text .stub .text.* .gnu.linkonce.t.*)
 .text          0x000000000000800c       0xa8 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 *(.gnu.warning)
 *(.glue_7t)
 .glue_7t       0x00000000000080b4        0x0 linker stubs
 *(.glue_7)
 .glue_7        0x00000000000080b4        0x0 linker stubs
 *(.vfp11_veneer)
 .vfp11_veneer  0x00000000000080b4        0x0 linker stubs
 *(.v4_bx)
 .v4_bx         0x00000000000080b4        0x0 linker stubs

.fini           0x00000000000080b4        0xc
 *(SORT_NONE(.fini))
 .fini          0x00000000000080b4        0x4 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
                0x00000000000080b4                _fini
 .fini          0x00000000000080b8        0x8 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o
                [!provide]                        PROVIDE (__etext = .)
                [!provide]                        PROVIDE (_etext = .)
                [!provide]                        PROVIDE (etext = .)

.rodata
 *(.rodata .rodata.* .gnu.linkonce.r.*)

.rodata1
 *(.rodata1)

.ARM.extab
 *(.ARM.extab* .gnu.linkonce.armextab.*)

.ARM.exidx      0x00000000000080c0        0x0
                [!provide]                        PROVIDE (__exidx_start = .)
 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
                [!provide]                        PROVIDE (__exidx_end = .)

.eh_frame_hdr
 *(.eh_frame_hdr)
 *(.eh_frame_entry .eh_frame_entry.*)

.eh_frame       0x00000000000080c0        0x4
 *(.eh_frame)
 .eh_frame      0x00000000000080c0        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 .eh_frame      0x00000000000080c0        0x4 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o
 *(.eh_frame.*)

.gcc_except_table
 *(.gcc_except_table .gcc_except_table.*)

.gnu_extab
 *(.gnu_extab*)

.exception_ranges
 *(.exception_ranges*)
                0x00000000000180c4                . = (ALIGN (CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 0x1)))

.eh_frame
 *(.eh_frame)
 *(.eh_frame.*)

.gnu_extab
 *(.gnu_extab)

.gcc_except_table
 *(.gcc_except_table .gcc_except_table.*)

.exception_ranges
 *(.exception_ranges*)

.tdata          0x00000000000180c4        0x0
                [!provide]                        PROVIDE (__tdata_start = .)
 *(.tdata .tdata.* .gnu.linkonce.td.*)

.tbss
 *(.tbss .tbss.* .gnu.linkonce.tb.*)
 *(.tcommon)

.preinit_array  0x00000000000180c4        0x0
                [!provide]                        PROVIDE (__preinit_array_start = .)
 *(.preinit_array)
                [!provide]                        PROVIDE (__preinit_array_end = .)

.init_array     0x00000000000180c4        0x4
                [!provide]                        PROVIDE (__init_array_start = .)
 *(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))
 *(.init_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .ctors)
 .init_array    0x00000000000180c4        0x4 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
                [!provide]                        PROVIDE (__init_array_end = .)

.fini_array     0x00000000000180c8        0x4
                [!provide]                        PROVIDE (__fini_array_start = .)
 *(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))
 *(.fini_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .dtors)
 .fini_array    0x00000000000180c8        0x4 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
                [!provide]                        PROVIDE (__fini_array_end = .)

.ctors
 *crtbegin.o(.ctors)
 *crtbegin?.o(.ctors)
 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
 *(SORT_BY_NAME(.ctors.*))
 *(.ctors)

.dtors
 *crtbegin.o(.dtors)
 *crtbegin?.o(.dtors)
 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
 *(SORT_BY_NAME(.dtors.*))
 *(.dtors)

.jcr
 *(.jcr)

.data.rel.ro
 *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
 *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)

.dynamic
 *(.dynamic)

.got            0x00000000000180cc        0x0
 *(.got.plt)
 *(.igot.plt)
 .igot.plt      0x00000000000180cc        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 *(.got)
 *(.igot)

.data           0x00000000000180cc        0x0
                0x00000000000180cc                __data_start = .
 *(.data .data.* .gnu.linkonce.d.*)

.tm_clone_table
                0x00000000000180cc        0x0
 .tm_clone_table
                0x00000000000180cc        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 .tm_clone_table
                0x00000000000180cc        0x0 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o

.data1
 *(.data1)
                0x00000000000180cc                _edata = .
                [!provide]                        PROVIDE (edata = .)
                0x00000000000180cc                . = .
                0x00000000000180cc                __bss_start = .
                0x00000000000180cc                __bss_start__ = .

.bss            0x00000000000180cc       0x1c
 *(.dynbss)
 *(.bss .bss.* .gnu.linkonce.b.*)
 .bss           0x00000000000180cc       0x1c /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 *(COMMON)
                0x00000000000180e8                . = ALIGN ((. != 0x0)?0x4:0x1)
                0x00000000000180e8                _bss_end__ = .
                0x00000000000180e8                __bss_end__ = .
                0x00000000000180e8                . = ALIGN (0x4)
                0x00000000000180e8                . = SEGMENT_START ("ldata-segment", .)
                0x00000000000180e8                . = ALIGN (0x4)
                0x00000000000180e8                __end__ = .
                0x00000000000180e8                _end = .
                [!provide]                        PROVIDE (end = .)

.stack          0x0000000000080000        0x0
                0x0000000000080000                _stack = .
 *(.stack)

.stab
 *(.stab)

.stabstr
 *(.stabstr)

.stab.excl
 *(.stab.excl)

.stab.exclstr
 *(.stab.exclstr)

.stab.index
 *(.stab.index)

.stab.indexstr
 *(.stab.indexstr)

.comment        0x0000000000000000       0x47
 *(.comment)
 .comment       0x0000000000000000       0x47 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
                                         0x48 (size before relaxing)
 .comment       0x0000000000000047       0x48 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o

.gnu.build.attributes
 *(.gnu.build.attributes .gnu.build.attributes.*)

.debug
 *(.debug)

.line
 *(.line)

.debug_srcinfo
 *(.debug_srcinfo)

.debug_sfnames
 *(.debug_sfnames)

.debug_aranges
 *(.debug_aranges)

.debug_pubnames
 *(.debug_pubnames)

.debug_info
 *(.debug_info .gnu.linkonce.wi.*)

.debug_abbrev
 *(.debug_abbrev)

.debug_line
 *(.debug_line .debug_line.* .debug_line_end)

.debug_frame
 *(.debug_frame)

.debug_str
 *(.debug_str)

.debug_loc
 *(.debug_loc)

.debug_macinfo
 *(.debug_macinfo)

.debug_weaknames
 *(.debug_weaknames)

.debug_funcnames
 *(.debug_funcnames)

.debug_typenames
 *(.debug_typenames)

.debug_varnames
 *(.debug_varnames)

.debug_pubtypes
 *(.debug_pubtypes)

.debug_ranges
 *(.debug_ranges)

.debug_macro
 *(.debug_macro)

.debug_addr
 *(.debug_addr)

.ARM.attributes
                0x0000000000000000       0x33
 *(.ARM.attributes)
 .ARM.attributes
                0x0000000000000000       0x23 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crti.o
 .ARM.attributes
                0x0000000000000023       0x35 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtbegin.o
 .ARM.attributes
                0x0000000000000058       0x35 /var/folders/kv/m3kq2vyj5zz4mmb1yn6t82gw0000gn/T//ccHGQQJk.o
 .ARM.attributes
                0x000000000000008d       0x35 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtend.o
 .ARM.attributes
                0x00000000000000c2       0x23 /Users/user/GRiSP/grisp2-rtems-toolchain/rtems/5/lib/gcc/arm-rtems5/7.5.0/thumb/armv7-a/neon/hard/crtn.o
 *(.gnu.attributes)

.note.gnu.arm.ident
 *(.note.gnu.arm.ident)

.noinit         0x00000000000180e8        0x0
                0x00000000000180e8                . = ALIGN (0x2)
                [!provide]                        PROVIDE (__noinit_start = .)
 *(.noinit)
                0x00000000000180e8                . = ALIGN (0x2)
                [!provide]                        PROVIDE (__noinit_end = .)

/DISCARD/
 *(.note.GNU-stack)
 *(.gnu_debuglink)
 *(.gnu.lto_*)
OUTPUT(conftest elf32-littlearm)
LOAD linker stubs

sebhub commented 4 years ago

The problem is that this test is linked using -qnolinkcmds. This leads to:

ld: warning: cannot find entry symbol _start; defaulting to 000000000000800c

The start.o provided by the BSP would start the dependency chain which would pull in the main() function of the test. In the current setup, the tests are ineffective and always pass regardless what is tested.

You have to use the linker command file provided by the BSP.

eproxus commented 4 years ago

That fixed it, thanks! I think the qnolinkcmds was a leftover from the previous cross compilation flags we used.

peerst commented 4 years ago

As a matter of fact we needed to pick another than the default linkcmd for the GRiSP1 tool chain: -qnolinkcmds -T linkcmds.sdram somehow the -qnolinkcmds was left when adapting to GRiSP2

eproxus commented 4 years ago

@peerst Unfortunately using those flags results in the original error again.

peerst commented 4 years ago

Sorry, that was a misunderstanding, just explained where -qnolinkcmds came from. Grisp1 had multiple linkcmds and we couldn't use the default one for whatever reason. This is not true for Grisp2

c-mauderer commented 4 years ago

In GRiSP1 we had a board specific external SDRAM. That made it necessary to use a special linker command file. That's no longer true for GRiSP2.