C++ requires that the math functions be part of the basic runtime while C allows them to be in a library. The GCC implementation achieved this by automatically linking libm in a C++ build.

There are many other differences in the link phase; C++ linking will consistently fail if a C linker is used.

For a C link, use the C linker and specify -lm to make libm available.

Answer from rici on Stack Overflow
🌐
Debian Manpages
manpages.debian.org › testing › binutils-arm-none-eabi › arm-none-eabi-ld.1.en.html
arm-none-eabi-ld(1) — binutils-arm-none-eabi — Debian testing — Debian Manpages
All gcc based linker plugins are backward compatible, so it is sufficient to just copy in the newest one. ... The --push-state allows one to preserve the current state of the flags which govern the input file handling so that they can all be restored with one corresponding --pop-state option.
🌐
Arm Community
community.arm.com › support-forums › f › compilers-and-libraries-forum › 52126 › linking-with-arm-none-eabi-gcc-instead-of-arm-none-eabi-ld
Linking with arm-none-eabi-gcc instead of arm-none-eabi-ld
January 14, 2022 - Have a question about working on Arm technology? Browse our support forums for solutions to your questions, answer questions from fellow community members and get help from Arm experts.
🌐
Debian Manpages
manpages.debian.org › jessie › binutils-arm-none-eabi › arm-none-eabi-ld(1)
arm-none-eabi-ld(1) — binutils-arm-none-eabi — Debian jessie — Debian Manpages
By default, on SunOS, the linker will form a runtime search path out of all the -L options it is given. If a -rpath option is used, the runtime search path will be formed exclusively using the -rpath options, ignoring the -L options. This can be useful when using gcc, which adds many -L options which may be on NFS mounted file systems.
🌐
Debian Manpages
manpages.debian.org › unstable › binutils-arm-none-eabi › arm-none-eabi-ld.1.en.html
arm-none-eabi-ld(1) — binutils-arm-none-eabi — Debian unstable — Debian Manpages
All gcc based linker plugins are backward compatible, so it is sufficient to just copy in the newest one. ... The --push-state allows one to preserve the current state of the flags which govern the input file handling so that they can all be restored with one corresponding --pop-state option.
🌐
Stack Overflow
stackoverflow.com › questions › 65545866 › is-there-any-reference-to-main-in-the-default-linker-scripts-of-arm-none-eabi
gcc - Is there any reference to "main" in the default linker scripts of arm-none-eabi that could interfere when linking from the command line - Stack Overflow
.thumb .syntax unified .globl _start _start: .word 0x20001000 .word reset reset: bl notmain b . int notmain ( void ) { return(0); } arm-none-eabi-gcc -O2 -c -mthumb main.c -o main.o arm-none-eabi-as start.s -o start.o arm-none-eabi-gcc -O2 -c -mthumb main.c -o main.o arm-none-eabi-ld -Ttext=0x08000000 start.o main.o -o main.elf arm-none-eabi-objdump -d main.elf main.elf: file format elf32-littlearm Disassembly of section .text: 08000000 <_start>: 8000000: 20001000 .word 0x20001000 8000004: 08000008 .word 0x08000008 08000008 <reset>: 8000008: f000 f802 bl 8000010 <xmain> 800000c: e7fe b.n 800000c <reset+0x4> ...
🌐
manned.org
manned.org › arm-none-eabi-gcc › 34fd6095
arm-none-eabi-gcc - manned.org
Instead of describing the displayed options, an indication is given as to whether the option is enabled, disabled or set to a specific value (assuming that the compiler knows this at the point where the --help= option is used). Here is a truncated example from the ARM port of gcc: % gcc -Q -mabi=2 --help=target -c The following options are target specific: -mabi= 2 -mabort-on-noreturn [disabled] -mapcs [disabled] The output is sensitive to the effects of previous command-line options, so for example it is possible to find out which optimizations are enabled at -O2 by using: -Q -O2 --help=optim
Find elsewhere
🌐
Microchip
onlinedocs.microchip.com › oxy › GUID-ECD8A826-B1DA-44FC-BE0B-5A53418A47BD-en-US-12 › GUID-EE68B1F6-215A-48B1-8878-AC7DCC2B44E5.html
7.2 Arm Compiler and Toolchain Options: GUI
Alternatively, you can write arm-none-eabi-gcc --help and see the explanation of some of the parameters in the command output · This section illustrates the GUI options available for the Arm GNU Toolchain in Microchip Studio. Figure 7-1. Arm® GNU Toolchain Properties ... In 'linker->miscellaneous->linker flags' ($LinkerScript_FLASH) is added by default.
🌐
Stack Overflow
stackoverflow.com › questions › 40519786 › use-arm-none-eabi-gcc-to-invoke-arm-none-eabi-ld
ldflags - Use arm-none-eabi-gcc to invoke arm-none-eabi-ld? - Stack Overflow
January 13, 2017 - Linking: ugui3.elf arm-none-eabi-gcc -std=c11 -Wall -Werror -Wfatal-errors -Wstrict prototypes -Wundef -gdwarf-2 -O2 -mthumb -mthumb-interwork -mcpu=cortex-m7 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mlittle-endian stm32746g_discovery.o stm32746g_discovery_lcd.o stm32746g_discovery_sdram.o stm32746g_discovery_ts.o system_stm32f7xx.o stm32f7xx_hal.o stm32f7xx_hal_cortex.o stm32f7xx_hal_dma.o stm32f7xx_hal_dma2d.o stm32f7xx_hal_dma_ex.o stm32f7xx_hal_gpio.o stm32f7xx_hal_i2c.o stm32f7xx_hal_i2c_ex.o stm32f7xx_hal_ltdc.o stm32f7xx_hal_pwr.o stm32f7xx_hal_pwr_ex.o stm32f7xx_hal_rcc.o stm32f7xx_hal_rcc_ex.o stm32f7xx_hal_sdram.o stm32f7xx_hal_uart.o stm32f7xx_ll_fmc.o stm32f7xx_hal_msp.o stm32f7xx_it.o main.o ugui.o ltdc.o sdram.o ft5336.o small_printf.o startup_stm32f746xx.o --output ugui3.elf -nodefaultlibs -T./STM32F746NGHx_FLASH.ld -Wl,-Map=ugui3.map,--cref
🌐
GNU
gcc.gnu.org › onlinedocs › gcc › ARM-Options.html
ARM Options (Using the GNU Compiler Collection (GCC))
If such behavior is acceptable, use -static and -Wl,-dynamic-linker options. The opposite -mno-fdpic option is useful (and required) to build the Linux kernel using the same (arm-*-uclinuxfdpiceabi) toolchain as the one used to build the userland programs.
🌐
GitHub
github.com › rust-lang › rust › issues › 113597
Regression when using `linker=arm-none-eabi-gcc` · Issue #113597 · rust-lang/rust
July 12, 2023 - git clone https://github.com/rust-embedded/cortex-m cd cortex-m/cortex-m-rt rustup toolchain install nightly-2023-07-03 rustup target add thumbv6m-none-eabi --toolchain nightly-2023-07-03 cargo +nightly-2023-07-03 rustc --target thumbv6m-none-eabi --example alignment --features cortex-m/critical-section-single-core -- -C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles
Author   adamgreig
🌐
STMicroelectronics Community
community.st.com › t5 › stm32-mcus-products › gnu-linker-arm-none-eabi-gcc-9-2-1-how-to-reserve-16k-flash › td-p › 320301
Solved: GNU linker (arm-none-eabi-gcc 9.2.1): how to reser... - STMicroelectronics Community
April 12, 2020 - The linker script still is like in the first post, perhaps it was some cache variable that was updated... ... ISR_VECTOR (rx) : ORIGIN = 0x08000000, LENGTH = 16K USER_FLASH (rx) : ORIGIN = 0x80004000, LENGTH = 16K FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 224K · While the output of "arm-none-eabi-objdump -h Bootloader-V0.6" gives me:
🌐
GNU
gcc.gnu.org › onlinedocs › gcc › Link-Options.html
Link Options (Using the GNU Compiler Collection (GCC))
The -l option is passed directly to the linker by GCC. Refer to your linker documentation for exact details.
🌐
Arch Linux Man Pages
man.archlinux.org › man › arm-none-eabi-gcc.1.en
arm-none-eabi-gcc(1) — Arch manual pages
Unlike the --target-help option however, target-specific options of the linker and assembler are not displayed. This is because those tools do not currently support the extended --help= syntax. ... Display the values recognized by the --param option. ... Display the options supported for language, where language is the name of one of the languages supported in this version of GCC.