summaryrefslogtreecommitdiff
path: root/platform/linux/platform_linux.cpp
diff options
context:
space:
mode:
authorAlexander Taylor <alex@vector35.com>2025-02-25 20:32:24 -0500
committerAlexander Taylor <alex@vector35.com>2025-03-10 11:12:09 -0400
commit1fc3cd833f19ffa534f04caf541e88042124fd91 (patch)
tree772b0c73d87d7831dcd94f53bb4b2d4f1e429c98 /platform/linux/platform_linux.cpp
parent32455f977824cf50ec0049cad16e741f0d050c73 (diff)
Remove platform registration API footgun.
Turns out, you can just pass this thing an architecture that is *completely* different from the one in the platform you are also passing in and it'll just happily do the wrong thing. While that's pretty wild, I'm in favor of not having to make this particular mistake again the next time I copy/paste some code, so we're now deprecating it.
Diffstat (limited to 'platform/linux/platform_linux.cpp')
-rw-r--r--platform/linux/platform_linux.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/platform/linux/platform_linux.cpp b/platform/linux/platform_linux.cpp
index 2ba346f8..3bbb7248 100644
--- a/platform/linux/platform_linux.cpp
+++ b/platform/linux/platform_linux.cpp
@@ -307,8 +307,8 @@ extern "C"
platform = new LinuxX86Platform(x86);
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, x86, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, x86, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
Ref<Architecture> x64 = Architecture::GetByName("x86_64");
@@ -319,8 +319,8 @@ extern "C"
platform = new LinuxX64Platform(x64);
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, x64, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, x64, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
Ref<Architecture> armv7 = Architecture::GetByName("armv7");
@@ -344,10 +344,10 @@ extern "C"
Platform::Register("linux", armebPlatform);
Platform::Register("linux", thumbebPlatform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, armv7, armPlatform);
- BinaryViewType::RegisterPlatform("ELF", 3, armv7, armPlatform);
- BinaryViewType::RegisterPlatform("ELF", 0, armv7eb, armebPlatform);
- BinaryViewType::RegisterPlatform("ELF", 3, armv7eb, armebPlatform);
+ BinaryViewType::RegisterPlatform("ELF", 0, armPlatform);
+ BinaryViewType::RegisterPlatform("ELF", 3, armPlatform);
+ BinaryViewType::RegisterPlatform("ELF", 0, armebPlatform);
+ BinaryViewType::RegisterPlatform("ELF", 3, armebPlatform);
}
Ref<Architecture> arm64 = Architecture::GetByName("aarch64");
@@ -358,8 +358,8 @@ extern "C"
platform = new LinuxArm64Platform(arm64);
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, arm64, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, arm64, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
Ref<Architecture> ppc = Architecture::GetByName("ppc");
@@ -374,10 +374,10 @@ extern "C"
Platform::Register("linux", platform);
Platform::Register("linux", platformle);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, ppc, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, ppc, platform);
- BinaryViewType::RegisterPlatform("ELF", 0, ppcle, platformle);
- BinaryViewType::RegisterPlatform("ELF", 3, ppcle, platformle);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platformle);
+ BinaryViewType::RegisterPlatform("ELF", 3, platformle);
}
Ref<Architecture> ppc64 = Architecture::GetByName("ppc64");
@@ -392,10 +392,10 @@ extern "C"
Platform::Register("linux", platform);
Platform::Register("linux", platformle);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, ppc64, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, ppc64, platform);
- BinaryViewType::RegisterPlatform("ELF", 0, ppc64le, platformle);
- BinaryViewType::RegisterPlatform("ELF", 3, ppc64le, platformle);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platformle);
+ BinaryViewType::RegisterPlatform("ELF", 3, platformle);
}
Ref<Architecture> mipsel = Architecture::GetByName("mipsel32");
@@ -421,18 +421,18 @@ extern "C"
Platform::Register("linux", platformBE64);
Platform::Register("linux", platformBE64cn);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, mipsel, platformLE);
- BinaryViewType::RegisterPlatform("ELF", 0, mipseb, platformBE);
- BinaryViewType::RegisterPlatform("ELF", 0, mips3el, platform3LE);
- BinaryViewType::RegisterPlatform("ELF", 0, mips3eb, platform3BE);
- BinaryViewType::RegisterPlatform("ELF", 0, mips64eb, platformBE64);
- BinaryViewType::RegisterPlatform("ELF", 0, cnmips64eb, platformBE64cn);
- BinaryViewType::RegisterPlatform("ELF", 3, mipsel, platformLE);
- BinaryViewType::RegisterPlatform("ELF", 3, mipseb, platformBE);
- BinaryViewType::RegisterPlatform("ELF", 3, mips3el, platform3LE);
- BinaryViewType::RegisterPlatform("ELF", 3, mips3eb, platform3BE);
- BinaryViewType::RegisterPlatform("ELF", 3, mips64eb, platformBE64);
- BinaryViewType::RegisterPlatform("ELF", 3, cnmips64eb, platformBE64cn);
+ BinaryViewType::RegisterPlatform("ELF", 0, platformLE);
+ BinaryViewType::RegisterPlatform("ELF", 0, platformBE);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform3LE);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform3BE);
+ BinaryViewType::RegisterPlatform("ELF", 0, platformBE64);
+ BinaryViewType::RegisterPlatform("ELF", 0, platformBE64cn);
+ BinaryViewType::RegisterPlatform("ELF", 3, platformLE);
+ BinaryViewType::RegisterPlatform("ELF", 3, platformBE);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform3LE);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform3BE);
+ BinaryViewType::RegisterPlatform("ELF", 3, platformBE64);
+ BinaryViewType::RegisterPlatform("ELF", 3, platformBE64cn);
}
Ref<Architecture> rv32 = Architecture::GetByName("rv32gc");
@@ -443,8 +443,8 @@ extern "C"
platform = new LinuxRiscVPlatform(rv32, "linux-rv32gc");
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, rv32, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, rv32, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
Ref<Architecture> rv64 = Architecture::GetByName("rv64gc");
@@ -455,8 +455,8 @@ extern "C"
platform = new LinuxRiscVPlatform(rv64, "linux-rv64gc");
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, rv64, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, rv64, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
#ifdef ULTIMATE_EDITION
@@ -468,8 +468,8 @@ extern "C"
platform = new LinuxCSkyV1Platform(cskyv1, "linux-csky_le_v1");
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, cskyv1, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, cskyv1, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
Ref<Architecture> cskyv2 = Architecture::GetByName("csky_le");
@@ -480,8 +480,8 @@ extern "C"
platform = new LinuxCSkyV2Platform(cskyv2, "linux-csky_le");
Platform::Register("linux", platform);
// Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
- BinaryViewType::RegisterPlatform("ELF", 0, cskyv2, platform);
- BinaryViewType::RegisterPlatform("ELF", 3, cskyv2, platform);
+ BinaryViewType::RegisterPlatform("ELF", 0, platform);
+ BinaryViewType::RegisterPlatform("ELF", 3, platform);
}
#endif