first xcode 4 problem

Jeremy Lavergne jeremy at lavergne.gotdns.org
Thu Mar 31 09:28:07 PDT 2011


It seems we've come across our first bug because of xcode 4: valgrind cannot work on 64-bit processes when built from xcode 4 versus 3.

Has anyone else used xcode 4 and come across issues with 64-bit (seems to be the linker)?

Begin forwarded message:

> From: Julian Seward <jseward at acm.org>
> Date: March 31, 2011 8:23:02 EDT
> To: snc at macports.org
> Subject: [Bug 267997] MacOSX: 64-bit valgrind segfaults on launch when built with Xcode 4.0.1
> Reply-To: bug-control at bugs.kde.org
> 
> https://bugs.kde.org/show_bug.cgi?id=267997
> 
> 
> 
> 
> 
> --- Comment #6 from Julian Seward <jseward acm org>  2011-03-31 14:22:59 ---
> Some initial results:
> 
> * I can reproduce this with Xcode 4.0.1.
> 
> 
> * AFAICS it only affects the valgrinding of 64-bit processes; 32-bits is OK
> 
> 
> * The tool executables (big files of the form memcheck-amd64-darwin, etc)
> segfault within a few instructions of gaining control from the kernel.
> 
> 
> * My initial impression is that this is due to a bug in the linker
> (/usr/bin/ld), which is perhaps a new implementation in 4.0.x ?
> 
> $ /usr/bin/ld -v
> @(#)PROGRAM:ld  PROJECT:ld64-123.2
> llvm version 2.9svn, from Apple Clang 2.0 (build 138)
> 
> Comparing the MachO load commands vs a (working) tool executable that
> was created by Xcode 3.2.x, it appears that the new linker has partially
> ignored the build system's request to place the tool executable's stack
> at a non standard location.  The build system tells the linker
> "-stack_addr 0x134000000 -stack_size 0x800000".
> 
> With the Xcode 3.2 linker those flags produce two results:
> 
> (1) A load command to allocate the stack at the said location:
>        Load command 3
>              cmd LC_SEGMENT_64
>          cmdsize 72
>          segname __UNIXSTACK
>           vmaddr 0x0000000133800000
>           vmsize 0x0000000000800000
>          fileoff 2285568
>         filesize 0
>          maxprot 0x00000007
>         initprot 0x00000003
>           nsects 0
>            flags 0x0
> 
> (2) A request (in LC_UNIXTHREAD) to set %rsp to the correct value
>     at process startup, 0x134000000.
> 
> With Xcode 4.0.1, (1) is missing but (2) is still present.  The
> tool executable therefore starts up with %rsp pointing to unmapped
> memory and faults almost instantly.
> 
> 
> * Xcode 4.0.1 linking a 32 bit tool executable does not omit (1),
> and so works correctly.
> 
> -- 
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3749 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20110331/fcadbe41/attachment.bin>


More information about the macports-dev mailing list