Skip to content

Commit 39c7470

Browse files
statham-armsimpal01
authored andcommitted
Fix llvmlibc sample, by adding -lm to the link command. (#69)
The sample program calls two libm functions (lround and atanf) to turn a floating-point number into decimal digits. But libm.a is built as a separate library from libc.a, so linking the sample program fails because the compile command doesn't use the -lm option. Easily fixed.
1 parent ab65405 commit 39c7470

File tree

1 file changed

+1
-1
lines changed
  • arm-software/embedded/llvmlibc-samples/src/llvmlibc/baremetal-semihosting

1 file changed

+1
-1
lines changed

arm-software/embedded/llvmlibc-samples/src/llvmlibc/baremetal-semihosting/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include ../../../Makefile.conf
1010
build: hello.elf
1111

1212
hello.elf: *.c
13-
../$(BIN_PATH)/clang --config=llvmlibc.cfg $(MICROBIT_TARGET) -nostartfiles -lsemihost -g -fno-exceptions -fno-rtti -T microbit-llvmlibc.ld -o hello.elf $^
13+
../$(BIN_PATH)/clang --config=llvmlibc.cfg $(MICROBIT_TARGET) -nostartfiles -lsemihost -lm -g -fno-exceptions -fno-rtti -T microbit-llvmlibc.ld -o hello.elf $^
1414

1515
%.hex: %.elf
1616
../$(BIN_PATH)/llvm-objcopy -O ihex $< $@

0 commit comments

Comments
 (0)