Skip to content

[gn] Use exec_script_allowlist in //llvm/utils/gn/.gn #134172

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

Merged
merged 6 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/utils/gn/.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
buildconfig = "//llvm/utils/gn/build/BUILDCONFIG.gn"

# Disallow all calls to exec_script. We should be very conservative about
# whitelisting things here.
exec_script_whitelist = []
# allowing things here.
exec_script_allowlist = []

# Execute action() targets using Python 3.
script_executable = "python3"
Expand Down
17 changes: 0 additions & 17 deletions llvm/utils/gn/build/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,6 @@ template("unix_toolchain") {
default_output_dir = "{{root_out_dir}}/lib"
}

if (current_os == "ios" || current_os == "mac") {
# gn < 1693 (e214b5d35898) doesn't support |frameworks|, requiring
# frameworks to be listed in |libs|, but gn >= 1808 (3028c6a426a4) forbids
# frameworks from appearing in |libs|. This assertion provides a helpful
# cue to upgrade, and is much more user-friendly than the failure that
# occurs when an older gn encounters |frameworks|.
#
# gn_version doesn’t actually exist in gn < 1709 (52cb644a3fb4), and
# defined(gn_version) doesn't actually work as expected
# (https://crbug.com/gn/183), so 1709 is the true minimum enforced by
# this construct, and if gn_version is not available, this line will still
# be blamed, making the resolution somewhat discoverable.
assert(gn_version >= 1693,
"Your GN is too old! " +
"Update it, perhaps by running llvm/utils/gn/get.py")
}

# Make these apply to all tools below.
lib_switch = "-l"
lib_dir_switch = "-L"
Expand Down
5 changes: 5 additions & 0 deletions llvm/utils/gn/secondary/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
import("//llvm/utils/gn/build/toolchain/compiler.gni")

# `exec_script_allowlist` was added in GN version 2207, so that's the minimum
# version of GN we require.
assert(gn_version >= 2207,
"Your GN is too old! Update it, perhaps by running llvm/utils/gn/get.py")

group("default") {
deps = [
"//clang-tools-extra/clangd/test",
Expand Down