[llvm-commits] [llvm] r154124 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp
Bill Wendling
wendling at apple.com
Fri Apr 6 13:47:21 PDT 2012
On Apr 6, 2012, at 10:22 AM, Chris Lattner <clattner at apple.com> wrote:
> On Apr 6, 2012, at 12:34 AM, Duncan Sands wrote:
>>> The linker was told that the 'foo' in 'main' was 'internal' and had no uses, so
>>> it was dead stripped.
>>>
>>> Another situation is something like:
>>>
>>> define void @foo() {
>>> ret void
>>> }
>>>
>>> define void @bar() {
>>> call asm volatile "call _foo" ...
>>> ret void
>>> }
>>>
>>> The only use of 'foo' is inside of an inline ASM call. Since we don't look
>>> inside those for uses of functions, we don't specify this as a "use."
>>
>> This is user error: the user should add a "used" attribute to foo. This isn't
>> anything new: lots of people make this mistake (it's come up again and again on
>> the mailing list and in bugzilla). The user should be educated here.
>
> "What Duncan Said". This is expected behavior - and it really is a bug in the source code.
>
After reading the '__attribute__((used))' documentation, I'm now convinced that it wasn't a bug in our code.
> That said, if clang is running internalize at "clang -O4" or "clang -flto" then we should talk about whether that really is the right default. I'm not convinced it is. GCC has a -fwhole-program flag (or something like that) which might be appropriate. Otherwise, the standard linker visibility stuff should be used.
>
I don't really have a burning need to turn it on by default. A flag would be great, I would think.
-bw
More information about the llvm-commits
mailing list