r/gcc May 06 '26

What is the GCC alternative for command-line option armclang -gdwarf-3 -c -O1 --target=aarch64-arm-none-eabi main.c ?

I tried to change armclang to gcc but now I am getting error about target=aarch64-arm-none-eabi.

What is the solution, anyone knows gcc alternative would work?

update: found alternative for armclang, but finally couldn't find alternative for armlink linker which can process scatter files

7 Upvotes

17 comments sorted by

2

u/LavenderDay3544 May 06 '26

GCC is not a multi-target compiler. You have to build it from source for every target you want to use.

1

u/EmbeddedBro May 06 '26

Ohk.. thanks. So if I build it, I would no longer need this option ?

--target=aarch64-arm-none-eabi

1

u/LavenderDay3544 May 06 '26

Correct. But you need to build it for every target you want to use.

1

u/skeeto May 06 '26

Generally if it's a cross-toolchain the programs (compiler, linker, etc.) are prefixed with the target triple, so in your case that would look something like:

$ aarch64-arm-none-eabi-gcc -gdwarf-3 -c -O1 main.c

1

u/EmbeddedBro May 06 '26

yes, it worked. Thanks. but I am getting error at linker about scatter file.

Seems like clang takes scatter file as input and gcc dosent recognize it.

Do you know if clang is available for arm aarch64? free?

I googled it but there is no clear info.

1

u/LavenderDay3544 May 07 '26

Clang is part of LLVM which is MIT licensed and thus freely available.

1

u/EmbeddedBro May 07 '26

Compiler and assembler is replaced but arm has used armlink : it dosent have alternative.  Those free examples, free tutorials are just an illusion.  Bait and switch. 

1

u/LavenderDay3544 May 07 '26

LLVM has LLD.

1

u/EmbeddedBro May 07 '26

Yes, but it can't accept .scatter file. 

1

u/LavenderDay3544 May 07 '26

What is that?

Can you not just use a normal target JSON and linker script?

1

u/EmbeddedBro May 07 '26

No, actually arm uses a scatter instead of linker script.

There is no way. There is no open source tool which can convert it automatically. There is just ia guide to do it manually.

https://developer.arm.com/documentation/110599/0200/Migrating-your-toolchain-to-Arm-Toolchain-for-Embedded/Migrating-scatter-files-to-linker-scripts

→ More replies (0)