[llvm-bugs] [Bug 42570] New: gas warning: ignoring changed section attributes

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 10 13:42:02 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: arnd at linaro.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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, at object               # @a
+       .section        .data..ro_after_init,"aw", at progbits
+       .globl  a
+       .p2align        2
+a:
+       .long   0                       # 0x0
+       .size   a, 4
+
        .type   b, at object               # @b
-       .section        .data..ro_after_init,"aM", at progbits,16
        .p2align        4
 b:
        .zero   16
        .size   b, 16

        .type   c, at object               # @c
        .bss
        .globl  c
        .p2align        2
 c:
        .long   0                       # 0x0
        .size   c, 4

-       .type   a, at object               # @a
-       .section        .data..ro_after_init,"aM", at 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","", at progbits


See also https://godbolt.org/z/hBPgpb

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190710/2eb18443/attachment.html>


More information about the llvm-bugs mailing list