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

Add --whole-archive #452

Merged
merged 1 commit into from
Feb 20, 2025
Merged

Conversation

riverbl
Copy link
Contributor

@riverbl riverbl commented Feb 20, 2025

Closes #272.

I was getting some funny behaviour where the added test would pass but the option wouldn't work when actually using the linker, but I'm no longer seeing this after rebasing onto latest main.

Copy link
Owner

@davidlattimore davidlattimore left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -133,7 +133,8 @@ impl<'data> ParsedInputObject<'data> {
/// it defines. This is true for archive entries and shared objects for which --as-needed is
/// true.
pub(crate) fn is_optional(&self) -> bool {
self.input.entry.is_some() || (self.is_dynamic() && self.modifiers.as_needed)
!self.modifiers.whole_archive
&& (self.input.entry.is_some() || (self.is_dynamic() && self.modifiers.as_needed))
Copy link
Owner

Choose a reason for hiding this comment

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

It looks like the parentheses might be in the wrong spot. The --whole-archive flag shouldn't affect shared objects, but it looks like setting --whole-archive here will cause shared objects to become non-optional even if they're --as-needed.

@davidlattimore davidlattimore merged commit dda1c22 into davidlattimore:main Feb 20, 2025
12 checks passed
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.

Add support for --whole-archive
3 participants