Skip to content

newt/build: Workaround for whole-archive flag #598

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

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

Conversation

m-gorecki
Copy link
Contributor

Flag whole-archive is not supported on Mac and it was causing CI failures. Now instead of using this flag with .a file we just pass a text file with list of all object files from package to the linker. So now it looks like this:
@pkg.list
instead of:
--whole-archive pkg.a --no-whole-archive

Passing list of object files will result in pulling unreferenced object code just like in case of whole-archive flag and should work with all compilers.

@kasjer kasjer requested a review from andrzej-kaczmarek June 6, 2025 19:20
@kasjer
Copy link
Contributor

kasjer commented Jun 6, 2025

This seems to work for arm builds and pic32 (except for Windows). Mac not tested by me.

kasjer
kasjer previously approved these changes Jun 6, 2025
Copy link
Contributor

@kasjer kasjer left a comment

Choose a reason for hiding this comment

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

Code not inspected, just tested to verify that it works

Copy link
Contributor

@kasjer kasjer left a comment

Choose a reason for hiding this comment

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

It looks like behavior change.
pkg.whole_archive at application level turns on new behavior for all packages, before it was more selective

@kasjer kasjer dismissed their stale review June 7, 2025 08:06

behavior changed

Flag whole-archive is not supported on Mac and it was causing
CI failures. Now instead of using this flag with .a file
we just pass a text file with list of all object files from package
to the linker. So now it looks like this:
@pkg.list
instead of:
--whole-archive pkg.a --no-whole-archive

Passing list of object files will result in pulling unreferenced
object code just like in case of whole-archive flag and
should work with all compilers.
Copy link
Contributor

@kasjer kasjer left a comment

Choose a reason for hiding this comment

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

Works as expected

Comment on lines +1393 to +1396
// the file with list of all paths to object files
// from the library will be created, which later
// can be passed with @ to the linker.
func (c *Compiler) CompileArchive(outputFile string, createList bool) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe space should be use here

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.

2 participants