Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R_X86_64_64 relocation against symbol `__gxx_personality_v0' can not be used #271

Closed
mrichtarsky opened this issue Jan 14, 2022 · 6 comments

Comments

@mrichtarsky
Copy link
Contributor

Hi,

first, thanks for the great linker, which provides speedups I didn't deem possible on Linux x86 (I'm seeing factor 7 over gold).

I'm getting this error when linking a static library generated by ICC with other GCC binaries. Granted, it's a bit strange to do this on static library/object boundaries, but at least it works with gold. Is there something that rings a bell why this would not work? The files in the library were compiled with -fPIC.

mold: warning: libsse_icc.a(searchbv.cpp.o):(.gnu.linkonce.d.DW.ref.__gxx_personality_v0): R_X86_64_64 relocation against symbol `__gxx_personality_v0' can not be used; recompile with -fPIC

The message is thrown from input-sections.cc with the following context:

get_sym_type(): 3
get_output_type(): 0
action: DYNREL

Thanks and best regards,
Martin

@rui314
Copy link
Owner

rui314 commented Jan 14, 2022

Thank you for reporting the issue!

If you can share searchbv.cpp.o or any other object file mold was complaining to, can you attach that file here? I'd like to take a closer look.

@rui314
Copy link
Owner

rui314 commented Jan 20, 2022

.gnu.linkonce is a old feature for so-called vague linking, and that is now superseded by COMDAT. We can probably ignore that section generated by ICC because the duplicated symbol is surely provided by GCC-generated file.

Can you try this patch to see if this fixes your problem?

diff --git a/elf/input-files.cc b/elf/input-files.cc
index 43f18ff29..7eec55169 100644
--- a/elf/input-files.cc
+++ b/elf/input-files.cc
@@ -236,11 +236,12 @@ void ObjectFile<E>::initialize_sections(Context<E> &ctx) {
       }

       // Ignore these sections for compatibility with old glibc i386
       // CRT files.
       if (name == ".gnu.linkonce.t.__x86.get_pc_thunk.bx" ||
-          name == ".gnu.linkonce.t.__i686.get_pc_thunk.bx")
+          name == ".gnu.linkonce.t.__i686.get_pc_thunk.bx" ||
+          name == ".gnu.linkonce.d.DW.ref.__gxx_personality_v0")
         continue;

       if ((ctx.arg.strip_all || ctx.arg.strip_debug) &&
           is_debug_section(shdr, name))
         continue;

@mrichtarsky
Copy link
Contributor Author

This fixes it, thanks!

@rui314
Copy link
Owner

rui314 commented Jan 20, 2022

For the record, can you tell me what your ICC's version is?

@rui314 rui314 closed this as completed in be6ae07 Jan 20, 2022
@mrichtarsky
Copy link
Contributor Author

Version is Intel 19.1.3.20200925

@rui314
Copy link
Owner

rui314 commented Jan 21, 2022

Filed a bug to https://community.intel.com/t5/Intel-C-Compiler/ICC-uses-GNU-linkonce-instead-of-COMDAT-for-gxx-personality-v0/m-p/1353314#M39628

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants