-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement force_pic_flags as cc_args
BEGIN_PUBLIC Implement force_pic_flags as cc_args Implements the force_pic_flags feature as cc_args rules. END_PUBLIC PiperOrigin-RevId: 671764316 Change-Id: I7f04bbf46027007fc47d230d49d3334b1a6ddfac
- Loading branch information
1 parent
cf6ccb9
commit 98ab833
Showing
6 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
load("//cc/toolchains:args.bzl", "cc_args") | ||
|
||
package(default_visibility = ["//visibility:private"]) | ||
|
||
cc_args( | ||
name = "force_pic_flags", | ||
actions = [ | ||
"//cc/toolchains/actions:cpp_link_executable", | ||
"//cc/toolchains/actions:lto_index_for_executable", | ||
], | ||
args = select({ | ||
"@platforms//os:macos": ["-Wl,-pie"], | ||
"//conditions:default": ["-pie"], | ||
}), | ||
requires_not_none = "//cc/toolchains/variables:force_pic", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/force_pic_flags.textproto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enabled: false | ||
flag_sets { | ||
actions: "c++-link-executable" | ||
actions: "lto-index-for-executable" | ||
flag_groups { | ||
expand_if_available: "force_pic" | ||
flags: "-Wl,-pie" | ||
} | ||
} | ||
name: "force_pic_flags_test" |
10 changes: 10 additions & 0 deletions
10
tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/force_pic_flags.textproto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enabled: false | ||
flag_sets { | ||
actions: "c++-link-executable" | ||
actions: "lto-index-for-executable" | ||
flag_groups { | ||
expand_if_available: "force_pic" | ||
flags: "-pie" | ||
} | ||
} | ||
name: "force_pic_flags_test" |