1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/test/MC/ELF/section-omitted-attributes.s
Tobias Burnus bbff278e57 [MC][ELF] Fix accepting abbreviated form with sh_flags and sh_entsize
Followup to D92052 as I missed an issue as shown via GCC bug https://gcc.gnu.org/PR97827, namely: (e.g.) ".rodata." implies ELF::SHF_ALLOC.

Crossref:

- D73999 / commit 75af9da755721123e62b45cd0bc0c5e688a9722a
  added for LLVM 11 a check that sh_flags and sh_entsize (and sh_type)
  changes are an error, in line with GNU assembler.

-  D92052 / commit 1deff4009e0ae661b03682901bf6932297ce7ea1
   permitted the abbreviated form which many assemblers accept and
   GCC generates: while the first .section contains the flags and entsize,
   subsequent sections simply contain the name without repeating entsize or
   flags.

However, the latter patch missed in the check that some flags are automatically set, e.g. '.rodata." implies ELF::SHF_ALLOC.

Related https://bugs.llvm.org/show_bug.cgi?id=48201

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D94072
2021-01-28 14:54:43 +00:00

18 lines
416 B
ArmAsm

# RUN: llvm-mc -triple=x86_64 %s -o - | FileCheck %s
# If section flags and other attributes are omitted, don't error.
# CHECK: .section .foo,"aM",@progbits,1
# CHECK: .section .rodata.cst8,"aM",@progbits,8
.section .foo,"aM",@progbits,1
.section .foo
.pushsection .foo
# Likewise, except that the '.rodata' prefix implies SHF_ALLOC.
.section .rodata.cst8,"aM",@progbits,8
.section .rodata.cst8