2
0
mirror of https://codeberg.org/kiss-community/repo synced 2025-01-10 04:40:09 -07:00
repo/extra/mold/patches/amd64_only.patch

129 lines
4.1 KiB
Diff
Raw Normal View History

2022-09-27 11:10:15 -06:00
diff --git a/CMakeLists.txt b/CMakeLists.txt
2024-12-12 16:32:30 -07:00
index aff8fc6..9790e28 100644
2022-09-27 11:10:15 -06:00
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
2024-12-12 16:32:30 -07:00
@@ -310,14 +310,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
2022-11-12 23:22:42 -07:00
# compiler instances. This is hacky but greatly reduces compile time
# on a multicore machine.
2022-09-27 11:10:15 -06:00
list(APPEND MOLD_ELF_TARGETS
2024-12-12 16:32:30 -07:00
- X86_64 I386 ARM64LE ARM64BE ARM32 RV32LE RV32BE RV64LE RV64BE PPC32
- PPC64V1 PPC64V2 S390X SPARC64 M68K SH4LE SH4BE LOONGARCH32 LOONGARCH64)
2022-09-27 11:10:15 -06:00
+ X86_64)
list(APPEND MOLD_ELF_TEMPLATE_FILES
2024-12-12 16:32:30 -07:00
- src/arch-arm64.cc
2024-09-24 23:28:30 -06:00
- src/arch-loongarch.cc
- src/arch-riscv.cc
2024-12-12 16:32:30 -07:00
- src/arch-sh4.cc
2024-09-24 23:28:30 -06:00
src/cmdline.cc
2024-12-12 16:32:30 -07:00
src/filetype.cc
2024-09-24 23:28:30 -06:00
src/gc-sections.cc
2024-12-12 16:32:30 -07:00
@@ -385,14 +380,6 @@ target_sources(mold PRIVATE
2024-09-24 23:28:30 -06:00
lib/perf.cc
lib/random.cc
lib/tar.cc
- src/arch-arm32.cc
- src/arch-i386.cc
- src/arch-m68k.cc
- src/arch-ppc32.cc
- src/arch-ppc64v1.cc
- src/arch-ppc64v2.cc
- src/arch-s390x.cc
- src/arch-sparc64.cc
src/arch-x86-64.cc
src/config.cc
src/elf.cc
diff --git a/src/main.cc b/src/main.cc
2024-12-12 16:32:30 -07:00
index 4674b1c..b1ca4cb 100644
2024-09-24 23:28:30 -06:00
--- a/src/main.cc
+++ b/src/main.cc
2024-12-12 16:32:30 -07:00
@@ -290,11 +290,6 @@ int mold_main(int argc, char **argv) {
2023-01-06 21:05:46 -07:00
if (ctx.arg.emulation.empty())
2024-05-04 12:24:42 -06:00
ctx.arg.emulation = detect_machine_type(ctx, file_args);
2022-09-27 11:10:15 -06:00
- // Redo if -m is not x86-64.
2023-01-06 21:05:46 -07:00
- if constexpr (is_x86_64<E>)
2024-12-12 16:32:30 -07:00
- if (ctx.arg.emulation != X86_64::name)
2023-10-18 16:59:13 -06:00
- return redo_main(ctx, argc, argv);
2022-09-27 11:10:15 -06:00
-
Timer t_all(ctx, "all");
install_signal_handler();
2024-09-24 23:28:30 -06:00
diff --git a/src/mold.h b/src/mold.h
2024-12-12 16:32:30 -07:00
index ce74a26..079c0a8 100644
2024-09-24 23:28:30 -06:00
--- a/src/mold.h
+++ b/src/mold.h
2024-12-12 16:32:30 -07:00
@@ -1603,7 +1603,6 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx);
2023-10-18 16:59:13 -06:00
// passes.cc
//
-template <typename E> int redo_main(Context<E> &, int argc, char **argv);
template <typename E> void create_internal_file(Context<E> &);
template <typename E> void apply_exclude_libs(Context<E> &);
template <typename E> void create_synthetic_sections(Context<E> &);
2024-09-24 23:28:30 -06:00
diff --git a/src/passes.cc b/src/passes.cc
2024-12-12 16:32:30 -07:00
index aeac428..078f43a 100644
2024-09-24 23:28:30 -06:00
--- a/src/passes.cc
+++ b/src/passes.cc
2024-12-12 16:32:30 -07:00
@@ -14,52 +14,6 @@
2023-10-18 16:59:13 -06:00
2024-09-24 23:28:30 -06:00
namespace mold {
2023-10-18 16:59:13 -06:00
2024-09-24 23:28:30 -06:00
-// Since mold_main is a template, we can't run it without a type parameter.
-// We speculatively run mold_main with X86_64, and if the speculation was
2023-10-18 16:59:13 -06:00
-// wrong, re-run it with an actual machine type.
-template <typename E>
-int redo_main(Context<E> &ctx, int argc, char **argv) {
- std::string_view target = ctx.arg.emulation;
-
2024-12-12 16:32:30 -07:00
- if (target == I386::name)
2024-09-24 23:28:30 -06:00
- return mold_main<I386>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == ARM64LE::name)
- return mold_main<ARM64LE>(argc, argv);
- if (target == ARM64BE::name)
- return mold_main<ARM64BE>(argc, argv);
- if (target == ARM32::name)
2024-09-24 23:28:30 -06:00
- return mold_main<ARM32>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == RV64LE::name)
2024-09-24 23:28:30 -06:00
- return mold_main<RV64LE>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == RV64BE::name)
2024-09-24 23:28:30 -06:00
- return mold_main<RV64BE>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == RV32LE::name)
2024-09-24 23:28:30 -06:00
- return mold_main<RV32LE>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == RV32BE::name)
2024-09-24 23:28:30 -06:00
- return mold_main<RV32BE>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == PPC32::name)
2024-09-24 23:28:30 -06:00
- return mold_main<PPC32>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == PPC64V1::name)
2024-09-24 23:28:30 -06:00
- return mold_main<PPC64V1>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == PPC64V2::name)
2024-09-24 23:28:30 -06:00
- return mold_main<PPC64V2>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == S390X::name)
2024-09-24 23:28:30 -06:00
- return mold_main<S390X>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == SPARC64::name)
2024-09-24 23:28:30 -06:00
- return mold_main<SPARC64>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == M68K::name)
2024-09-24 23:28:30 -06:00
- return mold_main<M68K>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == SH4LE::name)
- return mold_main<SH4LE>(argc, argv);
- if (target == SH4BE::name)
- return mold_main<SH4BE>(argc, argv);
- if (target == LOONGARCH32::name)
2024-09-24 23:28:30 -06:00
- return mold_main<LOONGARCH32>(argc, argv);
2024-12-12 16:32:30 -07:00
- if (target == LOONGARCH64::name)
2024-09-24 23:28:30 -06:00
- return mold_main<LOONGARCH64>(argc, argv);
2023-10-18 16:59:13 -06:00
- unreachable();
-}
-
template <typename E>
void apply_exclude_libs(Context<E> &ctx) {
Timer t(ctx, "apply_exclude_libs");
2024-12-12 16:32:30 -07:00
@@ -3222,7 +3176,6 @@ void show_stats(Context<E> &ctx) {
2023-10-18 16:59:13 -06:00
using E = MOLD_TARGET;
-template int redo_main(Context<E> &, int, char **);
template void create_internal_file(Context<E> &);
template void apply_exclude_libs(Context<E> &);
template void create_synthetic_sections(Context<E> &);