On 21/12/17 5:47 pm, Sebastian Huber wrote: > Hello, > > we should try to understand better why the things are how they are currently.
Agreed. > In Newlib we have this ctr0.c: > > https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=blob;f=newlib/libc/sys/rtems/crt0.c;h=9778b985a180ba68990b40b6e4423aa970ca5ec7;hb=HEAD > > > This is the default start file for the RTEMS GCC: > > https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/rtems.h?view=markup > > /* > * Dummy start/end specification to let linker work as > * needed by autoconf scripts using this compiler. > */ > #undef STARTFILE_SPEC > #define STARTFILE_SPEC "crt0.o%s" > > We use the bsp_specs to override this (we could also use -nostartfiles at the > command line): > > %rename startfile old_startfile > > *startfile: > %{!qrtems: %(old_startfile)} \ > %{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}} > > Why do we define a STARTFILE_SPEC in GCC which we don't use for real > applications? > I good question. The gcc defaults should be focused on a user and the closer this is to other platforms the better. > The purpose of the ctr0.o seems to be to make the Autoconf stuff happy during > GCC build, e.g. for libstdc++. Do other build system tests, ie autoconf, require an installed BSP? > One option would be to do this: > > 1. Change STARTFILE_SPEC: > > #undef STARTFILE_SPEC > #define STARTFILE_SPEC "start.o%s crti.o%s crtbegin.o" > What does a list mean? > 2. Rename Newlib ctr0.o into start.o and do NOT install it. This way it is > used > only during GCC build to make the GCC Autoconf happy. OK. > 3. Provide start.o in all BSPs. > > How do we deal with other Autoconf (or other link-time feature detection) > stuff? > This change could break all the third party library build scripts. I do not think this can be avoided or we can never change what we have. I do not like the use of -B on the gcc command line. > We could install the Newlib crt0.o as fakestart.o and add a -qfakestart > option, > e.g. to use LDFLAGS += "-qfakestart"? newlibstart.o or startstub.o? > > Bonus work: > > What this this for a stuff? > > /* > * Some targets do not set up LIB_SPECS, override it, here. > */ > #define STD_LIB_SPEC "%{!shared:%{g*:-lg} > %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" > > The libg.a and libc.a are identical: > > sha512sum /opt/rtems/5/sparc-rtems5/lib/lib[cg].a > 6e19f30fde6fbd23e5af9060e8a76d7294b5f23677561770a26ae04c44c4fd920b45d4f42f3cde2ede1962bfbb0429b5d7ced89fe448340a5b4936fb716c7e6b > > /opt/rtems/5/sparc-rtems5/lib/libc.a > 6e19f30fde6fbd23e5af9060e8a76d7294b5f23677561770a26ae04c44c4fd920b45d4f42f3cde2ede1962bfbb0429b5d7ced89fe448340a5b4936fb716c7e6b > > /opt/rtems/5/sparc-rtems5/lib/libg.a > Your guess is as good as mine. Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel