Re: ld64 and getsectdata(): incorrect behavior on sections
Re: ld64 and getsectdata(): incorrect behavior on sections
- Subject: Re: ld64 and getsectdata(): incorrect behavior on sections
- From: email@hidden
- Date: Thu, 28 Mar 2013 12:43:12 +0400
Sorry, i should really brace myself and pay attention to manuals.
> or use the newer routine getsectiondata(), which does return a slid pointer.
Thanks, that works. Another (not great) option is to build with '-Wl,-no_pie'.
28.03.2013, в 9:54, Shantonu Sen <email@hidden> написал(а):
> I'm not sure what connection you're drawing with ld64, but the problem is that getsectdata() is documented to not slide the pointed-to data when the image slides, which is the case in recent OSes, where the main executable are linked PIE for ASLR.
>
> You should either follow the man page, or use the newer routine getsectiondata(), which does return a slid pointer.
>
> Shantonu
>
> On Mar 27, 2013, at 9:32 PM, email@hidden wrote:
>
>> Dear list,
>>
>> During stage of porting of an old code which uses linker sets and had been linked by now obsoleted ld from cctools i've found that sets are broken when linked with ld64.
>>
>> Here is a sample code to reproduce the bug: http://pastebin.com/TCbeYzNA . Now please try to build on the system with ld (if you have such environment) and then build on system with ld64. Compare results. Latest will always fail.
>>
>> This is the correct behavior:
>> Program output
>> Number of entries in section: 3
>> Data of first entry: 5
>>
>> Section contents
>> otool -s __DATA my a.out
>> a.out:
>> Contents of (__DATA,my) section
>> 00003080 00003018 0000301c 00003020
>>
>> with following ld version:
>> ld -v
>> Apple Computer, Inc. version cctools-622.9~2
>>
>> And incorrect one using ld64:
>> Program output
>> Number of entries in section: 3
>> './a.out ' terminated by signal SIGSEGV (Address boundary error)
>>
>> Section contents
>> otool -s __DATA my a.out
>> a.out:
>> Contents of (__DATA,my) section
>> 0000000100001030 24 10 00 00 01 00 00 00 28 10 00 00 01 00 00 00
>> 0000000100001040 2c 10 00 00 01 00 00 00
>>
>> ld -v
>> @(#)PROGRAM:ld PROJECT:ld64-136
>> configured to support archs: armv6 armv7 armv7s i386 x86_64
>> LTO support using: LLVM version 3.2svn, from Apple Clang 4.2 (build 425.0.27)
>>
>> Any ideas how to workaround this problem?
>> ( Is any build of an old ld for i386 or/and x86_64 uploaded somewhere publicly or otherwise build instructions for it? )
>>
>> Thanks much.
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Darwin-kernel mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden