tests: When building .so from -O asm output mark as non-executable stack

For certain tests, we take the output from dtc -O asm and build it into
a .so shared library which we then dlopen() for further tests.  Because we
don't mark it otherwise, it's treated as requiring an executable stack,
which dlopen() refuses to open as of glibc-2.41.

Of course, the library is pure data, no code, so it certainly doesn't need
an executable stack.  Add the -znoexecstack linker option to avoid the
error.

Fixes: https://github.com/dgibson/dtc/issues/163

Reported-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: David Gibson <david@gibson.dropbear.id.a>
This commit is contained in:
David Gibson 2025-02-05 13:39:43 +11:00
parent 915daadbb6
commit ce1d858888

View file

@ -201,7 +201,7 @@ run_dtc_test () {
}
asm_to_so () {
$CC -shared -o $1.test.so "$SRCDIR/data.S" $1.test.s
$CC -shared -Wl,-znoexecstack -o $1.test.so "$SRCDIR/data.S" $1.test.s
}
asm_to_so_test () {