Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig: Add cflags_extra option #607

Closed
wants to merge 1 commit into from

Conversation

plajjan
Copy link
Contributor

@plajjan plajjan commented Jan 10, 2024

This passes through extra options to the compiler. No validation is performed, the value is passed through as-is.

Part of #602

@ivmai
Copy link
Owner

ivmai commented Jan 10, 2024

It does not work for 2 options. E.g. -Dcflags_extra="-D NO_TEST_HANDLE_FORK -D GC_DISABLE_INCREMENTAL" passes only -D NO_TEST_HANDLE_FORK to the compiler but not -D GC_DISABLE_INCREMENTAL.

@ivmai ivmai mentioned this pull request Jan 10, 2024
11 tasks
build.zig Outdated Show resolved Hide resolved
@plajjan
Copy link
Contributor Author

plajjan commented Jan 10, 2024

It does not work for 2 options. E.g. -Dcflags_extra="-D NO_TEST_HANDLE_FORK -D GC_DISABLE_INCREMENTAL" passes only -D NO_TEST_HANDLE_FORK to the compiler but not -D GC_DISABLE_INCREMENTAL.

I was afraid of that it would require separating them... I'll have a look!

@plajjan
Copy link
Contributor Author

plajjan commented Jan 10, 2024

@ivmai hmm, actually, are you sure?

kll@Boxy:~/terastream/acton-deps/bdwgc$ ~/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/zig build --verbose -DCFLAGS_EXTRA="-D FOO -D BAR" 2>&1 | grep --color FOO
/home/kll/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/zig build-lib -cflags -D ALL_INTERIOR_POINTERS -D NO_EXECUTE_PERMISSION -Wall -Wextra -Wpedantic -D FOO -D BAR -D GC_BUILTIN_ATOMIC -D GC_THREADS -D _REENTRANT -D PARALLEL_MARK -D THREAD_LOCAL_ALLOC -D HANDLE_FORK -D GC_GCJ_SUPPORT -D GC_ENABLE_SUSPEND_THREAD -D ENABLE_DISCLAIM -D JAVA_FINALIZATION -D GC_ATOMIC_UNCOLLECTABLE -D USE_MMAP -D USE_MUNMAP -D GC_PTHREAD_START_STANDALONE -Wno-frame-address -fno-strict-aliasing -D GC_DLL -D GC_VISIBILITY_HIDDEN_SET -fvisibility=hidden -D HAVE_SYS_TYPES_H -D HAVE_UNISTD_H -D HAVE_DL_ITERATE_PHDR -D HAVE_PTHREAD_SIGMASK -D GC_REQUIRE_WCSDUP -D HAVE_PTHREAD_SETNAME_NP_WITH_TID -D HAVE_DLADDR -- /home/kll/terastream/acton-deps/bdwgc/extra/gc.c /home/kll/terastream/acton-deps/bdwgc/pthread_start.c -ODebug -I /home/kll/terastream/acton-deps/bdwgc/include -lc --cache-dir /home/kll/terastream/acton-deps/bdwgc/zig-cache --global-cache-dir /home/kll/.cache/zig --name gc -dynamic --listen=- 
kll@Boxy:~/terastream/acton-deps/bdwgc$ 

both -D FOO and -D BAR makes it onto the command arguments that are passed on to zig build-lib and if we look at next step (with --verbose-cc) where it invokes zig clang that too has both options:

kll@Boxy:~/terastream/acton-deps/bdwgc$ ~/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/zig build --verbose-cc -DCFLAGS_EXTRA="-D FOO -D BAR" 2>&1 
install
└─ install gc
   └─ zig build-lib gc Debug native failure
