@@ -195,6 +195,7 @@ class SectionPattern {
195195
196196class InputSectionDescription : public SectionCommand {
197197 SingleStringMatcher filePat;
198+ SmallString<0 > implicitArchiveWildcardPat;
198199
199200 // Cache of the most recent input argument and result of matchesFile().
200201 mutable std::optional<std::pair<const InputFile *, bool >> matchesFileCache;
@@ -203,9 +204,19 @@ class InputSectionDescription : public SectionCommand {
203204 InputSectionDescription (StringRef filePattern, uint64_t withFlags = 0 ,
204205 uint64_t withoutFlags = 0 , StringRef classRef = {})
205206 : SectionCommand(InputSectionKind), filePat(filePattern),
206- classRef (classRef), withFlags(withFlags), withoutFlags(withoutFlags) {
207+ implicitArchiveWildcardPat (), classRef(classRef), withFlags(withFlags),
208+ withoutFlags(withoutFlags) {
207209 assert ((filePattern.empty () || classRef.empty ()) &&
208210 " file pattern and class reference are mutually exclusive" );
211+
212+ // Fixes up the input file pattern, adding an implicit wildcard
213+ // if the trailing character is an ':' to allow matching entire archives
214+ if (!filePattern.empty () && filePattern.back () == ' :' ) {
215+ implicitArchiveWildcardPat.reserve (filePattern.size () + 1 );
216+ implicitArchiveWildcardPat.append (filePattern);
217+ implicitArchiveWildcardPat.push_back (' *' );
218+ filePat = SingleStringMatcher (implicitArchiveWildcardPat);
219+ }
209220 }
210221
211222 static bool classof (const SectionCommand *c) {
0 commit comments