Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -1838,9 +1838,9 @@ } unlinkAsync(Config->OutputFile); + unsigned Flags = Config->Relocatable ? 0 : FileOutputBuffer::F_executable; Expected> BufferOrErr = - FileOutputBuffer::create(Config->OutputFile, FileSize, - FileOutputBuffer::F_executable); + FileOutputBuffer::create(Config->OutputFile, FileSize, Flags); if (!BufferOrErr) error("failed to open " + Config->OutputFile + ": " +