error: /home/kll/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/zig clang /home/kll/terastream/acton-deps/bdwgc/extra/gc.c --no-default-config -fno-caret-diagnostics -D__GLIBC_MINOR__=36 -target x86_64-unknown-linux-gnu -nostdinc -fno-spell-checking -isystem /home/kll/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/lib/include -isystem /usr/include -Xclang -target-cpu -Xclang znver3 -Xclang -target-feature -Xclang -16bit-mode -Xclang -target-feature -Xclang -32bit-mode -Xclang -target-feature -Xclang -3dnow -Xclang -target-feature -Xclang -3dnowa -Xclang -target-feature -Xclang +64bit -Xclang -target-feature -Xclang +adx -Xclang -target-feature -Xclang +aes -Xclang -target-feature -Xclang +allow-light-256-bit -Xclang -target-feature -Xclang -amx-bf16 -Xclang -target-feature -Xclang -amx-complex -Xclang -target-feature -Xclang -amx-fp16 -Xclang -target-feature -Xclang -amx-int8 -Xclang -target-feature -Xclang -amx-tile -Xclang -target-feature -Xclang +avx -Xclang -target-feature -Xclang +avx2 -Xclang -target-feature -Xclang -avx512bf16 -Xclang -target-feature -Xclang -avx512bitalg -Xclang -target-feature -Xclang -avx512bw -Xclang -target-feature -Xclang -avx512cd -Xclang -target-feature -Xclang -avx512dq -Xclang -target-feature -Xclang -avx512er -Xclang -target-feature -Xclang -avx512f -Xclang -target-feature -Xclang -avx512fp16 -Xclang -target-feature -Xclang -avx512ifma -Xclang -target-feature -Xclang -avx512pf -Xclang -target-feature -Xclang -avx512vbmi -Xclang -target-feature -Xclang -avx512vbmi2 -Xclang -target-feature -Xclang -avx512vl -Xclang -target-feature -Xclang -avx512vnni -Xclang -target-feature -Xclang -avx512vp2intersect -Xclang -target-feature -Xclang -avx512vpopcntdq -Xclang -target-feature -Xclang -avxifma -Xclang -target-feature -Xclang -avxneconvert -Xclang -target-feature -Xclang -avxvnni -Xclang -target-feature -Xclang -avxvnniint16 -Xclang -target-feature -Xclang -avxvnniint8 -Xclang -target-feature -Xclang +bmi -Xclang -target-feature -Xclang +bmi2 -Xclang -target-feature -Xclang +branchfusion -Xclang -target-feature -Xclang -cldemote -Xclang -target-feature -Xclang +clflushopt -Xclang -target-feature -Xclang +clwb -Xclang -target-feature -Xclang +clzero -Xclang -target-feature -Xclang +cmov -Xclang -target-feature -Xclang -cmpccxadd -Xclang -target-feature -Xclang +crc32 -Xclang -target-feature -Xclang +cx16 -Xclang -target-feature -Xclang +cx8 -Xclang -target-feature -Xclang -enqcmd -Xclang -target-feature -Xclang -ermsb -Xclang -target-feature -Xclang +f16c -Xclang -target-feature -Xclang -false-deps-getmant -Xclang -target-feature -Xclang -false-deps-lzcnt-tzcnt -Xclang -target-feature -Xclang -false-deps-mulc -Xclang -target-feature -Xclang -false-deps-mullq -Xclang -target-feature -Xclang -false-deps-perm -Xclang -target-feature -Xclang -false-deps-popcnt -Xclang -target-feature -Xclang -false-deps-range -Xclang -target-feature -Xclang -fast-11bytenop -Xclang -target-feature -Xclang +fast-15bytenop -Xclang -target-feature -Xclang -fast-7bytenop -Xclang -target-feature -Xclang +fast-bextr -Xclang -target-feature -Xclang -fast-gather -Xclang -target-feature -Xclang -fast-hops -Xclang -target-feature -Xclang +fast-lzcnt -Xclang -target-feature -Xclang +fast-movbe -Xclang -target-feature -Xclang +fast-scalar-fsqrt -Xclang -target-feature -Xclang +fast-scalar-shift-masks -Xclang -target-feature -Xclang -fast-shld-rotate -Xclang -target-feature -Xclang -fast-variable-crosslane-shuffle -Xclang -target-feature -Xclang +fast-variable-perlane-shuffle -Xclang -target-feature -Xclang +fast-vector-fsqrt -Xclang -target-feature -Xclang -fast-vector-shift-masks -Xclang -target-feature -Xclang -faster-shift-than-shuffle -Xclang -target-feature -Xclang +fma -Xclang -target-feature -Xclang -fma4 -Xclang -target-feature -Xclang +fsgsbase -Xclang -target-feature -Xclang +fsrm -Xclang -target-feature -Xclang +fxsr -Xclang -target-feature -Xclang -gfni -Xclang -target-feature -Xclang -harden-sls-ijmp -Xclang -target-feature -Xclang -harden-sls-ret -Xclang -target-feature -Xclang -hreset -Xclang -target-feature -Xclang -idivl-to-divb -Xclang -target-feature -Xclang -idivq-to-divl -Xclang -target-feature -Xclang +invpcid -Xclang -target-feature -Xclang -kl -Xclang -target-feature -Xclang -lea-sp -Xclang -target-feature -Xclang -lea-uses-ag -Xclang -target-feature -Xclang -lvi-cfi -Xclang -target-feature -Xclang -lvi-load-hardening -Xclang -target-feature -Xclang -lwp -Xclang -target-feature -Xclang +lzcnt -Xclang -target-feature -Xclang +macrofusion -Xclang -target-feature -Xclang +mmx -Xclang -target-feature -Xclang +movbe -Xclang -target-feature -Xclang -movdir64b -Xclang -target-feature -Xclang -movdiri -Xclang -target-feature -Xclang +mwaitx -Xclang -target-feature -Xclang -no-bypass-delay -Xclang -target-feature -Xclang -no-bypass-delay-blend -Xclang -target-feature -Xclang -no-bypass-delay-mov -Xclang -target-feature -Xclang -no-bypass-delay-shuffle -Xclang -target-feature -Xclang +nopl -Xclang -target-feature -Xclang -pad-short-functions -Xclang -target-feature -Xclang +pclmul -Xclang -target-feature -Xclang -pconfig -Xclang -target-feature -Xclang +pku -Xclang -target-feature -Xclang +popcnt -Xclang -target-feature -Xclang -prefer-128-bit -Xclang -target-feature -Xclang -prefer-256-bit -Xclang -target-feature -Xclang -prefer-mask-registers -Xclang -target-feature -Xclang -prefer-movmsk-over-vtest -Xclang -target-feature -Xclang -prefetchi -Xclang -target-feature -Xclang -prefetchwt1 -Xclang -target-feature -Xclang +prfchw -Xclang -target-feature -Xclang -ptwrite -Xclang -target-feature -Xclang -raoint -Xclang -target-feature -Xclang +rdpid -Xclang -target-feature -Xclang +rdpru -Xclang -target-feature -Xclang +rdrnd -Xclang -target-feature -Xclang +rdseed -Xclang -target-feature -Xclang -retpoline -Xclang -target-feature -Xclang -retpoline-external-thunk -Xclang -target-feature -Xclang -retpoline-indirect-branches -Xclang -target-feature -Xclang -retpoline-indirect-calls -Xclang -target-feature -Xclang -rtm -Xclang -target-feature -Xclang +sahf -Xclang -target-feature -Xclang +sbb-dep-breaking -Xclang -target-feature -Xclang -serialize -Xclang -target-feature -Xclang -seses -Xclang -target-feature -Xclang -sgx -Xclang -target-feature -Xclang +sha -Xclang -target-feature -Xclang -sha512 -Xclang -target-feature -Xclang +shstk -Xclang -target-feature -Xclang -slow-3ops-lea -Xclang -target-feature -Xclang -slow-incdec -Xclang -target-feature -Xclang -slow-lea -Xclang -target-feature -Xclang -slow-pmaddwd -Xclang -target-feature -Xclang -slow-pmulld -Xclang -target-feature -Xclang +slow-shld -Xclang -target-feature -Xclang -slow-two-mem-ops -Xclang -target-feature -Xclang -slow-unaligned-mem-16 -Xclang -target-feature -Xclang -slow-unaligned-mem-32 -Xclang -target-feature -Xclang -sm3 -Xclang -target-feature -Xclang -sm4 -Xclang -target-feature -Xclang -soft-float -Xclang -target-feature -Xclang +sse -Xclang -target-feature -Xclang +sse2 -Xclang -target-feature -Xclang +sse3 -Xclang -target-feature -Xclang +sse4.1 -Xclang -target-feature -Xclang +sse4.2 -Xclang -target-feature -Xclang +sse4a -Xclang -target-feature -Xclang -sse-unaligned-mem -Xclang -target-feature -Xclang +ssse3 -Xclang -target-feature -Xclang -tagged-globals -Xclang -target-feature -Xclang -tbm -Xclang -target-feature -Xclang -tsxldtrk -Xclang -target-feature -Xclang -tuning-fast-imm-vector-shift -Xclang -target-feature -Xclang -uintr -Xclang -target-feature -Xclang -use-glm-div-sqrt-costs -Xclang -target-feature -Xclang -use-slm-arith-costs -Xclang -target-feature -Xclang +vaes -Xclang -target-feature -Xclang +vpclmulqdq -Xclang -target-feature -Xclang +vzeroupper -Xclang -target-feature -Xclang -waitpkg -Xclang -target-feature -Xclang +wbnoinvd -Xclang -target-feature -Xclang -widekl -Xclang -target-feature -Xclang +x87 -Xclang -target-feature -Xclang -xop -Xclang -target-feature -Xclang +xsave -Xclang -target-feature -Xclang +xsavec -Xclang -target-feature -Xclang +xsaveopt -Xclang -target-feature -Xclang +xsaves -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize=function -mred-zone -fno-omit-frame-pointer -fstack-protector-strong --param ssp-buffer-size=4 -D_DEBUG -O0 -fPIC -funwind-tables -gdwarf-4 -gdwarf32 -MD -MV -MF /home/kll/terastream/acton-deps/bdwgc/zig-cache/tmp/e88f24c71e1464c0-gc.o.d -I /home/kll/terastream/acton-deps/bdwgc/include -D ALL_INTERIOR_POINTERS -D NO_EXECUTE_PERMISSION -Wall -Wextra -Wpedantic -D FOO -D BAR -D GC_BUILTIN_ATOMIC -D GC_THREADS -D _REENTRANT -D PARALLEL_MARK -D THREAD_LOCAL_ALLOC -D HANDLE_FORK -D GC_GCJ_SUPPORT -D GC_ENABLE_SUSPEND_THREAD -D ENABLE_DISCLAIM -D JAVA_FINALIZATION -D GC_ATOMIC_UNCOLLECTABLE -D USE_MMAP -D USE_MUNMAP -D GC_PTHREAD_START_STANDALONE -Wno-frame-address -fno-strict-aliasing -D GC_DLL -D GC_VISIBILITY_HIDDEN_SET -fvisibility=hidden -D HAVE_SYS_TYPES_H -D HAVE_UNISTD_H -D HAVE_DL_ITERATE_PHDR -D HAVE_PTHREAD_SIGMASK -D GC_REQUIRE_WCSDUP -D HAVE_PTHREAD_SETNAME_NP_WITH_TID -D HAVE_DLADDR -c -o /home/kll/terastream/acton-deps/bdwgc/zig-cache/tmp/e88f24c71e1464c0-gc.o --serialize-diagnostics /home/kll/terastream/acton-deps/bdwgc/zig-cache/tmp/e88f24c71e1464c0-gc.o.diag
/home/kll/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/zig clang /home/kll/terastream/acton-deps/bdwgc/pthread_start.c --no-default-config -fno-caret-diagnostics -D__GLIBC_MINOR__=36 -target x86_64-unknown-linux-gnu -nostdinc -fno-spell-checking -isystem /home/kll/kod/zig/zig-linux-x86_64-0.12.0-dev.2105+60094cc3f/lib/include -isystem /usr/include -Xclang -target-cpu -Xclang znver3 -Xclang -target-feature -Xclang -16bit-mode -Xclang -target-feature -Xclang -32bit-mode -Xclang -target-feature -Xclang -3dnow -Xclang -target-feature -Xclang -3dnowa -Xclang -target-feature -Xclang +64bit -Xclang -target-feature -Xclang +adx -Xclang -target-feature -Xclang +aes -Xclang -target-feature -Xclang +allow-light-256-bit -Xclang -target-feature -Xclang -amx-bf16 -Xclang -target-feature -Xclang -amx-complex -Xclang -target-feature -Xclang -amx-fp16 -Xclang -target-feature -Xclang -amx-int8 -Xclang -target-feature -Xclang -amx-tile -Xclang -target-feature -Xclang +avx -Xclang -target-feature -Xclang +avx2 -Xclang -target-feature -Xclang -avx512bf16 -Xclang -target-feature -Xclang -avx512bitalg -Xclang -target-feature -Xclang -avx512bw -Xclang -target-feature -Xclang -avx512cd -Xclang -target-feature -Xclang -avx512dq -Xclang -target-feature -Xclang -avx512er -Xclang -target-feature -Xclang -avx512f -Xclang -target-feature -Xclang -avx512fp16 -Xclang -target-feature -Xclang -avx512ifma -Xclang -target-feature -Xclang -avx512pf -Xclang -target-feature -Xclang -avx512vbmi -Xclang -target-feature -Xclang -avx512vbmi2 -Xclang -target-feature -Xclang -avx512vl -Xclang -target-feature -Xclang -avx512vnni -Xclang -target-feature -Xclang -avx512vp2intersect -Xclang -target-feature -Xclang -avx512vpopcntdq -Xclang -target-feature -Xclang -avxifma -Xclang -target-feature -Xclang -avxneconvert -Xclang -target-feature -Xclang -avxvnni -Xclang -target-feature -Xclang -avxvnniint16 -Xclang -target-feature -Xclang -avxvnniint8 -Xclang -target-feature -Xclang +bmi -Xclang -target-feature -Xclang +bmi2 -Xclang -target-feature -Xclang +branchfusion -Xclang -target-feature -Xclang -cldemote -Xclang -target-feature -Xclang +clflushopt -Xclang -target-feature -Xclang +clwb -Xclang -target-feature -Xclang +clzero -Xclang -target-feature -Xclang +cmov -Xclang -target-feature -Xclang -cmpccxadd -Xclang -target-feature -Xclang +crc32 -Xclang -target-feature -Xclang +cx16 -Xclang -target-feature -Xclang +cx8 -Xclang -target-feature -Xclang -enqcmd -Xclang -target-feature -Xclang -ermsb -Xclang -target-feature -Xclang +f16c -Xclang -target-feature -Xclang -false-deps-getmant -Xclang -target-feature -Xclang -false-deps-lzcnt-tzcnt -Xclang -target-feature -Xclang -false-deps-mulc -Xclang -target-feature -Xclang -false-deps-mullq -Xclang -target-feature -Xclang -false-deps-perm -Xclang -target-feature -Xclang -false-deps-popcnt -Xclang -target-feature -Xclang -false-deps-range -Xclang -target-feature -Xclang -fast-11bytenop -Xclang -target-feature -Xclang +fast-15bytenop -Xclang -target-feature -Xclang -fast-7bytenop -Xclang -target-feature -Xclang +fast-bextr -Xclang -target-feature -Xclang -fast-gather -Xclang -target-feature -Xclang -fast-hops -Xclang -target-feature -Xclang +fast-lzcnt -Xclang -target-feature -Xclang +fast-movbe -Xclang -target-feature -Xclang +fast-scalar-fsqrt -Xclang -target-feature -Xclang +fast-scalar-shift-masks -Xclang -target-feature -Xclang -fast-shld-rotate -Xclang -target-feature -Xclang -fast-variable-crosslane-shuffle -Xclang -target-feature -Xclang +fast-variable-perlane-shuffle -Xclang -target-feature -Xclang +fast-vector-fsqrt -Xclang -target-feature -Xclang -fast-vector-shift-masks -Xclang -target-feature -Xclang -faster-shift-than-shuffle -Xclang -target-feature -Xclang +fma -Xclang -target-feature -Xclang -fma4 -Xclang -target-feature -Xclang +fsgsbase -Xclang -target-feature -Xclang +fsrm -Xclang -target-feature -Xclang +fxsr -Xclang -target-feature -Xclang -gfni -Xclang -target-feature -Xclang -harden-sls-ijmp -Xclang -target-feature -Xclang -harden-sls-ret -Xclang -target-feature -Xclang -hreset -Xclang -target-feature -Xclang -idivl-to-divb -Xclang -target-feature -Xclang -idivq-to-divl -Xclang -target-feature -Xclang +invpcid -Xclang -target-feature -Xclang -kl -Xclang -target-feature -Xclang -lea-sp -Xclang -target-feature -Xclang -lea-uses-ag -Xclang -target-feature -Xclang -lvi-cfi -Xclang -target-feature -Xclang -lvi-load-hardening -Xclang -target-feature -Xclang -lwp -Xclang -target-feature -Xclang +lzcnt -Xclang -target-feature -Xclang +macrofusion -Xclang -target-feature -Xclang +mmx -Xclang -target-feature -Xclang +movbe -Xclang -target-feature -Xclang -movdir64b -Xclang -target-feature -Xclang -movdiri -Xclang -target-feature -Xclang +mwaitx -Xclang -target-feature -Xclang -no-bypass-delay -Xclang -target-feature -Xclang -no-bypass-delay-blend -Xclang -target-feature -Xclang -no-bypass-delay-mov -Xclang -target-feature -Xclang -no-bypass-delay-shuffle -Xclang -target-feature -Xclang +nopl -Xclang -target-feature -Xclang -pad-short-functions -Xclang -target-feature -Xclang +pclmul -Xclang -target-feature -Xclang -pconfig -Xclang -target-feature -Xclang +pku -Xclang -target-feature -Xclang +popcnt -Xclang -target-feature -Xclang -prefer-128-bit -Xclang -target-feature -Xclang -prefer-256-bit -Xclang -target-feature -Xclang -prefer-mask-registers -Xclang -target-feature -Xclang -prefer-movmsk-over-vtest -Xclang -target-feature -Xclang -prefetchi -Xclang -target-feature -Xclang -prefetchwt1 -Xclang -target-feature -Xclang +prfchw -Xclang -target-feature -Xclang -ptwrite -Xclang -target-feature -Xclang -raoint -Xclang -target-feature -Xclang +rdpid -Xclang -target-feature -Xclang +rdpru -Xclang -target-feature -Xclang +rdrnd -Xclang -target-feature -Xclang +rdseed -Xclang -target-feature -Xclang -retpoline -Xclang -target-feature -Xclang -retpoline-external-thunk -Xclang -target-feature -Xclang -retpoline-indirect-branches -Xclang -target-feature -Xclang -retpoline-indirect-calls -Xclang -target-feature -Xclang -rtm -Xclang -target-feature -Xclang +sahf -Xclang -target-feature -Xclang +sbb-dep-breaking -Xclang -target-feature -Xclang -serialize -Xclang -target-feature -Xclang -seses -Xclang -target-feature -Xclang -sgx -Xclang -target-feature -Xclang +sha -Xclang -target-feature -Xclang -sha512 -Xclang -target-feature -Xclang +shstk -Xclang -target-feature -Xclang -slow-3ops-lea -Xclang -target-feature -Xclang -slow-incdec -Xclang -target-feature -Xclang -slow-lea -Xclang -target-feature -Xclang -slow-pmaddwd -Xclang -target-feature -Xclang -slow-pmulld -Xclang -target-feature -Xclang +slow-shld -Xclang -target-feature -Xclang -slow-two-mem-ops -Xclang -target-feature -Xclang -slow-unaligned-mem-16 -Xclang -target-feature -Xclang -slow-unaligned-mem-32 -Xclang -target-feature -Xclang -sm3 -Xclang -target-feature -Xclang -sm4 -Xclang -target-feature -Xclang -soft-float -Xclang -target-feature -Xclang +sse -Xclang -target-feature -Xclang +sse2 -Xclang -target-feature -Xclang +sse3 -Xclang -target-feature -Xclang +sse4.1 -Xclang -target-feature -Xclang +sse4.2 -Xclang -target-feature -Xclang +sse4a -Xclang -target-feature -Xclang -sse-unaligned-mem -Xclang -target-feature -Xclang +ssse3 -Xclang -target-feature -Xclang -tagged-globals -Xclang -target-feature -Xclang -tbm -Xclang -target-feature -Xclang -tsxldtrk -Xclang -target-feature -Xclang -tuning-fast-imm-vector-shift -Xclang -target-feature -Xclang -uintr -Xclang -target-feature -Xclang -use-glm-div-sqrt-costs -Xclang -target-feature -Xclang -use-slm-arith-costs -Xclang -target-feature -Xclang +vaes -Xclang -target-feature -Xclang +vpclmulqdq -Xclang -target-feature -Xclang +vzeroupper -Xclang -target-feature -Xclang -waitpkg -Xclang -target-feature -Xclang +wbnoinvd -Xclang -target-feature -Xclang -widekl -Xclang -target-feature -Xclang +x87 -Xclang -target-feature -Xclang -xop -Xclang -target-feature -Xclang +xsave -Xclang -target-feature -Xclang +xsavec -Xclang -target-feature -Xclang +xsaveopt -Xclang -target-feature -Xclang +xsaves -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize=function -mred-zone -fno-omit-frame-pointer -fstack-protector-strong --param ssp-buffer-size=4 -D_DEBUG -O0 -fPIC -funwind-tables -gdwarf-4 -gdwarf32 -MD -MV -MF /home/kll/terastream/acton-deps/bdwgc/zig-cache/tmp/3596df21b5417c30-pthread_start.o.d -I /home/kll/terastream/acton-deps/bdwgc/include -D ALL_INTERIOR_POINTERS -D NO_EXECUTE_PERMISSION -Wall -Wextra -Wpedantic -D FOO -D BAR -D GC_BUILTIN_ATOMIC -D GC_THREADS -D _REENTRANT -D PARALLEL_MARK -D THREAD_LOCAL_ALLOC -D HANDLE_FORK -D GC_GCJ_SUPPORT -D GC_ENABLE_SUSPEND_THREAD -D ENABLE_DISCLAIM -D JAVA_FINALIZATION -D GC_ATOMIC_UNCOLLECTABLE -D USE_MMAP -D USE_MUNMAP -D GC_PTHREAD_START_STANDALONE -Wno-frame-address -fno-strict-aliasing -D GC_DLL -D GC_VISIBILITY_HIDDEN_SET -fvisibility=hidden -D HAVE_SYS_TYPES_H -D HAVE_UNISTD_H -D HAVE_DL_ITERATE_PHDR -D HAVE_PTHREAD_SIGMASK -D GC_REQUIRE_WCSDUP -D HAVE_PTHREAD_SETNAME_NP_WITH_TID -D HAVE_DLADDR -c -o /home/kll/terastream/acton-deps/bdwgc/zig-cache/tmp/3596df21b5417c30-pthread_start.o --serialize-diagnostics /home/kll/terastream/acton-deps/bdwgc/zig-cache/tmp/3596df21b5417c30-pthread_start.o.diag

