Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 698f15b

Browse files
More fixes (#437)
* Merge pull request #429 from VSadov/tls1 Changes to support TLS access emitted in ILC (x64 win/linux) * Fix DWARF debug information emitted for empty enum (#433) (cherry picked from commit 167a9c5) --------- Co-authored-by: Filip Navara <[email protected]>
1 parent c8266b6 commit 698f15b

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

llvm/include/llvm/MC/MCObjectFileInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class MCObjectFileInfo {
344344
}
345345

346346
MCSection *getTLSExtraDataSection() const { return TLSExtraDataSection; }
347-
const MCSection *getTLSDataSection() const { return TLSDataSection; }
347+
MCSection *getTLSDataSection() const { return TLSDataSection; }
348348
MCSection *getTLSBSSSection() const { return TLSBSSSection; }
349349

350350
MCSection *getStackMapSection() const { return StackMapSection; }

llvm/tools/objwriter/debugInfo/dwarf/dwarfAbbrev.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ void Dump(MCObjectStreamer *Streamer, uint16_t DwarfVersion, unsigned TargetPoin
5959
dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,
6060
0, 0,
6161

62+
EnumerationTypeNoChildren,
63+
dwarf::DW_TAG_enumeration_type, dwarf::DW_CHILDREN_no,
64+
dwarf::DW_AT_name, dwarf::DW_FORM_strp,
65+
dwarf::DW_AT_type, dwarf::DW_FORM_ref4,
66+
dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1,
67+
0, 0,
68+
6269
Enumerator1,
6370
dwarf::DW_TAG_enumerator, dwarf::DW_CHILDREN_no,
6471
dwarf::DW_AT_name, dwarf::DW_FORM_strp,

llvm/tools/objwriter/debugInfo/dwarf/dwarfAbbrev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ enum DwarfAbbrev : uint16_t
2121
CompileUnit = 0x1,
2222
BaseType,
2323
EnumerationType,
24+
EnumerationTypeNoChildren,
2425
Enumerator1,
2526
Enumerator2,
2627
Enumerator4,

llvm/tools/objwriter/debugInfo/dwarf/dwarfTypeBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void DwarfEnumTypeInfo::DumpStrings(MCObjectStreamer *Streamer) {
284284

285285
void DwarfEnumTypeInfo::DumpTypeInfo(MCObjectStreamer *Streamer, UserDefinedDwarfTypesBuilder *TypeBuilder) {
286286
// Abbrev Number
287-
Streamer->emitULEB128IntValue(DwarfAbbrev::EnumerationType);
287+
Streamer->emitULEB128IntValue(HasChildren() ? DwarfAbbrev::EnumerationType : DwarfAbbrev::EnumerationTypeNoChildren);
288288

289289
// DW_AT_name
290290
EmitSectionOffset(Streamer, StrSymbol, 4);

llvm/tools/objwriter/objwriter.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ MCSection *ObjectWriter::GetSection(const char *SectionName,
223223
Section = ObjFileInfo->getReadOnlySection();
224224
} else if (strcmp(SectionName, "xdata") == 0) {
225225
Section = ObjFileInfo->getXDataSection();
226+
} else if (strcmp(SectionName, "tdata") == 0) {
227+
Section = ObjFileInfo->getTLSDataSection();
228+
} else if (strcmp(SectionName, "tbss") == 0) {
229+
Section = ObjFileInfo->getTLSBSSSection();
226230
} else if (strcmp(SectionName, "bss") == 0) {
227231
if (OutContext->getObjectFileType() == MCContext::IsMachO) {
228232
Section = ObjFileInfo->getDataBSSSection();
@@ -458,6 +462,18 @@ int ObjectWriter::EmitSymbolRef(const char *SymbolName,
458462
case RelocType::IMAGE_REL_BASED_DIR64:
459463
Size = 8;
460464
break;
465+
case RelocType::IMAGE_REL_SECREL:
466+
Kind = MCSymbolRefExpr::VK_SECREL;
467+
Size = 4;
468+
break;
469+
case RelocType::IMAGE_REL_TLSGD:
470+
Kind = MCSymbolRefExpr::VK_TLSGD;
471+
Size = 4;
472+
break;
473+
case RelocType::IMAGE_REL_TPOFF:
474+
Kind = MCSymbolRefExpr::VK_TPOFF;
475+
Size = 4;
476+
break;
461477
case RelocType::IMAGE_REL_BASED_REL32:
462478
if (OutContext->getObjectFileType() == MCContext::IsMachO &&
463479
OutContext->getTargetTriple().getArch() == Triple::aarch64) {

llvm/tools/objwriter/objwriter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ enum class RelocType {
5959
IMAGE_REL_BASED_RELPTR32 = 0x7C,
6060
IMAGE_REL_BASED_ARM64_PAGEBASE_REL21 = 0x81,
6161
IMAGE_REL_BASED_ARM64_PAGEOFFSET_12A = 0x82,
62+
IMAGE_REL_SECREL = 0x104,
63+
IMAGE_REL_TLSGD = 0x105,
64+
IMAGE_REL_TPOFF = 0x106,
6265
};
6366

6467
enum class SymbolRefFlags

0 commit comments

Comments
 (0)