1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[AVR] Enable emission of debug information

Prior to this, the code was missing AVR-specific relocation logic in
RelocVisitor.h.

This patch teaches RelocVisitor about R_AVR_16 and R_AVR_32.

Debug information is emitted in the final object file, and understood by
'avr-readelf --debug-dump' from AVR-GCC.

llvm-dwarfdump is yet to understand how to dump AVR DWARF symbols.

llvm-svn: 351720
This commit is contained in:
Dylan McKay 2019-01-21 04:27:08 +00:00
parent 762baddef7
commit b12b974df1
2 changed files with 13 additions and 0 deletions

View File

@ -100,6 +100,8 @@ private:
case Triple::arm: case Triple::arm:
case Triple::armeb: case Triple::armeb:
return visitARM(Rel, R, Value); return visitARM(Rel, R, Value);
case Triple::avr:
return visitAVR(Rel, R, Value);
case Triple::lanai: case Triple::lanai:
return visitLanai(Rel, R, Value); return visitLanai(Rel, R, Value);
case Triple::mipsel: case Triple::mipsel:
@ -258,6 +260,16 @@ private:
return 0; return 0;
} }
uint64_t visitAVR(uint32_t Rel, RelocationRef R, uint64_t Value) {
if (Rel == ELF::R_AVR_16) {
return (Value + getELFAddend(R)) & 0xFFFF;
} else if (Rel == ELF::R_AVR_32) {
return (Value + getELFAddend(R)) & 0xFFFFFFFF;
}
HasError = true;
return 0;
}
uint64_t visitLanai(uint32_t Rel, RelocationRef R, uint64_t Value) { uint64_t visitLanai(uint32_t Rel, RelocationRef R, uint64_t Value) {
if (Rel == ELF::R_LANAI_32) if (Rel == ELF::R_LANAI_32)
return (Value + getELFAddend(R)) & 0xFFFFFFFF; return (Value + getELFAddend(R)) & 0xFFFFFFFF;

View File

@ -23,6 +23,7 @@ AVRMCAsmInfo::AVRMCAsmInfo(const Triple &TT) {
PrivateGlobalPrefix = ".L"; PrivateGlobalPrefix = ".L";
UsesELFSectionDirectiveForBSS = true; UsesELFSectionDirectiveForBSS = true;
UseIntegratedAssembler = true; UseIntegratedAssembler = true;
SupportsDebugInformation = true;
} }
} // end of namespace llvm } // end of namespace llvm