Commit 5eff703
Expose cc_binary.link_extra_lib label
Recently Bazel introduced support for C++ binaries linking against
//tools/cpp:link_extra_lib which typically just depends on the label flag
//tools/cpp:link_extra_libs.
For normal C++ binaries this is the intended behaviour. However, certain
special C++ binaries really do not want to be linked against any other targets
for a variety of reasons: conflicting dependencies, pure C binaries that should
not pull in C++ runtime libraries, or other very low level binaries that want
to remain untouched.
Our experience building many thousands of C++ targets shows that there are few
cases where opting out linking of extra libraries always makes sense. To
provide this flexibility, expose cc_binary.link_extra_lib, which can be set to
an empty library such as @bazel_tools//tools/cpp:empty_lib.
PiperOrigin-RevId: 548117556
Change-Id: Iaaa35ec9115031bfaa124ca2441aafe8231458991 parent 3c7d571 commit 5eff703
File tree
11 files changed
+85
-8
lines changed- src
- main
- java/com/google/devtools/build/lib/bazel/rules/cpp
- starlark/builtins_bzl/common/cc
- test
- java/com/google/devtools/build/lib
- packages/util
- query2/testutil
- rules/cpp
- skyframe/rewinding
- shell/integration
11 files changed
+85
-8
lines changedLines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
538 | 555 | | |
539 | 556 | | |
540 | 557 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | | - | |
587 | | - | |
| 586 | + | |
| 587 | + | |
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1023 | 1023 | | |
1024 | 1024 | | |
1025 | 1025 | | |
1026 | | - | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
1027 | 1033 | | |
1028 | 1034 | | |
1029 | 1035 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| 206 | + | |
203 | 207 | | |
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
207 | 211 | | |
208 | 212 | | |
209 | 213 | | |
| 214 | + | |
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
| |||
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1275 | 1275 | | |
1276 | 1276 | | |
1277 | 1277 | | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
1278 | 1304 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2142 | 2142 | | |
2143 | 2143 | | |
2144 | 2144 | | |
| 2145 | + | |
2145 | 2146 | | |
2146 | 2147 | | |
2147 | 2148 | | |
2148 | 2149 | | |
| 2150 | + | |
2149 | 2151 | | |
2150 | 2152 | | |
2151 | 2153 | | |
| |||
2225 | 2227 | | |
2226 | 2228 | | |
2227 | 2229 | | |
| 2230 | + | |
2228 | 2231 | | |
2229 | 2232 | | |
2230 | 2233 | | |
2231 | 2234 | | |
2232 | 2235 | | |
| 2236 | + | |
2233 | 2237 | | |
2234 | 2238 | | |
2235 | 2239 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2106 | 2106 | | |
2107 | 2107 | | |
2108 | 2108 | | |
| 2109 | + | |
| 2110 | + | |
2109 | 2111 | | |
2110 | 2112 | | |
2111 | 2113 | | |
| |||
2170 | 2172 | | |
2171 | 2173 | | |
2172 | 2174 | | |
| 2175 | + | |
| 2176 | + | |
2173 | 2177 | | |
2174 | 2178 | | |
2175 | 2179 | | |
| |||
2263 | 2267 | | |
2264 | 2268 | | |
2265 | 2269 | | |
| 2270 | + | |
| 2271 | + | |
2266 | 2272 | | |
2267 | 2273 | | |
2268 | 2274 | | |
| |||
2332 | 2338 | | |
2333 | 2339 | | |
2334 | 2340 | | |
| 2341 | + | |
| 2342 | + | |
2335 | 2343 | | |
2336 | 2344 | | |
2337 | 2345 | | |
| |||
0 commit comments