[all-commits] [llvm/llvm-project] 75af9d: [MC][ELF] Error for sh_type, sh_flags or sh_entsiz...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Feb 21 15:46:53 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 75af9da755721123e62b45cd0bc0c5e688a9722a
      https://github.com/llvm/llvm-project/commit/75af9da755721123e62b45cd0bc0c5e688a9722a
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M llvm/lib/MC/MCParser/ELFAsmParser.cpp
    M llvm/test/MC/ELF/exclude-debug-dwo.s
    A llvm/test/MC/ELF/section-entsize-changed.s
    A llvm/test/MC/ELF/section-flags-changed.s
    A llvm/test/MC/ELF/section-type-changed.s

  Log Message:
  -----------
  [MC][ELF] Error for sh_type, sh_flags or sh_entsize change

Heads-up message: https://lists.llvm.org/pipermail/llvm-dev/2020-February/139390.html

GNU as started to emit warnings for changed sh_type or sh_flags in 2000.
GNU as>=2.35 will emit errors for most sh_type/sh_flags change, and error for entsize change.

Some cases remain warnings for legacy reasons:

   .section .init_array,"ax", @progbits
   .section .init_array,"ax", @init_array
   # And some obscure sh_flags changes (OS/Processor specific flags)

The rationale of a diagnostic (warning or error) is that sh_type,
sh_flags or sh_entsize changes usually indicate user errors. The values
are taken from the first .section directive. Successive directives are ignored.

We just try to be rigid and emit errors for all sh_type/sh_flags/sh_entsize change.

A possible improvement in the future is to reuse
llvm-readobj/ELFDumper.cpp:getSectionTypeString so that we can name the
type in the diagnostics.

Reviewed By: psmith

Differential Revision: https://reviews.llvm.org/D73999




More information about the All-commits mailing list