1
1
mirror of https://github.com/rui314/mold.git synced 2024-08-18 01:10:32 +03:00

-r: Do not strip .note.GNU-stack

This commit is contained in:
Rui Ueyama 2022-11-26 16:40:16 +08:00
parent 556a5cabf9
commit c1b57d9977

View File

@ -191,7 +191,7 @@ void ObjectFile<E>::initialize_sections(Context<E> &ctx) {
// area in GNU linkers. We ignore that section because silently
// making the stack area executable is too dangerous. Tell our
// users about the difference if that matters.
if (name == ".note.GNU-stack") {
if (name == ".note.GNU-stack" && !ctx.arg.relocatable) {
if (shdr.sh_flags & SHF_EXECINSTR) {
if (!ctx.arg.z_execstack && !ctx.arg.z_execstack_if_needed)
Warn(ctx) << *this << ": this file may cause a segmentation"