[clang] [MinGW] MinGW dynamicbase (PR #74979)
https://github.com/xu-chiheng closed https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
xu-chiheng wrote: > > In Cygwin with binutils 2.41, --dynamicbase make a difference, so I thought > > MinGW also need it. > > No, MinGW does not need it, as it has been enabled by default since binutils > 2.36. > > Apparently that change, > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=514b4e191d5f46de8e142fe216e677a35fa9c4bb, > didn't apply to Cygwin but only to MinGW. But if Cygwin works with > dynamicbase (I think it might have issues with it but I'm not sure?) then > perhaps binutils should be changed to enable dynamicbase by default there, > instead of changing compilers to pass the option by default. Cygwin GCC and Clang must use dynamicbase, otherwise, there are errors like : 0 [main] clang-17 1506 child_info_fork::abort: \??\D:\cygwin64-packages\clang\bin\cygclangLex-17git.dll: Loaded to different address: parent(0x16E) != child(0x5C12D) clang++: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable 0 [main] clang-17 1507 child_info_fork::abort: \??\D:\cygwin64-packages\clang\bin\cygLLVMRISCVCodeGen-17git.dll: Loaded to different address: parent(0xE6) != child(0xEC) clang++: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
mstorsjo wrote: > > Also > > In Cygwin with binutils 2.41, --dynamicbase make a difference, so I thought > MinGW also need it. No, MinGW does not need it, as it has been enabled by default since binutils 2.36. Apparently that change, https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=514b4e191d5f46de8e142fe216e677a35fa9c4bb, didn't apply to Cygwin but only to MinGW. But if Cygwin works with dynamicbase (I think it might have issues with it but I'm not sure?) then perhaps binutils should be changed to enable dynamicbase by default there, instead of changing compilers to pass the option by default. https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
xu-chiheng wrote: > Also In Cygwin with binutils 2.41, --dynamicbase make a difference, so I thought MinGW also need it. https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
https://github.com/mstorsjo requested changes to this pull request. No, you do not need to do this. There's no need to add `--dynamicbase` manually in Clang. As I already posted, both ld.bfd and ld.lld default to `--dynamicbase` enabled since 2020. https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/74979 From e08d12df9f987ad4cf025d4bf1896acf2deea859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sun, 10 Dec 2023 15:03:28 +0800 Subject: [PATCH 1/2] 1 --- clang/lib/Driver/ToolChains/MinGW.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 5d7f8675daf8d2..50181837d39399 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -165,6 +165,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("DllMainCRTStartup"); CmdArgs.push_back("--enable-auto-image-base"); } + CmdArgs.push_back("--dynamicbase"); if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle)) CmdArgs.push_back("--no-demangle"); From b7383e3b85acae68c69c7db2091356cb27067ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Wed, 13 Dec 2023 02:58:47 +0800 Subject: [PATCH 2/2] 1 --- clang/lib/Driver/ToolChains/MinGW.cpp | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 50181837d39399..0e51a427a66af0 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -165,7 +165,13 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("DllMainCRTStartup"); CmdArgs.push_back("--enable-auto-image-base"); } - CmdArgs.push_back("--dynamicbase"); + switch (TC.getArch()) { + case llvm::Triple::x86_64: +CmdArgs.push_back("--dynamicbase"); +break; + case llvm::Triple::aarch64: +break; + } if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle)) CmdArgs.push_back("--no-demangle"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
https://github.com/mstorsjo requested changes to this pull request. This is not necessary. Since 514b4e191d5f46de8e142fe216e677a35fa9c4bb in binutils (https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=514b4e191d5f46de8e142fe216e677a35fa9c4bb), dynamicbase is enabled by default. Also since e72403f96de7f1c681acd5968f72aa986412dfce in llvm-project, LLD also does the same. https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
llvmbot wrote: @llvm/pr-subscribers-clang Author: 徐持恒 Xu Chiheng (xu-chiheng) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/74979.diff 1 Files Affected: - (modified) clang/lib/Driver/ToolChains/MinGW.cpp (+1) ``diff diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 5d7f8675daf8d2..50181837d39399 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -165,6 +165,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("DllMainCRTStartup"); CmdArgs.push_back("--enable-auto-image-base"); } + CmdArgs.push_back("--dynamicbase"); if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle)) CmdArgs.push_back("--no-demangle"); `` https://github.com/llvm/llvm-project/pull/74979 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [MinGW] MinGW dynamicbase (PR #74979)
https://github.com/xu-chiheng created https://github.com/llvm/llvm-project/pull/74979 None From e08d12df9f987ad4cf025d4bf1896acf2deea859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?= Date: Sun, 10 Dec 2023 15:03:28 +0800 Subject: [PATCH] 1 --- clang/lib/Driver/ToolChains/MinGW.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp index 5d7f8675daf8d2..50181837d39399 100644 --- a/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/clang/lib/Driver/ToolChains/MinGW.cpp @@ -165,6 +165,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("DllMainCRTStartup"); CmdArgs.push_back("--enable-auto-image-base"); } + CmdArgs.push_back("--dynamicbase"); if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle)) CmdArgs.push_back("--no-demangle"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits