LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1363 - protected visibility not supported
Summary: protected visibility not supported
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords: missing-feature
Depends on:
Blocks:
 
Reported: 2007-04-27 15:49 PDT by Lauro Venancio
Modified: 2010-02-22 12:50 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
LLVM-side patch (9.84 KB, patch)
2007-04-28 12:11 PDT, Anton Korobeynikov
Details
LLVM-GCC-side patch (4.95 KB, patch)
2007-04-29 18:52 PDT, Lauro Venancio
Details
LLVM-GCC-side patch (5.52 KB, patch)
2007-04-29 20:32 PDT, Lauro Venancio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Venancio 2007-04-27 15:49:21 PDT
LLVM doesn't support 

int bar __attribute__ ((visibility ("protected"))) = 1;

This is needed to compile the glibc.
Comment 1 Anton Korobeynikov 2007-04-27 16:22:27 PDT
Lauro, what's the semantics of protected visibility? How it should be
codegen'ed? There were some bits reserved to "future visibility types", so the
only non-trivial part should be codegen.
Comment 2 Lauro Venancio 2007-04-27 16:28:17 PDT
I don't know what is its semantics, but the codegen must emit ".protected bar". 
Comment 3 Anton Korobeynikov 2007-04-27 16:31:08 PDT
Mine. Should be trivial.
Comment 4 Lauro Venancio 2007-04-27 16:48:49 PDT
documentation:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Function-Attributes.html
Comment 5 Anton Korobeynikov 2007-04-28 12:11:55 PDT
Created attachment 811 [details]
LLVM-side patch

Lauro, please find LLVM-side patch attached. There is no linker part, you'll
have to add it by yourself. llvm-gcc part should be easy, I think (check for
VISIBILITY_PROTECTED in the same places as hidden is checked). LangRef should
be updated with the correct semantics of protected visibility as well.

Testcase:

@X = protected global i32 1234
Comment 6 Chris Lattner 2007-04-29 13:02:48 PDT
The patch looks fine, please apply it.  The critical missing pieces are LangRef.html and linker support.

-Chris
Comment 7 Anton Korobeynikov 2007-04-29 13:40:52 PDT
Implemented in:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048685.html
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048693.html

LangRef.html was also updated, so the only missed part is Linker.
Comment 8 Anton Korobeynikov 2007-04-29 13:43:40 PDT
As for linker: ld doesn't allow multiple definitions of the same variable with
different visibility styles. It just treats this as redefinition. Should we
follow ld?
Comment 9 Chris Lattner 2007-04-29 14:02:31 PDT
Yes, we should emulate ld
Comment 10 Anton Korobeynikov 2007-04-29 16:01:11 PDT
Linking was done in
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048711.html
Comment 11 Lauro Venancio 2007-04-29 18:52:19 PDT
Created attachment 812 [details]
LLVM-GCC-side patch
Comment 12 Lauro Venancio 2007-04-29 20:32:06 PDT
Created attachment 813 [details]
LLVM-GCC-side patch

I missed a TREE_PUBLIC check in the previous patch.
Comment 13 Chris Lattner 2007-05-05 13:16:00 PDT
Patch applied, should this be closed?
Comment 14 Anton Korobeynikov 2007-05-05 13:21:22 PDT
Yes. Definitely.