Content-Length: 288565 | pFad | http://github.com/libgit2/libgit2/pull/7112

05 Don't export API symbols on static build by HenriquedoVal · Pull Request #7112 · libgit2/libgit2 · GitHub
Skip to content

Don't export API symbols on static build#7112

Open
HenriquedoVal wants to merge 2 commits into
libgit2:mainfrom
HenriquedoVal:dont-export-symbols-on-static-build
Open

Don't export API symbols on static build#7112
HenriquedoVal wants to merge 2 commits into
libgit2:mainfrom
HenriquedoVal:dont-export-symbols-on-static-build

Conversation

@HenriquedoVal
Copy link
Copy Markdown

When linking to a static library that contains symbols with __declspec(dllexport), all these symbols will be part of the final executable, even if they are not needed. Maybe this is not the intended behavior. Although both ELF and PE (at least) can do this, most people don't load symbols of an executable, AFAIK.

Before:

Get-Item .\util_tests.exe | % { "Size of $($_.Name): $($_.Length / 1kb)kb" }
Size of util_tests.exe: 2594kb

❯ dumpbin -nologo -exports .\util_tests.exe

Dump of file .\util_tests.exe

File Type: EXECUTABLE IMAGE

  Section contains the following exports for util_tests.exe

    00000000 characteristics
    FFFFFFFF time date stamp
        0.00 version
           1 ordinal base
         956 number of functions
         956 number of names

    ordinal hint RVA      name

          1    0 0001E0F0 git_annotated_commit_free
          2    1 0001DF70 git_annotated_commit_from_fetchhead
          3    2 0001DC80 git_annotated_commit_from_ref
          .
          .
          956  3BB 000036F0 giterr_set_str

  Summary

        D000 .data
       15000 .pdata
       94000 .rdata
        2000 .reloc
        1000 .rsrc
      1D8000 .text
        1000 _RDATA

After:

Get-Item .\util_tests.exe | % { "Size of $($_.Name): $($_.Length / 1kb)kb" }
Size of util_tests.exe: 1705.5kb

❯ dumpbin -nologo -exports .\util_tests.exe

Dump of file .\util_tests.exe

File Type: EXECUTABLE IMAGE

  Summary

        D000 .data
        C000 .pdata
       77000 .rdata
        2000 .reloc
        1000 .rsrc
      122000 .text
        1000 _RDATA

I'm not sure if this is the right way to do it, though.

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









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/libgit2/libgit2/pull/7112

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy