Add //cc/libc config settings for C standard libraries - #792
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
915bb8b to
82e1195
Compare
Adds a libc_flag rule that exposes the current CC toolchain's target_libc value to select() via config settings for common C standard libraries in //cc/libc, mirroring //cc/compiler. Version suffixes in the "glibc-2.2.2" format documented for cc_common.create_cc_toolchain_config_info are ignored when matching.
keith
left a comment
There was a problem hiding this comment.
i really like replacing local with unknown. i kinda think we should do that for other cases too in later PRs
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
| host_system_name = "local" if is_bsd else "armeabi-v7a" | ||
| target_system_name = "local" if is_bsd else "armeabi-v7a" | ||
| target_libc = "local" if is_bsd else "armeabi-v7a" | ||
| target_libc = cpu if is_bsd else "unknown" |
There was a problem hiding this comment.
I don't understand this--why would the libc be the cpu for bsd?
There was a problem hiding this comment.
See line 59/60, cpu is set to the particular OS flavor, which is also the name of the libc. Yes, that also doesn't make much sense, but I didn't want to touch cpu as well :-)
Co-authored-by: Keith Smiley <keithbsmiley@gmail.com>
Adds a new
//cc/libcpackage withconfig_settings for common C standard libraries, fed by a newlibc_flagrule that exposes the current CC toolchain'starget_libcvalue toselect(). This mirrors the existing//cc/compilerpackage for compilers.Covered libcs:
glibc,musl,uclibc,bionic,macosx(Apple's libSystem, using the historical value set by toolchains for all Apple platforms),freebsd,netbsd,openbsd,msvcrt,ucrt,msys,newlib,picolibc,llvm-libc, andwasi-libc. Toolchains not shipped with Bazel are encouraged to use the same canonical names.Since Bazel documents
target_libcas "the libc version string (e.g.glibc-2.2.2)",libc_flagstrips a version suffix (everything from the first-followed by a digit) before matching, so versioned values still match their family's setting while names likewasi-libcandllvm-libcare preserved.The following changes make the new constraints usable:
-dumpmachinetarget_libcvalues emitted by the bundled Windows and BSD toolchain configs are changed to the correct valuescc_toolchains can declare theirtarget_libcor fall back to a reasonable default