-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Run libtool without symlinking if possible #11958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0fda2cb
Faster libtool
michaeleisel abd48e2
Merge remote-tracking branch 'u/master' into me-faster-libtool
michaeleisel ef6c5e8
Faster libtool
michaeleisel fad384c
Faster libtool
michaeleisel f790ad3
pr responses
michaeleisel 41b78a7
Faster libtool
michaeleisel c688997
Faster libtool
michaeleisel ad7a281
Faster libtool
michaeleisel a1ff612
Merge remote-tracking branch 'u/master' into me-faster-libtool
michaeleisel ad7a8bd
Faster libtool
michaeleisel a6237ca
Faster libtool
michaeleisel c1a21b8
Faster libtool
michaeleisel 350c682
Faster libtool
michaeleisel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,71 @@ | ||
| // Copyright 2020 The Bazel Authors. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include <iostream> | ||
| #include <regex> | ||
| #include <fstream> | ||
| #include <unordered_set> | ||
|
|
||
| using namespace std; | ||
|
|
||
| string getBasename(const string &path) { | ||
| // Assumes we're on an OS with "/" as the path separator | ||
| auto idx = path.find_last_of("/"); | ||
michaeleisel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (idx == string::npos) { | ||
| return path; | ||
| } | ||
| return path.substr(idx + 1); | ||
| } | ||
|
|
||
| // Returns 0 if there are no duplicate basenames in the object files (both via -filelist as well as shell args), | ||
| // 1 otherwise | ||
| int main(int argc, const char * argv[]) { | ||
| unordered_set<string> basenames; | ||
| const regex libRegex = regex(".*\\.a$"); | ||
| const regex noArgFlags = regex("-static|-s|-a|-c|-L|-T|-D|-no_warning_for_no_symbols"); | ||
| const regex singleArgFlags = regex("-arch_only|-syslibroot|-o"); | ||
| // Set i to 1 to skip executable path | ||
| for (int i = 1; argv[i] != nullptr; i++) { | ||
| string arg = argv[i]; | ||
| if (arg == "-filelist") { | ||
| ifstream list(argv[i + 1]); | ||
| for (string line; getline(list, line); ) { | ||
| const string basename = getBasename(line); | ||
| const auto pair = basenames.insert(basename); | ||
| if (!pair.second) { | ||
| return 1; | ||
| } | ||
| } | ||
| list.close(); | ||
| i++; | ||
| } else if (regex_match(arg, noArgFlags)) { | ||
| // No arg flags | ||
| } else if (regex_match(arg, singleArgFlags)) { | ||
| // Single-arg flags | ||
| i++; | ||
| } else if (arg[0] == '-') { | ||
| return 1; | ||
| // Unrecognized flag, let the wrapper deal with it | ||
| } else if (regex_match(arg, libRegex)) { | ||
| // Archive inputs can remain untouched, as they come from other targets. | ||
| } else { | ||
| const string basename = getBasename(arg); | ||
| const auto pair = basenames.insert(basename); | ||
| if (!pair.second) { | ||
| return 1; | ||
| } | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.