kll@Boxy:~/terastream/acton-deps/bdwgc$ 

@ivmai
Copy link
Owner

ivmai commented Jan 10, 2024

hmm, actually, are you sure?
both -D FOO and -D BAR makes it onto the command arguments that are passed on to zig build-lib

Please check it on gctest.c. (I mean -DCFLAGS_EXTRA="-D NO_TEST_HANDLE_FORK -D GC_DISABLE_INCREMENTAL" should affect gctest output, but the 2nd option in the list does not seem to have the effect unless I reorder them or remove 1st one. I tested on Linux.)

This passes through extra options to the compiler. No validation is
performed, the values are split on space and passed in as separate
flags.
@plajjan
Copy link
Contributor Author

plajjan commented Jan 10, 2024

Ok, I see what you mean @ivmai. I am getting the same result, yet the --verbose output does say the flags are passed. I guess the way it prints them to me and the way they are actually paseed somehow differs.

@plajjan
Copy link
Contributor Author

plajjan commented Jan 10, 2024

@ivmai simply splitting it up in parts and appending each to the flags works. I just pushed an update.

ivmai pushed a commit that referenced this pull request Jan 11, 2024
PR #607 (bdwgc).

This passes through extra options (flags) to the C compiler.
No flags validation is performed; the values given in CFLAGS_EXTRA are
split on a space and append to compiler flags one by one.

* build.zig (cflags_extra): New option (an empty string by default).
* build.zig (flags): Append space-separated flags from cflags_extra
(after all other flags are appended); remove relevant TODO item.
@ivmai
Copy link
Owner

ivmai commented Jan 11, 2024

Merged as 70c9e87

@ivmai ivmai closed this Jan 11, 2024
@plajjan plajjan deleted the zig-cflags-extra branch January 11, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants