-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang][MIPS] Add support for mipsel-windows-* targets #107744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
193f3d3
f99b2ea
db61c91
38bcda6
b02203d
95a56b6
40f4c9a
d6ce440
965c46d
607f719
e6157bb
fda9245
9deeff4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1132,6 +1132,8 @@ StringRef COFFObjectFile::getFileFormatName() const { | |
| return "COFF-ARM64EC"; | ||
| case COFF::IMAGE_FILE_MACHINE_ARM64X: | ||
| return "COFF-ARM64X"; | ||
| case COFF::IMAGE_FILE_MACHINE_R4000: | ||
| return "COFF-R4000"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, do we want to label this as I see that there are a couple other If the R4000 is the only one that actually is being used, I'd almost go with labelling this just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I asked Microsoft for clarification but no response so far: MicrosoftDocs/win32#1846 |
||
| default: | ||
| return "COFF-<unknown arch>"; | ||
| } | ||
|
|
@@ -1465,6 +1467,27 @@ StringRef COFFObjectFile::getRelocationTypeName(uint16_t Type) const { | |
| return "Unknown"; | ||
| } | ||
| break; | ||
| case Triple::mipsel: | ||
| switch (Type) { | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_ABSOLUTE); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_REFHALF); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_REFWORD); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_JMPADDR); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_REFHI); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_REFLO); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_GPREL); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_LITERAL); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_SECTION); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_SECREL); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_SECRELLO); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_SECRELHI); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_JMPADDR16); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_REFWORDNB); | ||
| LLVM_COFF_SWITCH_RELOC_TYPE_NAME(IMAGE_REL_MIPS_PAIR); | ||
| default: | ||
| return "Unknown"; | ||
| } | ||
| break; | ||
| default: | ||
| return "Unknown"; | ||
| } | ||
|
|
@@ -2326,6 +2349,9 @@ ResourceSectionRef::getContents(const coff_resource_data_entry &Entry) { | |
| case Triple::aarch64: | ||
| RVAReloc = COFF::IMAGE_REL_ARM64_ADDR32NB; | ||
| break; | ||
| case Triple::mipsel: | ||
| RVAReloc = COFF::IMAGE_REL_MIPS_REFWORDNB; | ||
| break; | ||
| default: | ||
| return createStringError(object_error::parse_failed, | ||
| "unsupported architecture"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ COFF::MachineTypes llvm::getMachineType(StringRef S) { | |
| .Case("arm64", COFF::IMAGE_FILE_MACHINE_ARM64) | ||
| .Case("arm64ec", COFF::IMAGE_FILE_MACHINE_ARM64EC) | ||
| .Case("arm64x", COFF::IMAGE_FILE_MACHINE_ARM64X) | ||
| .Case("mips", COFF::IMAGE_FILE_MACHINE_R4000) // also handle mips (big-endian) because we want to support '/machine:MIPS' | ||
| .Case("mipsel", COFF::IMAGE_FILE_MACHINE_R4000) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should accept This switch is only for mapping arch names from the MS tool It's just that arch names in different namespaces can mean different things. In MS tools, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI |
||
| .Default(COFF::IMAGE_FILE_MACHINE_UNKNOWN); | ||
| } | ||
|
|
||
|
|
@@ -45,6 +47,8 @@ StringRef llvm::machineToStr(COFF::MachineTypes MT) { | |
| return "x64"; | ||
| case COFF::IMAGE_FILE_MACHINE_I386: | ||
| return "x86"; | ||
| case COFF::IMAGE_FILE_MACHINE_R4000: | ||
| return "mipsel"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems wrong - this should return the canonical name for the |
||
| default: | ||
| llvm_unreachable("unknown machine type"); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,10 +16,10 @@ | |
|
|
||
| using namespace llvm; | ||
|
|
||
| void MipsMCAsmInfo::anchor() { } | ||
| void MipsELFMCAsmInfo::anchor() { } | ||
|
|
||
| MipsMCAsmInfo::MipsMCAsmInfo(const Triple &TheTriple, | ||
| const MCTargetOptions &Options) { | ||
| MipsELFMCAsmInfo::MipsELFMCAsmInfo(const Triple &TheTriple, | ||
| const MCTargetOptions &Options) { | ||
| IsLittleEndian = TheTriple.isLittleEndian(); | ||
|
|
||
| MipsABIInfo ABI = MipsABIInfo::computeTargetABI(TheTriple, "", Options); | ||
|
|
@@ -51,3 +51,25 @@ MipsMCAsmInfo::MipsMCAsmInfo(const Triple &TheTriple, | |
| DwarfRegNumForCFI = true; | ||
| HasMipsExpressions = true; | ||
| } | ||
|
|
||
| void MipsCOFFMCAsmInfoMicrosoft::anchor() { } | ||
|
|
||
| MipsCOFFMCAsmInfoMicrosoft::MipsCOFFMCAsmInfoMicrosoft() { | ||
| WinEHEncodingType = WinEH::EncodingType::Itanium; | ||
| CommentString = ";"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, I would recommend against using While this is the asm dialect for Microsoft variants, this still is within the scope of GNU assembler style, produced and consumed by clang and For the full standalone Microsoft style assembly, on x86 we have the separate |
||
|
|
||
| ExceptionsType = ExceptionHandling::WinEH; | ||
|
|
||
| AllowAtInName = true; | ||
| } | ||
|
|
||
| void MipsCOFFMCAsmInfoGNU::anchor() { } | ||
|
|
||
| MipsCOFFMCAsmInfoGNU::MipsCOFFMCAsmInfoGNU() { | ||
| HasSingleParameterDotFile = true; | ||
| WinEHEncodingType = WinEH::EncodingType::Itanium; | ||
|
|
||
| ExceptionsType = ExceptionHandling::WinEH; | ||
|
|
||
| AllowAtInName = true; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part (adding a yet-unused shorthand in lld/COFF/Config.h) of this commit (primarily llvm/lib/Object stuff) seems unrelated and should be moved to a later commit.