[PATCH] Ignore/drop visibility for symbols with local linkage

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu May 1 14:01:30 PDT 2014


When symbols have local linkage (i.e., `internal` or `private`), a
visibility of `hidden` or `protected` doesn't make much sense.

These patches change LLVM and clang to ignore and drop non-default
visibility for such symbols.

0001 is a code cleanup before 0002, which updates clang to stop
generating `internal hidden`.  I checked every call to
`setVisibility()` -- the rest were already doing the right thing.

0003 fixes -internalize to drop visibility.

0004 fixes LTOModule.cpp to prefer internal over hidden and to give
symbols with appending linkage "default" scope.  I don't have a
testcase for this.  (How do I test the output of LTOModule.cpp?)

0005 clarifies `ModuleLinker::getLinkageResult()` with no
functionality change.

0006 updates the assembler and bitcode readers to reject and auto-
upgrade (respectively) non-default visibility on symbols with local
linkage, and updates LangRef.

0007 adds asserts to `setLinkage()` and `setVisibility()`, and
updates `makeVisible()` in ExtractGV.cpp, which was setting them out
of order.

My checkout of llvm+clang passes make check-all.  Are there other
projects I should check before committing 0007?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-CodeGen-Cleanup-visibility-in-RTTIBuilder.patch
Type: application/octet-stream
Size: 1544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-CodeGen-Don-t-set-hidden-visibility-on-symbols-with-.patch
Type: application/octet-stream
Size: 2393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-LTO-internalize-sets-visibility-to-default.patch
Type: application/octet-stream
Size: 1948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-LTO-Check-local-linkage-first.patch
Type: application/octet-stream
Size: 2153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-LTO-Clarify-visibility-when-merging-symbols.patch
Type: application/octet-stream
Size: 1307 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-IR-Don-t-allow-non-default-visibility-on-local-linka.patch
Type: application/octet-stream
Size: 23365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-GlobalValue-Assert-symbols-with-local-linkage-have-d.patch
Type: application/octet-stream
Size: 2206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140501/f6e43e78/attachment-0006.obj>


More information about the llvm-commits mailing list