Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

[Arch Linux] R_X86_64_PC32 against symbol `memcpy@@GLIBC_2.14' can not be used #6452

Closed
Rosalie241 opened this issue Oct 14, 2018 · 7 comments

Comments

@Rosalie241
Copy link

Rosalie241 commented Oct 14, 2018

clang version:

clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

output:
https://gist.github.com/tim241/3488247796c9bf9f0bc357d28f8a74c1

I've already tried to append -fPIC to the clang flags, no luck, same error.

@MichalStrehovsky
Copy link
Member

I don't have Arch Linux around to try, I'm guessing this is coming from this line:

mangledName = "memcpy"; // TODO: Null reference handling

Can you try changing the memcpy string to e.g. RhNewArray just to see if the linker error goes away? It's not the right fix, but if it does go away, I know how to fix it.

@Rosalie241
Copy link
Author

Rosalie241 commented Oct 15, 2018

@MichalStrehovsky when I try that, the error changes:

  /usr/sbin/ld: /builds/tim241/corert-bin/corert/tests/src/Simple/Generics/obj/Debug/x64/native/Generics.o: relocation R_X86_64_PC32 against symbol `fabs@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC

output:
https://gist.github.com/tim241/f134b841776fea4c3f0f0f8ab5e5a190

@MichalStrehovsky
Copy link
Member

Interesting. It seems JitHelpers are not special relocation types after all.

Another guess is that the linker is trying to link agains GLIBC dynamically on Arch, instead of statically like we do elsewhere. Would that be a possibility?

@Rosalie241
Copy link
Author

Rosalie241 commented Oct 15, 2018

@MichalStrehovsky I have no idea, that'd be weird though?

@Rosalie241
Copy link
Author

I've tried adding -static-libgcc -static-libstdc++ to the flags, however I still have the same issue.

  Generating native code
clang-7 : warning : argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] [/builds/tim241/corert-bin/corert/tests/src/Simple/Generics/Generics.csproj]
  /usr/sbin/ld: /builds/tim241/corert-bin/corert/tests/src/Simple/Generics/obj/Debug/x64/native/Generics.o: relocation R_X86_64_PC32 against symbol `memcpy@@GLIBC_2.14' can not be used when making a PIE object; recompile with -fPIC
  /usr/sbin/ld: final link failed: bad value

output:
https://gist.github.com/tim241/a9b1ebf5092535fa32c3bdc04eb82a3c

And here's the output when adding -static-libgcc -static-libstdc++ -v to the clang flags:
https://gist.github.com/tim241/aa6e31b2a1dfc7216e77905b308f578f

@jkotas
Copy link
Member

jkotas commented Dec 12, 2018

This is same problem as #4988 . I think it is a bug in the object writer component - we are producing bad relocs on Unix.

@Rosalie241
Copy link
Author

@jkotas okay, thank you 👍

I'll close this issue then!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants