fix(autopack): ensure shared library with interpret section is detected as AutopackKind::SharedLibrary#125
Open
fix(autopack): ensure shared library with interpret section is detected as AutopackKind::SharedLibrary#125
AutopackKind::SharedLibrary#125Conversation
…ed as `AutopackKind::SharedLibrary` Signed-off-by: Jérémy Audiger <jeremy.audiger@icloud.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This bug has been detected with brioche-dev/brioche-packages#3705.
Some shared libraries embed a
.interpsection so they can be executed directly as standalone binaries (for example./libcap.so --summaryprints version info). The autopack classifier checked for an interpreter before checkingis_libflag, so suchlibraries were classified as DynamicBinary. The DynamicBinary packing path replaces the entire file with a copy of the brioche-packed runner (an
ET_EXECexecutable), destroying the originalET_DYNshared library on disk. It has two consequences with this classification:ld.gold: error: unsupported ELF file type 2, becauseld.goldrefuses to use an ET_EXEC file as a shared library input which is correct.This bug was hidden and only exposed by the
gitCheckoutchange that strips.gitdirectories by default. The libcap Makefile uses a .git presence check to decide how programs are linked:With
.gitpresent (current behavior), DYNAMIC=no and programs linked statically against libcap.a, never touching the packed .so. With.gitremoved (PR brioche-dev/brioche-packages#3705), DYNAMIC=yes and programs tried to link dynamically against libcap.so, which had been silently replaced by theET_EXECpacked runner.This PR just inverts the two if statements detecting the
AutopackKind.