diff --git a/elf/input-files.cc b/elf/input-files.cc index 43803642..b4ecc14b 100644 --- a/elf/input-files.cc +++ b/elf/input-files.cc @@ -191,7 +191,7 @@ void ObjectFile::initialize_sections(Context &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"