2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-11-17 04:00:14 -07:00
repo/extra/mold/patches/elf_amd64_only.patch
2022-09-27 12:10:15 -05:00

117 lines
3.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dcbfc2d..d5b3d71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,7 +183,7 @@ add_dependencies(mold git_hash)
# As a workaround, we create a .cc file for each target and spawn many
# compiler instances. This is hacky but greatly reduces compile time.
list(APPEND MOLD_ELF_TARGETS
- X86_64 I386 ARM64 ARM32 RV32LE RV32BE RV64LE RV64BE PPC64V2 SPARC64)
+ X86_64)
list(APPEND MOLD_ELF_TEMPLATE_FILES
elf/cmdline.cc
@@ -203,20 +203,6 @@ list(APPEND MOLD_ELF_TEMPLATE_FILES
elf/thunks.cc
)
-list(APPEND MOLD_MACHO_TARGETS X86_64 ARM64)
-
-list(APPEND MOLD_MACHO_TEMPLATE_FILES
- macho/cmdline.cc
- macho/dead-strip.cc
- macho/input-files.cc
- macho/input-sections.cc
- macho/lto.cc
- macho/main.cc
- macho/mapfile.cc
- macho/output-chunks.cc
- macho/tapi.cc
- )
-
function(mold_instantiate_templates SOURCE TARGET)
set(PATH ${CMAKE_BINARY_DIR}/${SOURCE}.${TARGET}.cc)
file(WRITE ${PATH} "#define MOLD_${TARGET} 1
@@ -232,30 +218,15 @@ foreach (SOURCE IN LISTS MOLD_ELF_TEMPLATE_FILES)
endforeach()
endforeach()
-foreach (SOURCE IN LISTS MOLD_MACHO_TEMPLATE_FILES)
- foreach(TARGET IN LISTS MOLD_MACHO_TARGETS)
- mold_instantiate_templates(${SOURCE} ${TARGET})
- endforeach()
-endforeach()
-
# Add other non-template source files.
target_sources(mold PRIVATE
compress.cc
demangle.cc
- elf/arch-arm32.cc
- elf/arch-arm64.cc
- elf/arch-i386.cc
- elf/arch-ppc64v2.cc
- elf/arch-riscv.cc
- elf/arch-sparc64.cc
elf/arch-x86-64.cc
filepath.cc
git-hash.cc
glob.cc
hyperloglog.cc
- macho/arch-arm64.cc
- macho/arch-x86-64.cc
- macho/yaml.cc
main.cc
multi-glob.cc
perf.cc
diff --git a/elf/main.cc b/elf/main.cc
index b63bba6..c46ffc9 100644
--- a/elf/main.cc
+++ b/elf/main.cc
@@ -388,33 +388,6 @@ int elf_main(int argc, char **argv) {
if (ctx.arg.emulation == MachineType::NONE)
ctx.arg.emulation = deduce_machine_type(ctx, file_args);
- // Redo if -m is not x86-64.
- if (ctx.arg.emulation != E::machine_type) {
- switch (ctx.arg.emulation) {
- case MachineType::I386:
- return elf_main<I386>(argc, argv);
- case MachineType::ARM64:
- return elf_main<ARM64>(argc, argv);
- case MachineType::ARM32:
- return elf_main<ARM32>(argc, argv);
- case MachineType::RV64LE:
- return elf_main<RV64LE>(argc, argv);
- case MachineType::RV64BE:
- return elf_main<RV64BE>(argc, argv);
- case MachineType::RV32LE:
- return elf_main<RV32LE>(argc, argv);
- case MachineType::RV32BE:
- return elf_main<RV32BE>(argc, argv);
- case MachineType::PPC64V2:
- return elf_main<PPC64V2>(argc, argv);
- case MachineType::SPARC64:
- return elf_main<SPARC64>(argc, argv);
- default:
- unreachable();
- }
- unreachable();
- }
-
Timer t_all(ctx, "all");
install_signal_handler();
diff --git a/main.cc b/main.cc
index 0f78eff..b4002f8 100644
--- a/main.cc
+++ b/main.cc
@@ -108,8 +108,5 @@ i64 get_default_thread_count() {
int main(int argc, char **argv) {
mold::mold_version = mold::get_mold_version();
- std::string cmd = mold::filepath(argv[0]).filename().string();
- if (cmd == "ld64" || cmd == "ld64.mold")
- return mold::macho::main(argc, argv);
return mold::elf::main(argc, argv);
}