mold icon indicating copy to clipboard operation
mold copied to clipboard

copy-dt-needed-entries

Open ewellthorpe opened this issue 3 years ago • 2 comments

mold version 1.2.1 does not recognize the option: copy-dt-needed-entries when provided as an argument to gcc 10.3.0 as -Wl,--copy-dt-needed-entries.

Please could you let me know if there is a workaround

Thank you

ewellthorpe avatar Jun 03 '22 00:06 ewellthorpe

We want to support this flag.

rui314 avatar Jun 04 '22 02:06 rui314

This option doesn't make sense and the converse (--no-copy-dt-needed-entries) has been the GNU ld default for a very long time (around 2.22/2.23). I am not even sure what software still uses this option.

MaskRay avatar Jun 26 '22 23:06 MaskRay

@ewellthorpe As @MaskRay said, can you first try to just remove the flag from your command line? If it doesn't work for you, please reopen this issue.

rui314 avatar Aug 17 '22 03:08 rui314

The blender build tool-chain or at least one from aur (blender-git) uses this flag and fails if i use mold. As far as i can tell this is part of compiler testing, so it might be more widespread.

loading initial cache file /home/user/.cache/paru/clone/blender-git/src/blender/build_files/cmake/config/blender_release.cmake
-- The C compiler identification is Clang 15.0.7
-- The CXX compiler identification is Clang 15.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/usr/bin/clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/user/.cache/paru/clone/blender-git/src/build/CMakeFiles/CMakeScratch/TryCompile-EZRS21
    
    Run Build Command(s):/usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_173b0/fast && /usr/bin/make  -f CMakeFiles/cmTC_173b0.dir/build.make CMakeFiles/cmTC_173b0.dir/build
    make[1]: Entering directory '/home/user/.cache/paru/clone/blender-git/src/build/CMakeFiles/CMakeScratch/TryCompile-EZRS21'
    Building C object CMakeFiles/cmTC_173b0.dir/testCCompiler.c.o
    /usr/bin/clang   -march=native -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -MD -MT CMakeFiles/cmTC_173b0.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_173b0.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_173b0.dir/testCCompiler.c.o -c /home/user/.cache/paru/clone/blender-git/src/build/CMakeFiles/CMakeScratch/TryCompile-EZRS21/testCCompiler.c
    Linking C executable cmTC_173b0
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_173b0.dir/link.txt --verbose=1
    /usr/bin/clang -march=native -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -Wl,--copy-dt-needed-entries -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now --ld-path=/usr/bin/mold -flto=auto  CMakeFiles/cmTC_173b0.dir/testCCompiler.c.o -o cmTC_173b0 
    mold: fatal: unknown command line option: --copy-dt-needed-entries
    clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [CMakeFiles/cmTC_173b0.dir/build.make:100: cmTC_173b0] Error 1
    make[1]: Leaving directory '/home/user/.cache/paru/clone/blender-git/src/build/CMakeFiles/CMakeScratch/TryCompile-EZRS21'
    make: *** [Makefile:127: cmTC_173b0/fast] Error 2
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:108 (project)


-- Configuring incomplete, errors occurred!
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build 'blender-git-3.6.r123907.g98334b8f7df-1': 
error: packages failed to build: blender-git-3.6.r123907.g98334b8f7df-1

ghost avatar Jun 19 '23 21:06 ghost

Patch to just ignore this option

diff --git a/elf/cmdline.cc b/elf/cmdline.cc
index b97ca74f..b6017b17 100644
--- a/elf/cmdline.cc
+++ b/elf/cmdline.cc
@@ -1114,6 +1114,7 @@ std::vector<std::string> parse_nonpositional_args(Context<E> &ctx) {
     } else if (read_z_flag("combreloc")) {
     } else if (read_z_flag("nocombreloc")) {
     } else if (read_z_arg("common-page-size")) {
+    } else if (read_flag("copy-dt-needed-entries")) {
     } else if (read_flag("no-keep-memory")) {
     } else if (read_arg("max-cache-size")) {
     } else if (read_arg("version-script")) {

inferrna avatar Dec 28 '23 07:12 inferrna