keep debug info in linker script

This commit is contained in:
Wolfgang Thaller
2021-03-23 22:12:49 +01:00
parent 1587f9cbc4
commit c12bc6a377
4 changed files with 15 additions and 47 deletions
+10 -43
View File
@@ -136,52 +136,19 @@ const char * scriptEnd = R"ld(
. = ALIGN(0x10) ;
_ebss = . ;
}
/* **** Debugging information sections.
* Keep them for now, they are discarded by Elf2Mac. */
/DISCARD/ : { *(.note.GNU-stack) }
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(*) }
/* /DISCARD/ : {
*(.debug_info);
*(.debug_abbrev);
*(.debug_loc);
*(.debug_aranges);
*(.debug_ranges);
*(.debug_line);
*(.debug_str);
*(.debug_frame);
} */
}
)ld";
void CreateFlatLdScript(std::ostream& out, string entryPoint, bool stripMacsbug)
{
out << "_MULTISEG_APP = 0;\n";
+2 -2
View File
@@ -97,8 +97,8 @@ Object::Object(string input)
if(boost::algorithm::starts_with(name,".rela."))
{
string progbitsName = name.substr(5);
assert(sections.find(progbitsName) != sections.end());
sections[progbitsName]->SetRela(scn);
if(sections.find(progbitsName) != sections.end())
sections[progbitsName]->SetRela(scn);
}
}
if(shdr.sh_type == SHT_PROGBITS && (shdr.sh_flags & SHF_ALLOC))
+1 -1
View File
@@ -205,7 +205,7 @@ void Section::FixRelocs(bool allowDirectCodeRefs)
<< "(" << sym.name << ")"
<< "+" << rela.r_offset << std::endl;
std::cerr << "needsJT: " << (sym.needsJT ? "true" : "false") << std::endl;
std::cerr << "from addr: " << rela.r_offset << ", exceptionInfoStart: " << exceptionInfoStart << std::endl;
std::cerr << "from addr: " << std::hex << rela.r_offset << ", exceptionInfoStart: " << exceptionInfoStart << std::dec << std::endl;
}
assert(sym.section.get() == this);
+2 -1
View File
@@ -36,7 +36,8 @@ Symbol::Symbol(Object& theObject, const GElf_Sym &sym)
if(st_shndx != SHN_UNDEF && st_shndx < SHN_LORESERVE)
{
section = theObject.sectionsByElfIndex[st_shndx];
sectionKind = section->kind;
if(section)
sectionKind = section->kind;
}
if(st_name)
{