bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/27412] New: Suspicious "setting incorrect section attributes fo


From: slyfox at inbox dot ru
Subject: [Bug gas/27412] New: Suspicious "setting incorrect section attributes for .note.Linux" warnings on linux kernel
Date: Sat, 13 Feb 2021 13:40:19 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27412

            Bug ID: 27412
           Summary: Suspicious "setting incorrect section attributes for
                    .note.Linux" warnings on linux kernel
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: slyfox at inbox dot ru
                CC: amodra at gmail dot com, hjl.tools at gmail dot com
  Target Milestone: ---

When building current linux-5.10 (or master) with gcc-11/binutins-2.36 gas
complains about incorrect (used) section flags. Minimal reproducer:

$ cat bug.c
    static const int _note_55 __attribute__((__used__))
__attribute__((section(".note.Linux"))) = 42;

$ gcc-11.0.0 -c bug.c -o bug-11.o -fno-ident
  /tmp/ccJ9p7TD.s: Assembler messages:
  /tmp/ccJ9p7TD.s:3: Warning: setting incorrect section attributes for
.note.Linux

$ gcc-10.2.0 -c bug.c -o bug-11.o -fno-ident
  <ok>

gcc-11 generates the following code:

$ gcc-11.0.0 -S bug.c -o bug-11.s -fno-ident  && cat bug-11.s
        .file   "bug.c"
        .text
        .section        .note.Linux,"aR"
        .align 4
        .type   _note_55, @object
        .size   _note_55, 4
_note_55:
        .long   42
        .section        .note.GNU-stack,"",@progbits

gcc-10 for completeness:

$ gcc-10.2.0 -S bug.c -o bug-11.s -fno-ident  && cat bug-11.s
        .file   "bug.c"
        .text
        .section        .note.Linux,"a"
        .align 4
        .type   _note_55, @object
        .size   _note_55, 4
_note_55:
        .long   42
        .section        .note.GNU-stack,"",@progbits

Original code comes from:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/elfnote.h#n71

Is it a real problem or a false positive warning? Currently
gcc-11/binutils-2.36 generates kernels that can't load some modules and
complain about a bunch of orphan sections. I wonder if this warhing is related
and somehow affects future linking.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]