[llvm-bugs] [Bug 33472] New: operator new(size_t) can't have hidden visibility

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 15 11:18:56 PDT 2017


            Bug ID: 33472
           Summary: operator new(size_t) can't have hidden visibility
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thomasanderson at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 18645
  --> https://bugs.llvm.org/attachment.cgi?id=18645&action=edit

Compile the attached test.cpp with clang 5.0.0:
$ clang++ -fvisibility=hidden -nostdinc++ -std=c++11 -c test.cpp -o test.o

-fvisibility=hidden should make all symbols hidden, but operator new is not:

$ objdump -t test.o | grep _Znwm
0000000000000000 g     F .text  000000000000000f _Znwm
000000000000000f g     F .text  0000000000000013 .hidden _ZnwmRK9nothrow_t

Adding 'attribute((visibility("hidden")))' on operator new only raises an

test.cpp:4:16: error: visibility does not match previous declaration
note: previous attribute is here
1 error generated.

I was told that this behavior is determined by a built-in declaration that is
added here:

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170615/008ef00b/attachment.html>

More information about the llvm-bugs mailing list