www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7354] New: ld: GOT load reloc does not point to a movq instruction

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7354

           Summary: ld: GOT load reloc does not point to a movq
                    instruction
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: soul8o8 gmail.com



---
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.
$ _

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 23 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7354


Shahid <govellius gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |govellius gmail.com



__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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2012