Skip to content
Snippets Groups Projects
Commit 5de865a6 authored by Christos Gentsos's avatar Christos Gentsos
Browse files

Make: when using Clang, also use the Clang linker

parent 3c5a2cad
No related merge requests found
......@@ -16,6 +16,7 @@ gcc/samd21a
**/build/*.s
**/build/*.bc
**/build/*.a
GPATH
GRTAGS
......
......@@ -180,7 +180,7 @@ $(OUTPUT_FILE_PATH): $(OBJS) ../src/main.o
ifdef USE_CLANG
ifdef USE_CLANG_OPT
@echo Invoking: LTO Linker through Clang
$(CLANG_BIN_PATH)clang -flto -Wl,-plugin-opt=emit-llvm ../src/main.o $(OBJS:%.o=%.o) -o $(OUTPUT_FILE_NAME).bc
$(CLANG_BIN_PATH)clang -nostartfiles -flto -Wl,-plugin-opt=emit-llvm ../src/main.o $(OBJS:%.o=%.o) -o $(OUTPUT_FILE_NAME).bc
ifdef USE_CLANG_COAST
@echo Invoking: Clang -O1 pass
$(CLANG_BIN_PATH)opt -S -O1 $(OUTPUT_FILE_NAME).bc -o $(OUTPUT_FILE_NAME).o1.bc
......@@ -192,14 +192,13 @@ else # (no USE_CLANG_COAST)
endif
$(CLANG_BIN_PATH)llc $(OUTPUT_FILE_NAME).opt.bc -o $(OUTPUT_FILE_NAME).s
$(QUOTE)arm-none-eabi-as$(QUOTE) -mthumb -mcpu=cortex-m0plus $(GCC_INCS) -o $(OUTPUT_FILE_NAME).o $(OUTPUT_FILE_NAME).s
$(QUOTE)arm-none-eabi-gcc$(QUOTE) -fshort-enums -e main -L$(CLANG_NEWLIB_PATH)/lib -nolibc -o $(OUTPUT_FILE_NAME).elf $(OUTPUT_FILE_NAME).o -Wl,--start-group -lm -lc $(PRINTF_FLOAT_FLAG) -Wl,--end-group -mthumb \
-Wl,-Map="$(OUTPUT_FILE_NAME).map" --specs=nano.specs -Wl,--gc-sections -mcpu=cortex-m0plus \
-T"../atmel_start_prj/samd21a/gcc/gcc/samd21g18a_flash.ld"
$(QUOTE)arm-none-eabi-objcopy$(QUOTE) --weaken-symbol=__stack_chk_fail $(CLANG_NEWLIB_PATH)/lib/libc.a libc_wscf.a
@echo Invoking: Clang Linker \(final\)
$(CLANG_BIN_PATH)clang -DSTACK_SIZE=0x2000 -e 0x2000 -flto --target=arm-none-eabi -march=thumbv6m -fshort-enums -L$(CLANG_NEWLIB_PATH)/lib -L. -Wl,--start-group -lm -lc_wscf $(PRINTF_FLOAT_FLAG) -Wl,--end-group -o $(OUTPUT_FILE_NAME).elf $(OUTPUT_FILE_NAME).o -Wl,--gc-sections -mcpu=cortex-m0plus -T"../atmel_start_prj/samd21a/gcc/gcc/samd21g18a_flash.ld"
else # (no USE_CLANG_OPT)
@echo Invoking: ARM/GNU Linker \(Clang settings\)
$(QUOTE)arm-none-eabi-gcc$(QUOTE) -fshort-enums -L$(CLANG_NEWLIB_PATH)/lib -nolibc -o $(OUTPUT_FILE_NAME).elf $(OBJS_AS_ARGS) ../src/main.o -Wl,--start-group -lm -lc $(PRINTF_FLOAT_FLAG) -Wl,--end-group -mthumb \
-Wl,-Map="$(OUTPUT_FILE_NAME).map" --specs=nano.specs -Wl,--gc-sections -mcpu=cortex-m0plus \
-T"../atmel_start_prj/samd21a/gcc/gcc/samd21g18a_flash.ld"
$(QUOTE)arm-none-eabi-objcopy$(QUOTE) --weaken-symbol=__stack_chk_fail $(CLANG_NEWLIB_PATH)/lib/libg.a libg_wscf.a
@echo Invoking: LTO Linker through Clang
$(CLANG_BIN_PATH)clang -DSTACK_SIZE=0x2000 -e 0x2000 -flto --target=arm-none-eabi -march=thumbv6m -fshort-enums -L$(CLANG_NEWLIB_PATH)/lib -Wl,--start-group -L$(CLANG_NEWLIB_PATH)/lib -L. -lm -lg_wscf -lc -Wl,--end-group ../src/main.o $(OBJS:%.o=%.o) -o $(OUTPUT_FILE_NAME).elf -Wl,--gc-sections -mcpu=cortex-m0plus -T"../atmel_start_prj/samd21a/gcc/gcc/samd21g18a_flash.ld"
endif
else # (no USE_CLANG)
@echo Invoking: ARM/GNU Linker
......@@ -257,7 +256,7 @@ $(SUB_DIRS):
clean:
rm -f *.o *.s *.bc
rm -f *.o *.s *.bc *wscf.a
rm -f $(OBJS_AS_ARGS)
rm -f $(OBJS:%.o=%.d)
rm -f ../src/main.{o,d}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment