/* Add these three lines to get us a PT_GNU_STACK header */
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif
To all *.S source files. Use the below script:
e="/* Add these three lines to get us a PT_GNU_STACK header */
#ifdef __ELF__
.section .note.GNU-stack,\"\",%progbits
#endif"
for i in `find . -name \*.S`; do echo "$e" >> "$i"; done
Submit resulting changes upstream when finished and well tested, cite Ubuntu mainline as example.
The patching fix is as follows:
Append the following four lines:
/* Add these three lines to get us a PT_GNU_STACK header */ stack," ",%progbits
#ifdef __ELF__
.section .note.GNU-
#endif
To all *.S source files. Use the below script:
e="/* Add these three lines to get us a PT_GNU_STACK header */ stack,\ "\",%progbits
#ifdef __ELF__
.section .note.GNU-
#endif"
for i in `find . -name \*.S`; do echo "$e" >> "$i"; done
Submit resulting changes upstream when finished and well tested, cite Ubuntu mainline as example.
Test data used:
bluefox@ icebox: /tmp/x/ libgcrypt11- 1.2.2$ scanelf -qeRt . tmp/usr/ lib/libgcrypt. so.11.2. 1 libgcrypt11/ usr/lib/ libgcrypt. so.11.2. 1 libgcrypt11- dbg/usr/ lib/debug/ usr/lib/ libgcrypt. so.11.2. 1
RWX --- --- ./debian/
RWX --- --- ./debian/
RWX --- --- ./debian/
!WX --- --- ./mpi/mpih-rshift.o
!WX --- --- ./mpi/mpih-lshift.o
!WX --- --- ./mpi/mpih-mul3.o
!WX --- --- ./mpi/mpih-mul2.o
!WX --- --- ./mpi/mpih-mul1.o
!WX --- --- ./mpi/mpih-sub1.o
!WX --- --- ./mpi/mpih-add1.o
Result after fix: icebox: /tmp/x/ libgcrypt11- 1.2.2$ scanelf -qeRt . bluefox@ icebox: /tmp/x/ libgcrypt11- 1.2.2$
bluefox@