mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-29 08:31:13 +00:00
[Mips] Make "emulation" option less dependent on the "-target" option.
Now it is possible to have mips-linux-gnu-ld executable and link MIPS 64-bit little-endian binaries providing -melf64ltsmip command line argument. llvm-svn: 246335
This commit is contained in:
parent
6d39140b6e
commit
f12120cfe9
@ -165,19 +165,15 @@ getArchType(const llvm::Triple &triple, StringRef value) {
|
||||
return llvm::Triple::x86_64;
|
||||
return llvm::None;
|
||||
case llvm::Triple::mips:
|
||||
case llvm::Triple::mips64:
|
||||
if (value == "elf32btsmip")
|
||||
return llvm::Triple::mips;
|
||||
if (value == "elf64btsmip")
|
||||
return llvm::Triple::mips64;
|
||||
return llvm::None;
|
||||
case llvm::Triple::mipsel:
|
||||
case llvm::Triple::mips64:
|
||||
case llvm::Triple::mips64el:
|
||||
if (value == "elf32ltsmip")
|
||||
return llvm::Triple::mipsel;
|
||||
if (value == "elf64ltsmip")
|
||||
return llvm::Triple::mips64el;
|
||||
return llvm::None;
|
||||
return llvm::StringSwitch<llvm::Optional<llvm::Triple::ArchType>>(value)
|
||||
.Case("elf32btsmip", llvm::Triple::mips)
|
||||
.Case("elf32ltsmip", llvm::Triple::mipsel)
|
||||
.Case("elf64btsmip", llvm::Triple::mips64)
|
||||
.Case("elf64ltsmip", llvm::Triple::mips64el)
|
||||
.Default(llvm::None);
|
||||
case llvm::Triple::aarch64:
|
||||
if (value == "aarch64linux")
|
||||
return llvm::Triple::aarch64;
|
||||
|
@ -199,6 +199,16 @@ TEST_F(GnuLdParserTest, AsNeeded) {
|
||||
EXPECT_FALSE(cast<FileNode>(nodes[3].get())->asNeeded());
|
||||
}
|
||||
|
||||
// Emulation
|
||||
|
||||
TEST_F(GnuLdParserTest, Emulation) {
|
||||
EXPECT_TRUE(parse("mips-linux-gnu-ld", "a.o", "-m", "elf64ltsmip", nullptr));
|
||||
EXPECT_EQ(Triple::mips64el, _ctx->getTriple().getArch());
|
||||
EXPECT_TRUE(
|
||||
parse("mips64el-linux-gnu-ld", "a.o", "-m", "elf32btsmip", nullptr));
|
||||
EXPECT_EQ(Triple::mips, _ctx->getTriple().getArch());
|
||||
}
|
||||
|
||||
// Linker script
|
||||
|
||||
TEST_F(LinkerScriptTest, Input) {
|
||||
|
Loading…
Reference in New Issue
Block a user