Skip to content

Commit 4928295

Browse files
jincopybara-github
authored andcommitted
Allow .S files in C++ Starlark cc_common.compile.
.S files are (typically handwritten) assembly files that require preprocessing, compared to their lower-capital .s counterparts that can be compiled directly into object files. Native cc_library rules already allow .S files in srcs [1]. However, the Starlark cc_common.compile srcs argument doesn't accept them. This change adds .S files to the list of valid srcs for cc_common.compile. This is required for building AOSP, as there are handwritten source files in Android's libc with the .S extension [2] that will be compiled through Starlark C++ rules, e.g. directly into .o files. [1] https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCppRuleClasses.java;l=280;drc=35de1e352459729f95d552b6ae5af9ce7d00a943 [2] https://cs.android.com/search?q=f:%5C.S$&sq= Closes #13155. PiperOrigin-RevId: 361106705
1 parent 2adf7d1 commit 4928295

File tree

1 file changed

+7
-2
lines changed
  • src/main/java/com/google/devtools/build/lib/rules/cpp

1 file changed

+7
-2
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,8 +1979,13 @@ protected Tuple compile(
19791979
validateExtensions(
19801980
"srcs",
19811981
sources,
1982-
CppFileTypes.ALL_C_CLASS_SOURCE.including(CppFileTypes.ASSEMBLER),
1983-
FileTypeSet.of(CppFileTypes.CPP_SOURCE, CppFileTypes.C_SOURCE, CppFileTypes.ASSEMBLER));
1982+
CppFileTypes.ALL_C_CLASS_SOURCE.including(
1983+
CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR, CppFileTypes.ASSEMBLER),
1984+
FileTypeSet.of(
1985+
CppFileTypes.CPP_SOURCE,
1986+
CppFileTypes.C_SOURCE,
1987+
CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR,
1988+
CppFileTypes.ASSEMBLER));
19841989
validateExtensions(
19851990
"public_hdrs",
19861991
publicHeaders,

0 commit comments

Comments
 (0)