RewriteInstance: account .stab and .stabstr as debug sections

Summary:
.stab and .stabstr are special sections containing debugging
information and strings associated with the debugging information.
This commit adds them to the list of debugging sections, so
these sections can be removed for output binary.

Vasily Leonenko,
Advanced Software Technology Lab, Huawei

(cherry picked from FBD29746153)
This commit is contained in:
Vasily Leonenko 2021-06-25 15:42:56 +08:00 committed by Maksim Panchenko
parent 0df7bf7b8b
commit 68be8caf3f

View File

@ -5425,7 +5425,8 @@ bool RewriteInstance::willOverwriteSection(StringRef SectionName) {
}
bool RewriteInstance::isDebugSection(StringRef SectionName) {
if (SectionName.startswith(".debug_") || SectionName == ".gdb_index")
if (SectionName.startswith(".debug_") || SectionName == ".gdb_index" ||
SectionName == ".stab" || SectionName == ".stabstr")
return true;
return false;