ELF: Add --strip-debug option.

If --strip-debug option is given, then all sections whose names start
with ".debug" are removed from output.

llvm-svn: 265722
This commit is contained in:
Rui Ueyama
2016-04-07 21:04:51 +00:00
parent 07334f05de
commit fc6a4b045f
5 changed files with 41 additions and 3 deletions

View File

@@ -262,8 +262,13 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
if (Name == ".note.GNU-stack")
return &InputSection<ELFT>::Discarded;
if (Name == ".note.GNU-split-stack")
if (Name == ".note.GNU-split-stack") {
error("objects using splitstacks are not supported");
return &InputSection<ELFT>::Discarded;
}
if (Config->StripDebug && Name.startswith(".debug"))
return &InputSection<ELFT>::Discarded;
// A MIPS object file has a special section that contains register
// usage info, which needs to be handled by the linker specially.