Skip to content

Commit

Permalink
Merge pull request #429 from VSadov/tls1
Browse files Browse the repository at this point in the history
Changes to support TLS access emitted in ILC (x64 win/linux)
  • Loading branch information
VSadov authored Jun 15, 2023
2 parents be77bdd + 36ce724 commit 0bd20ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/include/llvm/MC/MCObjectFileInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class MCObjectFileInfo {
}

MCSection *getTLSExtraDataSection() const { return TLSExtraDataSection; }
const MCSection *getTLSDataSection() const { return TLSDataSection; }
MCSection *getTLSDataSection() const { return TLSDataSection; }
MCSection *getTLSBSSSection() const { return TLSBSSSection; }

MCSection *getStackMapSection() const { return StackMapSection; }
Expand Down
16 changes: 16 additions & 0 deletions llvm/tools/objwriter/objwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ MCSection *ObjectWriter::GetSection(const char *SectionName,
Section = ObjFileInfo->getReadOnlySection();
} else if (strcmp(SectionName, "xdata") == 0) {
Section = ObjFileInfo->getXDataSection();
} else if (strcmp(SectionName, "tdata") == 0) {
Section = ObjFileInfo->getTLSDataSection();
} else if (strcmp(SectionName, "tbss") == 0) {
Section = ObjFileInfo->getTLSBSSSection();
} else if (strcmp(SectionName, "bss") == 0) {
if (OutContext->getObjectFileType() == MCContext::IsMachO) {
Section = ObjFileInfo->getDataBSSSection();
Expand Down Expand Up @@ -457,6 +461,18 @@ int ObjectWriter::EmitSymbolRef(const char *SymbolName,
case RelocType::IMAGE_REL_BASED_DIR64:
Size = 8;
break;
case RelocType::IMAGE_REL_SECREL:
Kind = MCSymbolRefExpr::VK_SECREL;
Size = 4;
break;
case RelocType::IMAGE_REL_TLSGD:
Kind = MCSymbolRefExpr::VK_TLSGD;
Size = 4;
break;
case RelocType::IMAGE_REL_TPOFF:
Kind = MCSymbolRefExpr::VK_TPOFF;
Size = 4;
break;
case RelocType::IMAGE_REL_BASED_REL32:
if (OutContext->getObjectFileType() == MCContext::IsMachO &&
OutContext->getTargetTriple().getArch() == Triple::aarch64) {
Expand Down
3 changes: 3 additions & 0 deletions llvm/tools/objwriter/objwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ enum class RelocType {
IMAGE_REL_BASED_RELPTR32 = 0x7C,
IMAGE_REL_BASED_ARM64_PAGEBASE_REL21 = 0x81,
IMAGE_REL_BASED_ARM64_PAGEOFFSET_12A = 0x82,
IMAGE_REL_SECREL = 0x104,
IMAGE_REL_TLSGD = 0x105,
IMAGE_REL_TPOFF = 0x106,
};

enum class SymbolRefFlags
Expand Down

0 comments on commit 0bd20ce

Please sign in to comment.