[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 9a5911c08b
("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
This commit is contained in:
Tom de Vries
2022-10-25 14:14:34 +02:00
parent 4ff322b6fa
commit 0f2cd53cf4
137 changed files with 139 additions and 0 deletions

View File

@@ -46,3 +46,4 @@ test_func:
mov x30, 0x1234
ret x0
.cfi_endproc
.section .note.GNU-stack,"",@progbits

View File

@@ -33,3 +33,4 @@ test:
nop /* Incorrect. */
nop
nop
.section .note.GNU-stack,"",@progbits

View File

@@ -75,3 +75,4 @@ done:
var128:
.8byte 0xaa55aa55aa55aa55
.8byte 0x55aa55aa55aa55aa
.section .note.GNU-stack,"",@progbits

View File

@@ -179,3 +179,4 @@ test_abs_jmp_end:
test_rep_ret:
repz
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -22,3 +22,4 @@ _start: .globl _start
int3
nop
nop
.section .note.GNU-stack,"",@progbits

View File

@@ -29,3 +29,4 @@ main:
nop
fld1
nop
.section .note.GNU-stack,"",@progbits

View File

@@ -26,3 +26,4 @@ pushrbp: .globl pushrbp
#define MINSYM nop; .globl minsym; minsym: nop
/*8*/ MINSYM
/*a*/ hlt
.section .note.GNU-stack,"",@progbits

View File

@@ -41,3 +41,4 @@ main:
xor %rax,%rax
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -40,3 +40,4 @@ main:
STAP_PROBE1(probe, fail2_probe, 23-@$16)
xor %rax,%rax
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -25,3 +25,4 @@ main:
STAP_PROBE2(probe, bar, -4@-($4), -4@$-3+($22/$2)-$16)
xor %rax,%rax
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -612,3 +612,4 @@ die10a:
.LASF2:
.string "argv"
.ident "GCC: (GNU) 4.9.2 20150212 (Red Hat 4.9.2-6)"
.section .note.GNU-stack,"",@progbits

View File

@@ -901,3 +901,4 @@ main:
j_s [blink]
.align 4
.section .note.GNU-stack,"",@progbits

View File

@@ -1000,3 +1000,4 @@ start_branch_tests:
.Lend:
.section .note.GNU-stack,"",@progbits

View File

@@ -19,3 +19,4 @@
foo:
lr r0, [tlbpd0]
.end foo
.section .note.GNU-stack,"",@progbits

View File

@@ -391,3 +391,4 @@ test_add_rn_pc_end:
bx lr
.size test_add_rn_pc, .-test_add_rn_pc
#endif
.section .note.GNU-stack,"",%progbits

View File

@@ -126,3 +126,4 @@ _sub2:
.short 260
.size _sub2, .-_sub2
.ident "GCC: (GNU) 3.5.0 20040204 (experimental)"
.section .note.GNU-stack,"",@progbits

View File

@@ -126,3 +126,4 @@ _sub2:
.short 260
.size _sub2, .-_sub2
.ident "GCC: (GNU) 3.5.0 20040204 (experimental)"
.section .note.GNU-stack,"",@progbits

View File

@@ -74,3 +74,4 @@ main:
.cfi_endproc
.LFE2:
.size main, .-main
.section .note.GNU-stack,"",@progbits

View File

@@ -121,3 +121,4 @@ test_call_end:
.global test_ret
test_ret:
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -36,3 +36,4 @@ SYMBOL(main):
val: .byte 0x00,0x00,0x45,0x07,0x11,0x19,0x22,0xe9,0xfe,0xbf
smallval: .byte 0xe9,0xd0,0xd7,0x65,0x81,0xb7,0x43,0xc6,0x5c,0x6a
bigval: .byte 0x6a,0x45,0x90,0xdc,0x03,0xc1,0xf8,0xc6,0xe5,0x03
.section .note.GNU-stack,"",@progbits

View File

@@ -28,3 +28,4 @@
SYMBOL(main):
int3
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -28,3 +28,4 @@ foo:
bar:
move $2, $8
.end bar
.section .note.GNU-stack,"",@progbits

View File

@@ -56,3 +56,4 @@ main:
bv,n %r0(%r2)
.EXIT
.PROCEND
.section .note.GNU-stack,"",@progbits

View File

@@ -68,3 +68,4 @@ main:
bve,n (%r2)
.EXIT
.PROCEND
.section .note.GNU-stack,"",@progbits

View File

@@ -33,3 +33,4 @@ main:
blr
.section .note.GNU-stack,"",@progbits

View File

@@ -213,3 +213,4 @@ func:
.long 0x11e0e28e /* vupklsb v15,v28 */
.long 0x110042ce /* vupklsh v8,v8 */
.long 0x13201cc4 /* vxor v25,v0,v3 */
.section .note.GNU-stack,"",@progbits

View File

@@ -133,3 +133,4 @@ func:
.long 0x11e0f7c3 /* vpopcntd v15,v30 */
.long 0x105f36c7 /* vcmpgtud. v2,v31,v6 */
.long 0x128f17c7 /* vcmpgtsd. v20,v15,v2 */
.section .note.GNU-stack,"",@progbits

View File

@@ -86,3 +86,4 @@ func:
.long 0x11e90f4d /* vextuhrx r15,r9,v1 */
.long 0x12b1878d /* vextuwrx r21,r17,v16 */
.long 0x1295b5e3 /* vmsumudm v20,v21,v22,v23 */
.section .note.GNU-stack,"",@progbits

View File

@@ -31,3 +31,4 @@ main:
lnia 9 # /* set r9 */
blr
.section .note.GNU-stack,"",@progbits

View File

@@ -43,3 +43,4 @@ mydata:
.long 0xabbbcbdb # <<- loaded into vs7
.long 0xacbcccdc # <<-
.section .note.GNU-stack,"",@progbits

View File

@@ -1015,3 +1015,4 @@ func:
.long 0x80060003
.long 0x05000000 /* xxspltiw vs0,8 */
.long 0x80060008
.section .note.GNU-stack,"",@progbits

View File

@@ -108,3 +108,4 @@ func:
.long 0x7d80e3a6 /* mtppr r12 */
.long 0x7da2e3a6 /* mtppr32 r13 */
.long 0x7d605264 /* tlbie r10,r11 */
.section .note.GNU-stack,"",@progbits

View File

@@ -185,3 +185,4 @@ func:
.long 0x7d81492d /* stwcx. r12,r1,r9 */
.long 0x7da051ad /* stdcx. r13,0,r10 */
.long 0x7da151ad /* stdcx. r13,r1,r10 */
.section .note.GNU-stack,"",@progbits

View File

@@ -384,3 +384,4 @@ func:
.long 0xffd7048e /* mffscrni f30,0 */
.long 0xffd71c8e /* mffscrni f30,3 */
.long 0xfff8048e /* mffsl f31 */
.section .note.GNU-stack,"",@progbits

View File

@@ -33,3 +33,4 @@ FUNC_START(foo)
mr 1,11
blr
FUNC_END(foo)
.section .note.GNU-stack,"",@progbits

View File

@@ -22,3 +22,4 @@ FUNC_START(main)
mtlr sp
blr
FUNC_END(main)
.section .note.GNU-stack,"",@progbits

View File

@@ -29,3 +29,4 @@ main:
li 3, 0
blr
.section .note.GNU-stack,"",@progbits

View File

@@ -170,3 +170,4 @@ func:
.long 0xf102e293 /* xxspltw vs40,vs60,2 */
.long 0x7d00a699 /* lxvd2x vs40,0,r20 */
.long 0x7d00a799 /* stxvd2x vs40,0,r20 */
.section .note.GNU-stack,"",@progbits

View File

@@ -63,3 +63,4 @@ func:
.long 0xf360d52d /* xscvspdpn vs59,vs26 */
.long 0xff0e168c /* fmrgow f24,f14,f2 */
.long 0xfec72f8c /* fmrgew f22,f7,f5 */
.section .note.GNU-stack,"",@progbits

View File

@@ -139,3 +139,4 @@ func:
.long 0xfe766688 /* xscvdpqp v19,v12 */
.long 0xfdb92688 /* xscvqpsdz v13,v4 */
.long 0xfcf83ec8 /* xsiexpqp v7,v24,v7 */
.section .note.GNU-stack,"",@progbits

View File

@@ -31,3 +31,4 @@ main:
li 3, 0
blr
.section .note.GNU-stack,"",@progbits

View File

@@ -59,3 +59,4 @@ main:
#else
.size .main,.-.main
#endif
.section .note.GNU-stack,"",@progbits

View File

@@ -98,3 +98,4 @@ test_atomic_sequences:
#else
.size .test_atomic_sequences,.-.test_atomic_sequences
#endif
.section .note.GNU-stack,"",@progbits

View File

@@ -33,3 +33,4 @@ main:
mov r0, #0
bx lr
.size main, .-main
.section .note.GNU-stack,"",@progbits

View File

@@ -60,3 +60,4 @@ func:
addi sp,sp,16
jr ra
.size func, .-func
.section .note.GNU-stack,"",@progbits

View File

@@ -72,3 +72,4 @@ foo:
addi sp,sp,32
jr ra
.size foo, .-foo
.section .note.GNU-stack,"",@progbits

View File

@@ -45,3 +45,4 @@ foo:
addi sp,sp,32
jr ra
.size foo, .-foo
.section .note.GNU-stack,"",@progbits

View File

@@ -31,3 +31,4 @@ main: la %r15,3(0,0)
.byte 0,1
1: st %r15,0(%r15)
br %r14
.section .note.GNU-stack,"",@progbits

View File

@@ -134,3 +134,4 @@ test_fsr:
.align 8
flags: .xword 0x0000000000000000
.size flags, .-flags
.section .note.GNU-stack,"",@progbits

View File

@@ -32,3 +32,4 @@ main:
mov r0, #0
bx lr
.size main, .-main
.section .note.GNU-stack,"",@progbits

View File

@@ -38,3 +38,4 @@ main:
pop {r3, pc}
.size main, .-main
.section .note.GNU-stack,"",@progbits

View File

@@ -180,3 +180,4 @@ it_breakpoints:
bx lr
#endif /* __thumb2__ */
.section .note.GNU-stack,"",@progbits

View File

@@ -85,3 +85,4 @@
gdbasm_datavar staticvar 5
.include "note.inc"
.section .note.GNU-stack,"",@progbits

View File

@@ -19,3 +19,4 @@
comment "mark: foo2 leave"
gdbasm_leave
gdbasm_end foo2
.section .note.GNU-stack,"",@progbits

View File

@@ -20,3 +20,4 @@ var1: .byte 1
.section sect2, "a"
var2: .byte 2
.section .note.GNU-stack,"",@progbits

View File

@@ -30,3 +30,4 @@ loop:
jmp .L1
.L2:
ret /* bp.2 */
.section .note.GNU-stack,"",@progbits

View File

@@ -27,3 +27,4 @@ test:
.Lhandler:
mov $1, %eax
ret
.section .note.GNU-stack,"",@progbits

View File

@@ -93,3 +93,4 @@
.LASF0:
.string "GNU C 4.8.2 20131212 (Red Hat 4.8.2-7) -mtune=generic -march=x86-64 -g"
.ident "GCC: (GNU) 4.8.2 20131212 (Red Hat 4.8.2-7)"
.section .note.GNU-stack,"",@progbits

View File

@@ -522,3 +522,4 @@ dsp_autoincrement_tests:
mov_leq (r1+,4),r2
mov_lne (r1+,4),r2
mov_lra (r1+,4),r2
.section .note.GNU-stack,"",@progbits

View File

@@ -354,3 +354,4 @@ system_control_tests:
block_data_transfer_tests:
eepmov.b
eepmov.w
.section .note.GNU-stack,"",@progbits

View File

@@ -1736,3 +1736,4 @@ fmemLRbug_tests_4
bv,n 0(%r2)
.EXIT
.PROCEND
.section .note.GNU-stack,"",@progbits

View File

@@ -215,3 +215,4 @@ sub_tests:
sub 32767,a2
sub 131071,a2
subc d1,d2
.section .note.GNU-stack,"",@progbits

View File

@@ -298,3 +298,4 @@ sub_tests:
sub 131071,a1
subc d1,d2
.section .note.GNU-stack,"",@progbits

View File

@@ -52,3 +52,4 @@ _fp_misc_tests:
sts fpscr,r3
sts.l fpscr,@-r3
.section .note.GNU-stack,"",@progbits

View File

@@ -1105,3 +1105,4 @@ label:
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -236,3 +236,4 @@ _start:
mova/l.l @(0x12345678:32,@0x9ABCDEF0:32.w),er1 ;015F48D99ABCDEF012345678
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -976,3 +976,4 @@ _start:
add.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848109abcdef0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -975,3 +975,4 @@ _start:
sub.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848309abcdef0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -919,3 +919,4 @@ _start:
cmp.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848209abcdef0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -186,3 +186,4 @@ _start:
divs.l er3,er1 ;01d25331
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -171,3 +171,4 @@ _start:
exts.l #2,@0x12345678:32 ;01046b281234567817e0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -970,3 +970,4 @@ _start:
or.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848409abcdef0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -970,3 +970,4 @@ _start:
xor.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848509abcdef0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -970,3 +970,4 @@ _start:
and.l @0x12345678:32,@0x9abcdef0:32 ;01046b2c1234567848609abcdef0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -1175,3 +1175,4 @@ _start:
rotr.l #2,@0x12345678:32 ;01046b281234567813f0
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -174,3 +174,4 @@ _start:
bfst r3h,#0x34:8,@0x12345678:32 ;6a3812345678f334
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -157,3 +157,4 @@ _start:
nop ;0000
.end
.section .note.GNU-stack,"",@progbits

View File

@@ -197,3 +197,4 @@ func_cu1:
.byte 1
.Lline1_end:
.section .note.GNU-stack,"",@progbits

View File

@@ -149,3 +149,4 @@ LELTP:
.uleb128 0x1
.byte 0x1
LELT:
.section .note.GNU-stack,"",@progbits

View File

@@ -149,3 +149,4 @@ LELTP:
.uleb128 0x1
.byte 0x1
LELT:
.section .note.GNU-stack,"",@progbits

View File

@@ -53,3 +53,4 @@ debug_end:
.byte 0x0
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -375,3 +375,4 @@
.section .debug_line
.Ldebug_line0:
.section .note.GNU-stack,"",@progbits

View File

@@ -246,3 +246,4 @@ func_cu2:
.byte 1
.Lline1_end:
.section .note.GNU-stack,"",@progbits

View File

@@ -27,3 +27,4 @@ some_func:
.size some_func,.-some_func
some_func_end:
nop
.section .note.GNU-stack,"",@progbits

View File

@@ -71,3 +71,4 @@ debug_end:
.byte 0x0
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -197,3 +197,4 @@ func_cu1:
.byte 1
.Lline1_end:
.section .note.GNU-stack,"",@progbits

View File

@@ -154,3 +154,4 @@ debug_end:
.byte 0x0
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -126,3 +126,4 @@
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.section .note.GNU-stack,"",@progbits

View File

@@ -239,3 +239,4 @@ gcc43: .globl gcc43
.uleb128 1
.byte 1
.Lgcc43_end:
.section .note.GNU-stack,"",@progbits

View File

@@ -218,3 +218,4 @@ func_cu1:
.byte 0x9c
.byte 0x00
.byte 0x92
.section .note.GNU-stack,"",@progbits

View File

@@ -249,3 +249,4 @@ func_cu1:
.byte 1
.Lline1_end:
.section .note.GNU-stack,"",@progbits

View File

@@ -113,3 +113,4 @@
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.section .note.GNU-stack,"",@progbits

View File

@@ -107,3 +107,4 @@
.byte 0x0 /* Terminator .debug_abbrev
section. */
.section .note.GNU-stack,"",@progbits

View File

@@ -74,3 +74,4 @@ dieb:
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -617,3 +617,4 @@
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -31,3 +31,4 @@ main_end:
.section .debug_abbrev
.Ldebug_abbrev0:
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -106,3 +106,4 @@ var: .4byte 1
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.section .note.GNU-stack,"",@progbits

View File

@@ -80,3 +80,4 @@ dieb:
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -102,3 +102,4 @@ loclist:
.byte 0x0
.byte 0x0
.byte 0x0
.section .note.GNU-stack,"",@progbits

View File

@@ -51,3 +51,4 @@
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.section .note.GNU-stack,"",@progbits

Some files were not shown because too many files have changed in this diff Show More