Skip to content

Commit

Permalink
fix conflicted symbol printf malloc etc
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Oct 19, 2023
1 parent fd1eed4 commit f574808
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile.clang
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AR := llvm-ar${LLVM_SURFFIX}
RANLIB := llvm-ranlib${LLVM_SURFFIX}

CFLAGS := --target=riscv64 -march=rv64imc_zba_zbb_zbc_zbs
CFLAGS += -D__ISO_C_VISIBLE=1999 -DCKB_DECLARATION_ONLY -fPIC -g -O3
CFLAGS += -D__ISO_C_VISIBLE=1999 -DCKB_DECLARATION_ONLY -DCKB_MALLOC_DECLARATION_ONLY -DCKB_PRINTF_DECLARATION_ONLY -fPIC -g -O3
CFLAGS += -fno-builtin-printf -fno-builtin-memcmp \
-nostdinc -nostdlib\
-fdata-sections -ffunction-sections
Expand Down Expand Up @@ -41,7 +41,7 @@ docker-interactive:
deps/compiler-rt-builtins-riscv/build/libcompiler-rt.a:
cd deps/compiler-rt-builtins-riscv && $(MAKE) CC=$(CC) LD=$(LD) OBJCOPY=$(OBJCOPY) AR=$(AR) RANLIB=$(RANLIB)

build/impl.o: include/ckb-c-stdlib/libc/src/impl.c
build/stdlib.o: include/ckb-c-stdlib/libc/src/impl.c
@echo $(CC) $(filter-out -DCKB_DECLARATION_ONLY, $(CFLAGS)) -c -o $@ $<
@$(CC) $(filter-out -DCKB_DECLARATION_ONLY, $(CFLAGS)) -c -o $@ $<

Expand All @@ -64,7 +64,7 @@ build/lua-loader.o: lua-loader/lua-loader.c
# Note when -nostdlib is specified, libgcc is not linked to the program automatically.
# Also note libgcc.a must be appended to the file list, simply -lgcc does not for some reason.
# It seems gcc does not search libgcc in the install path.
build/lua-loader: build/lua-loader.o build/impl.o lualib/liblua.a deps/compiler-rt-builtins-riscv/build/libcompiler-rt.a
build/lua-loader: build/lua-loader.o build/stdlib.o lualib/liblua.a deps/compiler-rt-builtins-riscv/build/libcompiler-rt.a
$(LD) $(LDFLAGS) -o $@ $^
cp $@ [email protected]
$(OBJCOPY) --strip-debug --strip-all $@
Expand Down

0 comments on commit f574808

Please sign in to comment.