Wrong crt0 pulled in with official arm-gcc toolchain?
Sven Pauli
sven_pauli@gmx.de
Sun Feb 23 19:37:26 GMT 2025
Hi,
So I mis-counted the `../../` in the mmap - it totally picks up the correct
`crt0.o` from newlib. The symbols I am wondering about stem from the
`crtbegin.o/crtend.o` that is, runtime startup so to say (`crtstuff.c`).
What caused my linkage errors to appear is that I keep a /DISCARD/ section in
my linker script that wipes away anything not catered for (I do explicitly
state e.g., the dwarf sections etc.) as a means to get an alert if anything
wants to be linked in that I might have forgotten, so that's what happened.
The new gcc seems to issue `.text.deregister_tm_clones` and
`.text.register_tm_clones` sections that depend on a section called
`.tm_clone_table` that I wiped away. `deregister_tm_clones` is called from
`__do_global_dtors_aux` (I could get rid of the d-tors, I'll never see them on
bare-metal anyway). The other one is called from the frame dummy via the init
array.
I don't know if it's necessary to have this transactional memory stuff sitting
around. I think I haven't fully understood what it is needed for here
(stm32f103), though. There seems to be `-fno-gnu-tm` but it still emits some
70bytes or so.
Pardon the hassle - many thanks & kind regards,
Sven
(Also, again, apologies to Richard, now I figured out the mailing list)
Am Donnerstag, 16. Januar 2025, 15:44:50 CET schrieb Richard Earnshaw (lists):
> On 15/01/2025 18:42, Sven Pauli wrote:
> > Hi,
> >
> >
> > I've just recently upgraded my (fairly old) toolchain to the latest
> > official one (arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi)
> > distributed by ARM.
> >
> >
> > It seems that for some reason now when linking it started to pull in
> > `crt0.o` from gcc (./lib/gcc/arm-none-eabi/...) instead of the one that
> > comes with newlib (./arm-none-eabi/lib/...), and that in turn expects
> > various symbols to be defined, mainly related to transactional memory
> > (__TMC_END__ from .text.register_tm_clones and so on).
> >
> >
> > I haven't changed anything since the upgrade; command lines are pretty
> > basic, just `-mcpu=cortex-m3` and `--specs=nano.specs --
> > specs=nosys.specs`. I'm using the `crti/crto/crtbegin/crtend` that
> > belongs to gcc (so I don't want to use `nostartfiles`) and I intended to
> > use the `crt0` from newlib, and I provide my own startup that relocates
> > the data segment and then defers to `_start`.
> >
> >
> > Now I am a bit clueless where to adjust something. Is this a gcc or a
> > newlib or a user issue..?
> >
> >
> > Many thanks and kind regards,
> >
> > Sven
>
> Can you double-check your installation, please? I can only find
>
> ./arm-none-eabi/lib/thumb/v7-a+simd/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7-a+simd/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v7e-m+dp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7e-m+dp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8-a+simd/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v8-a+simd/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v7+fp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7+fp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8-m.main/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v7e-m/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v7-a+fp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7-a+fp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+pacbti/bp/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v8-a/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+mve/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8-m.main+dp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v8-m.main+dp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+pacbti+mve/bp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v7ve+simd/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7ve+simd/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8-m.main+fp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v8-m.main+fp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v6-m/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v7-a/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v7/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v7e-m+fp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7e-m+fp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+pacbti+fp/bp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+pacbti+fp/bp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v7-m/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+pacbti+dp/bp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v8.1-m.main+pacbti+dp/bp/hard/crt0.o
> ./arm-none-eabi/lib/thumb/v8-m.base/nofp/crt0.o
> ./arm-none-eabi/lib/thumb/v7-r+fp.sp/softfp/crt0.o
> ./arm-none-eabi/lib/thumb/v7-r+fp.sp/hard/crt0.o
> ./arm-none-eabi/lib/arm/v5te/softfp/crt0.o
> ./arm-none-eabi/lib/arm/v5te/hard/crt0.o
> ./arm-none-eabi/lib/crt0.o
>
> In the install image (x86 hosted).
>
> So I wonder if you've picked up a crt0.o from somewhere else.
>
> R.
More information about the Newlib
mailing list