Re: How to properly link libgcc in -ffreestanding mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 27 Jan 2021, Josef Wolf wrote:

> $ m68k-unknown-elf-gcc -ansi -std=c89 -pedantic -Wall -Wcast-align \
>                        -Wstrict-prototypes \
>                        -Wmissing-prototypes -Wnull-dereference \
>                        -O2 -g -fno-toplevel-reorder -mcpu32 \
>                        -ffreestanding -static-libgcc -lgcc \
>                        -Wl,--cref,--section-start=vectors=0 \
>                        -nostdlib -Wl,-Ttext=0x400,--entry=entry \
>                        -Wl,--oformat,elf32-m68k \
>                        -Wl,--cref,-Map,bestd.map \
>                        -Wl,-T,ldscript.ld \
>                        -o output.elf `cat file.objs`
> 
[...]
> What am I missinghere? Any help?

On the command line, libraries need to come after object files that need them,
because when inspecting the library, the linker unpacks only those archived
object files that would satisfy some undefined symbol already required by
previously linked .o files.

Therefore, in your command line above, -lgcc needs to come after `cat
file.objs`, not before.

Alexander



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux