[PATCH] D17998: [ELF] implement --warn-common/--no-warn-common

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 12 01:14:31 PST 2016


>> -warn-common
>>               Warn when a common symbol is combined with another common symbol
>>               or with a symbol definition.  Unix linkers allow  this  somewhat
>>               sloppy  practice, but linkers on some other operating systems do
>>               not.  This option allows you to  find  potential  problems  from
>>               combining global symbols.
>
>Is it intentional that you warn on the common case of two common
>definitions of the same size? That's about the only valid use case in
>regular use.
>
>Joerg

Didn't noticed that comment at first, sorry.
Yes, I did that intentionaly because gold do the same, 
consider 2 files:

test.s:
.globl _start
_start:

.type arr, at object
.comm arr,4,4

test2.s:
.type arr, at object
.comm arr,4,4

So 2 commons have the same size and gold produces a warning in that case:
++ /home/LLVM/build/bin/llvm-mc -filetype=obj test.s -o test.o
++ /home/LLVM/build/bin/llvm-mc -filetype=obj test2.s -o test2.o
++ gold -warn-common test.o test2.o -o test
gold: warning: test2.o: multiple common of 'arr'
gold: test.o: previous definition here

George.


More information about the llvm-commits mailing list