Skip to content
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

dedup linked libs #12276

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

bruchar1
Copy link
Member

Ensure -L order is preserved. This results in a 10% smaller build.ninja file on my project.

Ensure -L order is preserved. This results in a 10% smaller build.ninja file on my project.
@bruchar1 bruchar1 marked this pull request as ready for review September 20, 2023 18:23
@tristan957 tristan957 added this to the 1.3.0 milestone Sep 29, 2023
@@ -267,12 +269,15 @@ def extend_preserving_lflags(self, iterable: T.Iterable[str]) -> None:
normal_flags = []
lflags = []
for i in iterable:
if i not in self.always_dedup_args and (i.startswith('-l') or i.startswith('-L')):
if i not in self.always_dedup_args and (i.startswith('-l') or i.startswith('-L')) and i not in self._libs:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm never sure about -lfoo order, shouldn't we keep last occurrence instead of first?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not sure myself. Probably it should keep the last occurence, because as libs are visited, symbols to be linked are accumulated. But in that case, -L order may become wrong... And there may be linkers that requires to have some libs duplicated for static linking, in case of circular references.

@bruchar1 bruchar1 marked this pull request as draft September 29, 2023 17:13
@tristan957 tristan957 removed this from the 1.3.0 milestone Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants