[gdb/testsuite] Handle missing .note.GNU-stack
authorTom de Vries <tdevries@suse.de>
Tue, 25 Oct 2022 12:14:34 +0000 (14:14 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 25 Oct 2022 12:14:34 +0000 (14:14 +0200)
commit0f2cd53cf4f730136e2b275e8279d8bc348a9a88
treef7775e58ca7ef93377015832ca65a28690d05712
parent4ff322b6fa699e352730f58a0a1e90c09274b0f6
[gdb/testsuite] Handle missing .note.GNU-stack

On openSUSE Tumbleweed I run into this for the dwarf assembly test-cases, and
some hardcoded assembly test-cases:
...
 Running gdb.dwarf2/fission-absolute-dwo.exp ...
 gdb compile failed, ld: warning: fission-absolute-dwo.o: \
   missing .note.GNU-stack section implies executable stack
 ld: NOTE: This behaviour is deprecated and will be removed in a future \
   version of the linker

                 === gdb Summary ===

 # of untested testcases         1
...

Fix the dwarf assembly test-cases by adding the missing .note.GNU-stack in
proc Dwarf::assemble.

Fix the hard-coded test-cases using this command:
...
$ for f in $(find gdb/testsuite/gdb.* -name *.S); do
    if ! grep -q note.GNU-stack $f; then
      echo -e "\t.section\t.note.GNU-stack,\"\",@progbits" >> $f;
    fi;
  done
...

Likewise for .s files, and gdb/testsuite/lib/my-syscalls.S.

The idiom for arm seems to be to use %progbits instead, see commit 9a5911c08be
("gdb/testsuite/gdb.dwarf2: Replace @ with % for ARM compatability"), so
hand-edit gdb/testsuite/gdb.arch/arm-disp-step.S to use %progbits instead.

Note that dwarf assembly testcases use %progbits as decided by proc _section.

Tested on x86_64-linux.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29674
137 files changed:
gdb/testsuite/gdb.arch/aarch64-unwind-pc.S
gdb/testsuite/gdb.arch/amd64-break-on-asm-line.S
gdb/testsuite/gdb.arch/amd64-disp-step-avx.S
gdb/testsuite/gdb.arch/amd64-disp-step.S
gdb/testsuite/gdb.arch/amd64-i386-address.S
gdb/testsuite/gdb.arch/amd64-init-x87-values.S
gdb/testsuite/gdb.arch/amd64-prologue-skip.S
gdb/testsuite/gdb.arch/amd64-stap-expressions.S
gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.S
gdb/testsuite/gdb.arch/amd64-stap-wrong-subexp.S
gdb/testsuite/gdb.arch/amd64-tailcall-self.S
gdb/testsuite/gdb.arch/arc-analyze-prologue.S
gdb/testsuite/gdb.arch/arc-decode-insn.S
gdb/testsuite/gdb.arch/arc-disassembler-options.s
gdb/testsuite/gdb.arch/arm-disp-step.S
gdb/testsuite/gdb.arch/gdb1291.s
gdb/testsuite/gdb.arch/gdb1431.s
gdb/testsuite/gdb.arch/i386-cfi-notcurrent.S
gdb/testsuite/gdb.arch/i386-disp-step.S
gdb/testsuite/gdb.arch/i386-float.S
gdb/testsuite/gdb.arch/i386-permbkpt.S
gdb/testsuite/gdb.arch/mips-disassembler-options.s
gdb/testsuite/gdb.arch/pa-nullify.s
gdb/testsuite/gdb.arch/pa64-nullify.s
gdb/testsuite/gdb.arch/powerpc-addpcis.s
gdb/testsuite/gdb.arch/powerpc-altivec.s
gdb/testsuite/gdb.arch/powerpc-altivec2.s
gdb/testsuite/gdb.arch/powerpc-altivec3.s
gdb/testsuite/gdb.arch/powerpc-lnia.s
gdb/testsuite/gdb.arch/powerpc-plxv-nonrel.s
gdb/testsuite/gdb.arch/powerpc-power10.s
gdb/testsuite/gdb.arch/powerpc-power7.s
gdb/testsuite/gdb.arch/powerpc-power8.s
gdb/testsuite/gdb.arch/powerpc-power9.s
gdb/testsuite/gdb.arch/powerpc-prologue-frame.S
gdb/testsuite/gdb.arch/powerpc-stackless.S
gdb/testsuite/gdb.arch/powerpc-trap.s
gdb/testsuite/gdb.arch/powerpc-vsx.s
gdb/testsuite/gdb.arch/powerpc-vsx2.s
gdb/testsuite/gdb.arch/powerpc-vsx3.s
gdb/testsuite/gdb.arch/powerpc64-trap.s
gdb/testsuite/gdb.arch/ppc64-atomic-inst.S
gdb/testsuite/gdb.arch/ppc64-isa207-atomic-inst.S
gdb/testsuite/gdb.arch/pr25124.S
gdb/testsuite/gdb.arch/riscv-unwind-long-insn.S
gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-ld-lw-foo.s
gdb/testsuite/gdb.arch/riscv64-unwind-prologue-with-mv.s
gdb/testsuite/gdb.arch/s390-stackless.S
gdb/testsuite/gdb.arch/sparc64-regs.S
gdb/testsuite/gdb.arch/thumb-bx-pc.S
gdb/testsuite/gdb.arch/thumb-singlestep.S
gdb/testsuite/gdb.arch/thumb2-it.S
gdb/testsuite/gdb.asm/asmsrc1.s
gdb/testsuite/gdb.asm/asmsrc2.s
gdb/testsuite/gdb.base/dup-sect.S
gdb/testsuite/gdb.btrace/instruction_history.S
gdb/testsuite/gdb.btrace/x86-tsx.S
gdb/testsuite/gdb.compile/compile-constvar.S
gdb/testsuite/gdb.disasm/am33.s
gdb/testsuite/gdb.disasm/h8300s.s
gdb/testsuite/gdb.disasm/hppa.s
gdb/testsuite/gdb.disasm/mn10200.s
gdb/testsuite/gdb.disasm/mn10300.s
gdb/testsuite/gdb.disasm/sh3.s
gdb/testsuite/gdb.disasm/t01_mov.s
gdb/testsuite/gdb.disasm/t02_mova.s
gdb/testsuite/gdb.disasm/t03_add.s
gdb/testsuite/gdb.disasm/t04_sub.s
gdb/testsuite/gdb.disasm/t05_cmp.s
gdb/testsuite/gdb.disasm/t06_ari2.s
gdb/testsuite/gdb.disasm/t07_ari3.s
gdb/testsuite/gdb.disasm/t08_or.s
gdb/testsuite/gdb.disasm/t09_xor.s
gdb/testsuite/gdb.disasm/t10_and.s
gdb/testsuite/gdb.disasm/t11_logs.s
gdb/testsuite/gdb.disasm/t12_bit.s
gdb/testsuite/gdb.disasm/t13_otr.s
gdb/testsuite/gdb.dwarf2/dup-psym.S
gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-hello-dbg.S
gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc-world-dbg.S
gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S
gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.S
gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.S
gdb/testsuite/gdb.dwarf2/dw2-bad-elf-other.S
gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
gdb/testsuite/gdb.dwarf2/dw2-basic.S
gdb/testsuite/gdb.dwarf2/dw2-canonicalize-type.S
gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
gdb/testsuite/gdb.dwarf2/dw2-compdir-oldgcc.S
gdb/testsuite/gdb.dwarf2/dw2-compressed.S
gdb/testsuite/gdb.dwarf2/dw2-const.S
gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S
gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
gdb/testsuite/gdb.dwarf2/dw2-dos-drive.S
gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S
gdb/testsuite/gdb.dwarf2/dw2-dummy-cu.S
gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S
gdb/testsuite/gdb.dwarf2/dw2-entry-value.S
gdb/testsuite/gdb.dwarf2/dw2-filename.S
gdb/testsuite/gdb.dwarf2/dw2-icc-opaque.S
gdb/testsuite/gdb.dwarf2/dw2-icycle.S
gdb/testsuite/gdb.dwarf2/dw2-inheritance.S
gdb/testsuite/gdb.dwarf2/dw2-inline-param.S
gdb/testsuite/gdb.dwarf2/dw2-intercu.S
gdb/testsuite/gdb.dwarf2/dw2-intermix.S
gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.S
gdb/testsuite/gdb.dwarf2/dw2-minsym-in-cu.S
gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S
gdb/testsuite/gdb.dwarf2/dw2-noloc.S
gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-inner.S
gdb/testsuite/gdb.dwarf2/dw2-objfile-overlap-outer.S
gdb/testsuite/gdb.dwarf2/dw2-op-call.S
gdb/testsuite/gdb.dwarf2/dw2-op-out-param.S
gdb/testsuite/gdb.dwarf2/dw2-op-stack-value.S
gdb/testsuite/gdb.dwarf2/dw2-param-error.S
gdb/testsuite/gdb.dwarf2/dw2-producer.S
gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.S
gdb/testsuite/gdb.dwarf2/dw2-restore.S
gdb/testsuite/gdb.dwarf2/dw2-simple-locdesc.S
gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S
gdb/testsuite/gdb.dwarf2/dw2-strp.S
gdb/testsuite/gdb.dwarf2/dw2-unresolved.S
gdb/testsuite/gdb.dwarf2/dw2-var-zero-addr.S
gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S
gdb/testsuite/gdb.dwarf2/fission-reread.S
gdb/testsuite/gdb.dwarf2/frame-inlined-in-outer-frame.S
gdb/testsuite/gdb.dwarf2/mac-fileno.S
gdb/testsuite/gdb.dwarf2/pr11465.S
gdb/testsuite/gdb.dwarf2/pr13961.S
gdb/testsuite/gdb.linespec/break-asm-file0.s
gdb/testsuite/gdb.linespec/break-asm-file1.s
gdb/testsuite/gdb.mi/dw2-ref-missing-frame.S
gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S
gdb/testsuite/lib/dwarf.exp
gdb/testsuite/lib/my-syscalls.S