Skip to content

Commit

Permalink
support clang build
Browse files Browse the repository at this point in the history
  • Loading branch information
mebusw committed Sep 7, 2023
1 parent 82bfb67 commit 685b26b
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion compel/test/fdspy/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CC := gcc
CC ?= gcc
CFLAGS ?= -O2 -g -Wall -Werror

COMPEL := ../../../compel/compel-host
Expand Down
2 changes: 1 addition & 1 deletion compel/test/infect/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CC := gcc
CC ?= gcc
CFLAGS ?= -O2 -g -Wall -Werror

COMPEL := ../../../compel/compel-host
Expand Down
2 changes: 1 addition & 1 deletion compel/test/rsys/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CC := gcc
CC ?= gcc
CFLAGS ?= -O2 -g -Wall -Werror

COMPEL := ../../../compel/compel-host
Expand Down
10 changes: 5 additions & 5 deletions criu/arch/aarch64/include/asm/restorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define RUN_CLONE_RESTORE_FN(ret, clone_flags, new_sp, parent_tid, \
thread_args, clone_restore_fn) \
asm volatile( \
"clone_emul: \n" \
"clone_emul_%=: \n" \
"ldr x1, %2 \n" \
"and x1, x1, #~15 \n" \
"sub x1, x1, #16 \n" \
Expand All @@ -24,16 +24,16 @@
"mov x8, #"__stringify(__NR_clone)" \n" \
"svc #0 \n" \
\
"cbz x0, thread_run \n" \
"cbz x0, thread_run_%= \n" \
\
"mov %0, x0 \n" \
"b clone_end \n" \
"b clone_end_%= \n" \
\
"thread_run: \n" \
"thread_run_%=: \n" \
"ldp x1, x0, [sp] \n" \
"br x1 \n" \
\
"clone_end: \n" \
"clone_end_%=: \n" \
: "=r"(ret) \
: "r"(clone_flags), \
"m"(new_sp), \
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/docker.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SKIP_CI_PREP=1
ZDTM_OPTS=-x zdtm/static/binfmt_misc -x zdtm/static/sched_policy00
CC=gcc
CC=clang
SKIP_EXT_DEV_TEST=1
2 changes: 1 addition & 1 deletion scripts/ci/run-ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ci_prep () {
# This can fail on aarch64 travis
service apport stop || :

if [ "$CLANG" = "1" ]; then
if [ "$CC" = "clang" ]; then
# clang support
CC=clang
# If this is running in an environment without gcc installed
Expand Down
2 changes: 1 addition & 1 deletion scripts/nmk/scripts/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HOSTLD ?= ld
ifeq ($(origin LD), default)
LD := $(CROSS_COMPILE)$(HOSTLD)
endif
HOSTCC ?= gcc
HOSTCC ?= clang
ifeq ($(origin CC), default)
CC := $(CROSS_COMPILE)$(HOSTCC)
endif
Expand Down
2 changes: 1 addition & 1 deletion test/others/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
loop:
gcc -Wall loop.c -o loop
$(CC) -Wall loop.c -o loop
4 changes: 2 additions & 2 deletions test/others/app-emu/job/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ all: job
.PHONY: all

%.o: %.c
gcc -c $< -o $@
$(CC) -c $< -o $@

job: job.o
gcc -o $@ job.o
$(CC) -o $@ job.o

clean:
rm -f *.o job
Expand Down
2 changes: 1 addition & 1 deletion test/others/app-emu/make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ all: foo1.o foo2.o foo3.o foo4.o
.PHONY: all

%.o: %.c
gcc -c $< -o $@
$(CC) -c $< -o $@

foo%.c: tmpl.c
cp $< $@
Expand Down
2 changes: 1 addition & 1 deletion test/others/ext-links/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: mvlink.so

mvlink.so: mvlink.c
gcc -g -Werror -Wall -shared -nostartfiles mvlink.c -o mvlink.so -iquote ../../../criu/include -fPIC
$(CC) -g -Werror -Wall -shared -nostartfiles mvlink.c -o mvlink.so -iquote ../../../criu/include -fPIC
4 changes: 2 additions & 2 deletions test/others/libcriu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ run: all

define genb
$(1): $(1).o lib.o
gcc $$^ -L ../../../../criu/lib/c/ -L ../../../../criu/images/ -lcriu -o $$@
$(CC) $$^ -L ../../../../criu/lib/c/ -L ../../../../criu/images/ -lcriu -o $$@
endef

$(foreach t, $(TESTS), $(eval $(call genb, $(t))))

%.o: %.c
gcc -c $^ -iquote ../../../../criu/criu/include -I../../../../criu/lib/c/ -I../../../../criu/images/ -o $@ -Werror
$(CC) -c $^ -iquote ../../../../criu/criu/include -I../../../../criu/lib/c/ -I../../../../criu/images/ -o $@ -Werror

clean: libcriu_clean
rm -rf $(TESTS) $(TESTS:%=%.o) lib.o
Expand Down
6 changes: 3 additions & 3 deletions test/others/mounts/ext/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
all: ext-mount.so ns_init

ext-mount.so: ext-mount.c
gcc -g -Werror -Wall -shared -nostartfiles ext-mount.c -o ext-mount.so -iquote ../../../include -fPIC
$(CC) -g -Werror -Wall -shared -nostartfiles ext-mount.c -o ext-mount.so -iquote ../../../include -fPIC

ns_init: ns_init.o
gcc -static $< -o $@
$(CC) -static $< -o $@

ns_init.o: ns_init.c
gcc -c $< -o $@
$(CC) -c $< -o $@

run: all
./run.sh
8 changes: 4 additions & 4 deletions test/others/unix-callback/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ unix.pb-c.c: unix.proto
protoc-c --proto_path=. --c_out=. unix.proto

unix-lib.so: unix-lib.c unix.pb-c.c
gcc -g -Werror -Wall -shared -nostartfiles unix-lib.c unix.pb-c.c -o unix-lib.so -iquote ../../../criu/include -fPIC
$(CC) -g -Werror -Wall -shared -nostartfiles unix-lib.c unix.pb-c.c -o unix-lib.so -iquote ../../../criu/include -fPIC

syslog-lib.so: syslog-lib.c
gcc -g -Werror -Wall -shared -nostartfiles syslog-lib.c -o syslog-lib.so -iquote ../../../criu/include -fPIC
$(CC) -g -Werror -Wall -shared -nostartfiles syslog-lib.c -o syslog-lib.so -iquote ../../../criu/include -fPIC

unix-server: unix-server.c
gcc -Werror -Wall -o unix-server unix-server.c
$(CC) -Werror -Wall -o unix-server unix-server.c

unix-client: unix-client.c
gcc -Werror -Wall -o unix-client unix-client.c
$(CC) -Werror -Wall -o unix-client unix-client.c

clean:
rm -rf data unix-lib.so unix-server unix-client syslog-lib.so output pid unix.pb-c.*
2 changes: 1 addition & 1 deletion test/zdtm/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ifeq ($(ARCH),arm)
endif
endif

HOSTCC ?= gcc
HOSTCC ?= clang
ifeq ($(origin CC), default)
CC := $(CROSS_COMPILE)$(HOSTCC)
endif
Expand Down

0 comments on commit 685b26b

Please sign in to comment.