<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - gas warning: ignoring changed section attributes"
href="https://bugs.llvm.org/show_bug.cgi?id=42570">42570</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>gas warning: ignoring changed section attributes
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arnd@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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 <a href="https://godbolt.org/z/hBPgpb">https://godbolt.org/z/hBPgpb</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>