@@ -580,8 +580,7 @@ void SectionChunk::getBaserels(std::vector<Baserel> *res) {
580580// another DLL) This returns the size the relocation is supposed to update,
581581// in bits, or 0 if the relocation cannot be handled as a runtime pseudo
582582// relocation.
583- static int getRuntimePseudoRelocSize (uint16_t type,
584- llvm::COFF::MachineTypes machine) {
583+ static int getRuntimePseudoRelocSize (uint16_t type, Triple::ArchType arch) {
585584 // Relocations that either contain an absolute address, or a plain
586585 // relative offset, since the runtime pseudo reloc implementation
587586 // adds 8/16/32/64 bit values to a memory address.
@@ -607,8 +606,8 @@ static int getRuntimePseudoRelocSize(uint16_t type,
607606 // the image, or temporarily changed at runtime with VirtualProtect.
608607 // Since this only operates on direct address values, it doesn't work for
609608 // ARM/ARM64 relocations, other than the plain ADDR32/ADDR64 relocations.
610- switch (machine ) {
611- case AMD64 :
609+ switch (arch ) {
610+ case Triple::x86_64 :
612611 switch (type) {
613612 case IMAGE_REL_AMD64_ADDR64:
614613 return 64 ;
@@ -623,22 +622,22 @@ static int getRuntimePseudoRelocSize(uint16_t type,
623622 default :
624623 return 0 ;
625624 }
626- case I386 :
625+ case Triple::x86 :
627626 switch (type) {
628627 case IMAGE_REL_I386_DIR32:
629628 case IMAGE_REL_I386_REL32:
630629 return 32 ;
631630 default :
632631 return 0 ;
633632 }
634- case ARMNT :
633+ case Triple::thumb :
635634 switch (type) {
636635 case IMAGE_REL_ARM_ADDR32:
637636 return 32 ;
638637 default :
639638 return 0 ;
640639 }
641- case ARM64 :
640+ case Triple::aarch64 :
642641 switch (type) {
643642 case IMAGE_REL_ARM64_ADDR64:
644643 return 64 ;
@@ -671,8 +670,7 @@ void SectionChunk::getRuntimePseudoRelocs(
671670 // alive. Thus such dangling references in DWARF sections are expected.
672671 if (!target->getChunk ())
673672 continue ;
674- int sizeInBits =
675- getRuntimePseudoRelocSize (rel.Type , file->ctx .config .machine );
673+ int sizeInBits = getRuntimePseudoRelocSize (rel.Type , getArch ());
676674 if (sizeInBits == 0 ) {
677675 error (" unable to automatically import from " + target->getName () +
678676 " with relocation type " +
0 commit comments