Compiling ----------------------------------------------------------- target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-unknown-linux-gnu" @foo = weak_odr constant [1 x i8] c"\01" ------------------------------------------------------------ produces .section .gnu.linkonce.r.foo,"aM",@progbits Before revision 77184 it would produce .section .gnu.linkonce.r.foo,"a",@progbits This causes the gnu assembler to produce the warning: Warning: entity size for SHF_MERGE not specified
FYI, gcc uses "aG".
A c++ testcase: ---------------------------- class foo { public: void test() { static const char v[1] = { 1 }; } }; void foobar() { foo rep; rep.test(); } ------------------------- gcc produces .weak _ZZN3foo4testEvE1v .section .rodata._ZZN3foo4testEvE1v,"aG",@progbits,_ZZN3foo4testEvE1v,comdat .type _ZZN3foo4testEvE1v, @object .size _ZZN3foo4testEvE1v, 1 _ZZN3foo4testEvE1v: .byte 1 we produce .type _ZZN3foo4testEvE1v,@object .section .gnu.linkonce.r._ZZN3foo4testEvE1v,"aM",@progbits .weak _ZZN3foo4testEvE1v _ZZN3foo4testEvE1v: # _ZZN3foo4testEvE1v .size _ZZN3foo4testEvE1v, 1 .ascii "\001" I now think that the correct fix is to print a ", 1" in the section line after @progbits (or to use comdat as gcc does).
Created attachment 3263 [details] A hack that fixes the bug The attached patch is a hack, but it fixes the bug and "make check" has no regressions. What is the proper way to do this? Should I remove MergeableConst{4,8,16}?
Created attachment 3264 [details] now it really fixes it :-)
Just bumping up severity a bit, since this can also cause linker errors, not just warnings.
I'm sorry, I missed this bug. Taking a look now, sorry!
I opted to go for the simple fix: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090727/083081.html This returns us back to previous behavior. I'd like to get further along with the section selection refactoring stuff before making it more complex.