Bug 7354 – ld: GOT load reloc does not point to a movq instruction

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2012-01-23T15:21:00Z
Last change time
2015-07-21T07:49:36Z
Assigned to
nobody
Creator
soul8o8

Comments

Comment #0 by soul8o8 — 2012-01-23T15:21:32Z
I'm having trouble manually linking a 64-bit program on OSX with no exported symbols in order to make `strip` work. DMD 2.057, MacOS X 10.7.2, ld: llvm version 3.0svn, from Apple Clang 3.0 (build 211.10.1) (I'm not entirely sure if this is a bug or enhancement. I feel not being able to strip a binary from symbols is a bug.) // - - - hello.d - - - import std.stdio; void main(){ writeln("Hello"); } // - - - 8< - - The Bug ------ $ echo "#empty" > symbols.txt $ dmd -c hello.d $ ld -o hello hello.o -lphobos2 -lpthread -lm -lcrt1.o -macosx_version_min 10.6 -exported_symbols_list symbols.txt ld: GOT load reloc does not point to a movq instruction in _D3std6string16__T7indexOfTaTaZ7indexOfFAxaAxaE3std6string13CaseSensitiveZl138__T16simpleMindedFindS104_D3std6string16__T7indexOfTaTaZ7indexOfFAxaAxaE3std6string13CaseSensitiveZl15__dgliteral1242MFNaNbNfwwZbTAxaTAxaZ16simpleMindedFindMFAxaAxaZAxa from /usr/local/lib/libphobos2.a(string_5a_1601.o) for inferred architecture x86_64 $ _ It works with -m32 ------ $ echo "#empty" > symbols.txt $ dmd -m32 -c hello.d $ ld -o hello hello.o -lphobos2 -lpthread -lm -lcrt1.o -macosx_version_min 10.6 -exported_symbols_list symbols.txt $ ./hello Hello $ _ It also works without the -exported_symbols_list (but then `strip` has no effect) ------ $ dmd -c hello.d $ ld -o hello hello.o -lphobos2 -lpthread -lm -lcrt1.o -macosx_version_min 10.6 $ ./hello Hello $ strip hello $ nm hello 0000000000022948 T _D3std8datetime7SysTime4toTMMxFNbZS4core4stdc4time2tm 0000000000021eb0 T _D3std8datetime7SysTime4yearMFNdiZv 0000000000021e90 T _D3std8datetime7SysTime4yearMxFNbNdZs 0000000000022020 T _D3std8datetime7SysTime5monthMFNdE3std8datetime5MonthZv 0000000000022000 T _D3std8datetime7SysTime5monthMxFNbNdZE3std8datetime5Month 0000000000021e60 T _D3std8datetime7SysTime5opCmpMxFNaNbxS3std8datetime7SysTimeZi 0000000000022800 T _D3std8datetime7SysTime5toUTCMxFNaNbZS3std8datetime7SysTime // ....hundreds more etc. $ _
Comment #1 by govellius — 2012-11-02T05:25:25Z
__gshared long var; void main() { asm{ mov [var], RAX; } } --- This causes the same link error on OSX64 ld: GOT load reloc does not point to a movq instruction in _D7testabi4mainFZv from testabi.o for architecture x86_64
Comment #2 by timothee.cour2 — 2015-07-20T07:43:12Z
perhaps related: b/14814
Comment #3 by code — 2015-07-21T07:49:36Z
PIC relocations don't work for variable access in asm code, OSX always uses PIC code. *** This issue has been marked as a duplicate of issue 9760 ***