[LLVMdev] Your commit 103140

Chris Lattner clattner at apple.com
Tue Mar 13 13:11:30 PDT 2012


On Mar 13, 2012, at 8:26 AM, Duncan Sands wrote:

> Hi Chris, your commit 103140 broke PR397 for llvm-gcc (in LLVM 2.9) and
> dragonegg.

Wow, this is an old patch :).

> In the PR, asm renaming creates two linkonce functions with
> the same asm name (in the IR they are @"\01lstat64" and "@lstat64".  What
> used to happen is that they were both output to the assembler file, both
> with the name lstat64, exactly like GCC does.  The assembler and linker
> are perfectly happy about this, presumably because the functions have weak
> linkage.  What happens now is that compilation fails with "label emitted
> multiple times to assembly file".
> 
> Do you agree that it is reasonable to support outputting multiple functions
> with the same name, as long as they have weak linkage?

No, I don't.  I think that an IR module should be required to be well defined and obey the rules.  For GCC/clang (and any other compilers that support things like asm renaming and USER_LABEL_PREFIX), I think it is best for the frontend to not use the "\01" prefix in a case that conflicts with the normal USER_LABEL_PREFIX.  For example, on an _'y system, if asm-renamed to "_foo", the IR name should be just @"foo", not "\01_foo".

-Chris



More information about the llvm-dev mailing list