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 support for --whole-archive #272

Open
davidlattimore opened this issue Jan 4, 2025 · 0 comments
Open

Add support for --whole-archive #272

davidlattimore opened this issue Jan 4, 2025 · 0 comments
Labels
good first issue Good for newcomers

Comments

@davidlattimore
Copy link
Owner

See man ld for a description of what --whole-archive needs to do.

--whole-archive is a modifier that is pushed / popped by --push-state / --pop-state, so the value of the flag should be added to the Modifiers struct (in args.rs).

The method where the whole_archive attribute should be used is ParsedInputObject::is_optional.

It'd be good to have a test that verifies that --whole-archive is behaving as expected. There are probably a few ways such a test could be written. The key observation is that whatever is defined in the archive needs to not be directly referenced from the main test object, otherwise the archived object would be included even without --whole-archive. One option is to have an archive that puts something into a custom section, then have the _start_ function check the custom section for that value. You can look at the test custom_section.c for how this is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant