[PATCH] D130121: [3/3] [COFF] Emit embedded -exclude-symbols: directives for hidden visibility for MinGW

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 16:08:15 PDT 2022


rnk added a comment.

> On one hand, one could argue that with dllexport, you can also have such large .drectve sections with all the exported symbols. However in practice, I guess the norm would be that a fraction of the symbols are exported and the majority aren't.

Surprisingly, the exports can get pretty large as well. Without `/Zc:dllexportinlines-`, every inline method of every dllexported class is emitted into every object file in which it is included, and it is referenced from .drectve. I don't remember breaking out the cost specifically, but this was part of why we implemented the flag: 30% faster Chrome/Win dev builds <https://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html>.

> Strip and objcopy are used a lot for GNU COFF though, mainly to get rid of symbol tables and embedded dwarf debug info, neither which are a thing in the MSVC ecosystem

Sure, this is a very important use case, but these tools are not typically used on relocatable object files before linking. FB/Meta for some reason ran these tools after running `ld -r`, and ran into issues. See the most recent thread <https://discourse.llvm.org/t/problems-with-mach-o-address-significance-table-generation/63392/20>.

> Where did you file this request? It'd be interesting to track how it fares.

I wasn't able to find it, sorry.

---

The binutils folks seemed to really not like the design of encoding symbol table indices in object file sections, so they might not like this proposed design. See this bug <https://sourceware.org/bugzilla/show_bug.cgi?id=23817>. However, I still think it's a good way to extend the symbol table with new flags. As long as it's a handshake between the compiler and linker and not some open ended set of other tools (objcopy & strip), it's straightforward.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130121/new/

https://reviews.llvm.org/D130121



More information about the llvm-commits mailing list