[llvm-dev] Internal visibility (original) (raw)

Rafik Zurob via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 7 14:54:38 PST 2019


Hello

In GCC on Linux on Power, -fvisibility=internal enables internal visibility.

$ cat t.c int foo(int i) { return i + 1; } $ gcc t.c -c -fvisibility=internal $ readelf -s t.o | grep foo 8: 0000000000000000 60 FUNC GLOBAL INTERNAL 1 foo $

But in Clang/LLVM, GlobalValue::VisibilityTypes does not have internal visibility:

/// An enumeration for the kinds of visibility of global values. enum VisibilityTypes { DefaultVisibility = 0, ///< The GV is visible HiddenVisibility, ///< The GV is hidden ProtectedVisibility ///< The GV is protected };

and using -fvisibility=internal in Clang uses the close-but-not-quite-the-same hidden visibility:

$ clang t.c -c -fvisibility=internal $ readelf -s t.o | grep foo 2: 0000000000000000 36 FUNC GLOBAL HIDDEN 2 foo $

Given that -fvisibility=internal is accepted, I assume this behaviour is intentional. Can anyone help me understand why that is, or point me to where I can find out more?

Thanks

Rafik



More information about the llvm-dev mailing list