b73d167c6c
Bazel has a special command line option (--compilation_mode) for specifying how c artifacts should be compiled. Copy over the implementation without too much thought on whether they make sense. See https://docs.bazel.build/versions/main/user-manual.html#flag--compilation_mode. !!! Due to a regression in zig-cc, debug symbols are available under --compilation_mode opt ``` laurynasl@laurynasl ~/bazel-zig-cc % bazel build -c opt //test/c:which_libc 2>/dev/null && bazel-bin/test/c/which_libc && gdb -batch --ex 'info line main' bazel-bin/test/c/which_libc glibc_2.19 Line 4 of "test/c/main.c" starts at address 0x2014f0 <main> and ends at 0x2014f1 <main+1>. laurynasl@laurynasl ~/bazel-zig-cc % bazel build -c dbg //test/c:which_libc 2>/dev/null && bazel-bin/test/c/which_libc && gdb -batch --ex 'info line main' bazel-bin/test/c/which_libc glibc_2.19 Line 4 of "test/c/main.c" starts at address 0x201500 <main> and ends at 0x201504 <main+4>. laurynasl@laurynasl ~/bazel-zig-cc % bazel build -c fastbuild //test/c:which_libc 2>/dev/null && bazel-bin/test/c/which_libc && gdb -batch --ex 'info line main' bazel-bin/test/c/which_libc glibc_2.19 Function "main" not defined. ``` |
||
---|---|---|
.. | ||
libc | ||
libc_aware | ||
platform | ||
private | ||
toolchain | ||
BUILD | ||
BUILD.sdk.bazel | ||
defs.bzl | ||
zig_toolchain.bzl |