https://llvm.org/bugs/show_bug.cgi?id=27853

Richard Smith <richard-l...@metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-l...@metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #20 from Richard Smith <richard-l...@metafoo.co.uk> ---
(In reply to comment #19)
> (In reply to comment #17)
> > Both compilers are probably discarding 'obj' because it is unused.
> 
> But it *is* being used -- in doTest1 and doTest2.  So, I don't think that
> statement is correct.  

It's unused *in the generated code*.

> But I *thought* that statics (including local statics) were required to
> exist in the .bss section of the shared library/executable.

Some symbols are required to be emitted by every translation unit that needs a
definition of them (after optimization). Those ones are not guaranteed to exist
anywhere in the optimized object code.

If you want to find symbols via dlsym, you need to avoid that kind. The usual
approach to this is to make the symbols external linkage, extern "C", and
marked with __attribute__((used)). That guarantees their existence and that
they have a non-mangled name.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to