binutils-gdb/ld/testsuite/ld-aarch64/nto-stack-note-3.d
Clément Chigot 318d83e658 ld: allow update of existing QNX stack note
Up to now, the linker would always create a QNX stack note from scratch.
However, object files could already have such note, ending up into
duplicates. QNX loader doesn't handle that.

Update the mechanism to first search through the input files for a .note
section holding a QNX stack note. If none are found, then a new section
is created into the stub file as before. This requires this search to be
done once the file have been opened, moving the whole logic a bit later
in the emulation process.

As part for this update, also allow to request an executable stack
without necessarily having to provide its size as well.  In this case, s
etup a default lazy stack of 0x1000.

ld/ChangeLog:

        * emultempl/nto.em (nto_create_QNX_note_section): New Function.
        (nto_lookup_QNX_note_section): New Function.
        (nto_add_note_section): Move the creation of the note section
        in the above new functions.
        (nto_create_output_section_statements): rename nto_after_open
        * testsuite/ld-aarch64/aarch64-nto.exp: add new test.
        * testsuite/ld-aarch64/nto-stack-note-3.d: New test.
        * testsuite/ld-aarch64/nto-stack-note.s: New test.
2023-10-13 16:23:39 +02:00

13 lines
272 B
Makefile

#name: nto-stack-note-3
#source: nto-stack-note.s
#as:
#ld: -z noexecstack
#readelf: -n
Displaying notes found in: .note
[ ]+Owner[ ]+Data size[ ]+Description
QNX 0x0000000c QNX stack
Stack Size: 0x4321
Stack allocated: 1234
Executable: no