Skip to content

Commit 12fdf04

Browse files
authored
[clang][Darwin] Handle reexported library arguments in driver (#86980)
`-reexport*` is the newer spelling for `-sub-library` which is already supported by the clang driver when invoking ld. Support the new spellings when passed by the user. This also helps simplify `clang-installapi` driver logic.
1 parent ddc9892 commit 12fdf04

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3635,6 +3635,9 @@ defm preserve_as_comments : BoolFOption<"preserve-as-comments",
36353635
"Do not preserve comments in inline assembly">,
36363636
PosFlag<SetTrue>>;
36373637
def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;
3638+
def reexport_framework : Separate<["-"], "reexport_framework">, Flags<[LinkerInput]>;
3639+
def reexport_l : Joined<["-"], "reexport-l">, Flags<[LinkerInput]>;
3640+
def reexport_library : JoinedOrSeparate<["-"], "reexport_library">, Flags<[LinkerInput]>;
36383641
def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, Group<clang_ignored_f_Group>;
36393642
def freg_struct_return : Flag<["-"], "freg-struct-return">, Group<f_Group>,
36403643
Visibility<[ClangOption, CC1Option]>,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: touch %t.o
2+
// RUN: %clang -target arm64-apple-darwin13 -### \
3+
// RUN: -reexport_framework Foo -reexport-lBar -reexport_library Baz %t.o 2> %t.log
4+
5+
// Check older spellings also work.
6+
// RUN: %clang -target arm64-apple-darwin13 -### \
7+
// RUN: -Xlinker -reexport_framework -Xlinker Forest \
8+
// RUN: -Xlinker -reexport-lBranch \
9+
// RUN: -Xlinker -reexport_library -Xlinker Flower %t.o 2>> %t.log
10+
// RUN: FileCheck -check-prefix=LINK_REEXPORT %s < %t.log
11+
12+
// LINK_REEXPORT: {{ld(.exe)?"}}
13+
// LINK_REEXPORT: "-reexport_framework" "Foo"
14+
// LINK_REEXPORT: "-reexport-lBar"
15+
// LINK_REEXPORT: "-reexport_library" "Baz"
16+
// LINK_REEXPORT: "-reexport_framework" "Forest"
17+
// LINK_REEXPORT: "-reexport-lBranch"
18+
// LINK_REEXPORT: "-reexport_library" "Flower"
19+
20+
// Make sure arguments are not repeated.
21+
// LINK_REEXPORT-NOT: "-reexport

0 commit comments

Comments
 (0)