Skip to content

digging into static linking of Git - #67

Merged
shiftkey merged 1 commit into
masterfrom
investigate-static-linking
Dec 17, 2017
Merged

shiftkey merged 1 commit into
masterfrom
investigate-static-linking

Conversation

@shiftkey

Copy link
Copy Markdown
Member

Playing around with Ermine locally, and these changes help to identify what needed to be statically linked, as well as the difference in the resulting archive...

@shiftkey

Copy link
Copy Markdown
Member Author

This change means that we can now poke at all of the known binaries output by Git to see the dynamic section of the ELF binary and list it's shared libraries:

File: ./git-remote-http
 0x0000000000000001 (NEEDED)             Shared library: [libcurl-gnutls.so.4]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

Locally, I can see here that Ermine does it's thing:

File: ./git-remote-http
Before:
 0x0000000000000001 (NEEDED)             Shared library: [libcurl-gnutls.so.4]
 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
After:

There is no dynamic section in this file.

Because it's a trial version of Ermine, it embeds a message in any binary it generates:

$ ./build/git/bin/git --version
git: was packed with Ermine Trial and should be used for evaluation only.
git: license will expire in 31 day(s)
git version 2.15.1

The obvious downside here is around the package size. Here's the summary:

Default Static Enabled
Archive 13 MB 44 MB
On-disk (extracted) 28 MB 105 MB

@shiftkey shiftkey changed the title [WIP] digging into static linking of Git digging into static linking of Git Dec 17, 2017
@shiftkey
shiftkey merged commit 251e618 into master Dec 17, 2017
@shiftkey
shiftkey deleted the investigate-static-linking branch December 17, 2017 07:31
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.

1 participant