Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gas warning: ignoring changed section attributes #41915

Open
arndb mannequin opened this issue Jul 10, 2019 · 0 comments
Open

gas warning: ignoring changed section attributes #41915

arndb mannequin opened this issue Jul 10, 2019 · 0 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@arndb
Copy link
Mannequin

arndb mannequin commented Jul 10, 2019

Bugzilla Link 42570
Version trunk
OS Linux
Blocks #4440
CC @arndb,@nickdesaulniers,@zygoloid

Extended Description

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

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

0 participants