https://bugs.llvm.org/show_bug.cgi?id=42570
Bug ID: 42570
Summary: gas warning: ignoring changed section attributes
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: a...@linaro.org
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
Building the linux kernel for i386, I get an assembler warning in one file:
/tmp/slab_common-bf04f6.s: Assembler messages:
/tmp/slab_common-bf04f6.s:38: Warning: ignoring changed section attributes for
.data..ro_after_init
I reduced the test case to
int a __attribute__((__section__(".data..ro_after_init")));
static int b[4] __attribute__((__section__(".data..ro_after_init")));
int c;
int fn1(void);
void fn2() { c = b[fn1()]; }
clang-9 -fno-common -no-integrated-as -O2 -fno-strict-overflow -c test.c
Initializing 'a' to zero shuts up the warning, and causes this difference in
the assembler output:
--- slab_common-broken.s 2019-07-10 22:36:57.262501626 +0200
+++ slab_common-good.s 2019-07-10 22:37:17.418912892 +0200
@@ -12,36 +12,35 @@
cltq
movl b(,%rax,4), %eax
movl %eax, c(%rip)
popq %rax
.cfi_def_cfa_offset 8
retq
.Lfunc_end0:
.size fn2, .Lfunc_end0-fn2
.cfi_endproc
# -- End function
+ .type a,@object # @a
+ .section .data..ro_after_init,"aw",@progbits
+ .globl a
+ .p2align 2
+a:
+ .long 0 # 0x0
+ .size a, 4
+
.type b,@object # @b
- .section .data..ro_after_init,"aM",@progbits,16
.p2align 4
b:
.zero 16
.size b, 16
.type c,@object # @c
.bss
.globl c
.p2align 2
c:
.long 0 # 0x0
.size c, 4
- .type a,@object # @a
- .section .data..ro_after_init,"aM",@progbits,16
- .globl a
- .p2align 2
-a:
- .long 0 # 0x0
- .size a, 4
-
.ident "clang version
9.0.0-svn363902-1~exp1+0~20190620001509.2315~1.gbp76e756 (trunk)"
.section ".note.GNU-stack","",@progbits
See also https://godbolt.org/z/hBPgpb
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs