Re: OS constant cause "32-bit RIP relative reference out of range" linker error on x64
Re: OS constant cause "32-bit RIP relative reference out of range" linker error on x64
- Subject: Re: OS constant cause "32-bit RIP relative reference out of range" linker error on x64
- From: Vojtěch Meluzín <email@hidden>
- Date: Tue, 19 Jun 2012 00:55:55 +0200
Thanks folks, but no luck. Nothing for position dependent code is enabled. Linker arguments are below.
Btw. as I mentioned - it does this only with the main source code I use, when I try to create a small test source with just a few lines accesing "stdout" or other static values which were causing the problem, it DOES work. It just doesn't for my main project executable, which is huge and that's the only difference I noticed. I thought maybe CLANG has some limitation for the code generations (like spacing methods by kilobytes => too big project causes running over 32-bit space... no idea...).
For the record, this is a clean Lion installation, but I also upgraded a while ago from Snow leopard and tried to use the new XCode and I ended with the same problem (on different machine, so it seems it does that on every Lion installation, no problem with settings or something...). But that time I didn't have any time, so I had to switch back to Snow leopard and XCode 3.
Ok, the linker arguments:
Ld /Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Products/Debug/console normal x86_64
cd /Users/melda/Documents/console
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -L/Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Products/Debug -F/Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Products/Debug -filelist /Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Intermediates/console.build/Debug/console.build/Objects-normal/x86_64/console.LinkFileList -mmacosx-version-min=10.7 -framework AudioUnit -framework Cocoa -framework CoreAudio -framework CoreData -framework CoreServices -framework Security -o /Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Products/Debug/console
And the output:
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in __ZN14MConsoleStreamC2Ev from /Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Intermediates/console.build/Debug/console.build/Objects-normal/x86_64/mlibrary_part_2.o. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
final section layout:
__TEXT/__text addr=0x100001000, size=0x0015B280, fileOffset=0x00001000, type=1
__TEXT/__stubs addr=0x10015C280, size=0x000003FC, fileOffset=0x0015C280, type=27
__TEXT/__stub_helper addr=0x10015C67C, size=0x000006B4, fileOffset=0x0015C67C, type=31
__TEXT/__gcc_except_tab addr=0x10015CD30, size=0x0004DA10, fileOffset=0x0015CD30, type=0
__TEXT/__const addr=0x1001AA740, size=0x00007E00, fileOffset=0x001AA740, type=0
__TEXT/__cstring addr=0x1001B2540, size=0x0000A2E8, fileOffset=0x001B2540, type=12
__TEXT/__unwind_info addr=0x1001BC828, size=0x00004214, fileOffset=0x001BC828, type=21
__TEXT/__eh_frame addr=0x1001C0A40, size=0x000235C0, fileOffset=0x001C0A40, type=18
__DATA/__program_vars addr=0x1001E4000, size=0x00000028, fileOffset=0x001E4000, type=29
__DATA/__nl_symbol_ptr addr=0x1001E4028, size=0x00000010, fileOffset=0x001E4028, type=28
__DATA/__got addr=0x1001E4038, size=0x00000018, fileOffset=0x001E4038, type=28
__DATA/__la_symbol_ptr addr=0x1001E4050, size=0x00000550, fileOffset=0x001E4050, type=26
__DATA/__mod_init_func addr=0x1001E45A0, size=0x00000038, fileOffset=0x001E45A0, type=32
__DATA/__data addr=0x1001E45E0, size=0x00004950, fileOffset=0x001E45E0, type=0
__DATA/__const addr=0x1001E8F30, size=0x00001688, fileOffset=0x001E8F30, type=0
__DATA/__cfstring addr=0x1001EA5B8, size=0x00000020, fileOffset=0x001EA5B8, type=16
__DATA/__bss addr=0x1001EA5E0, size=0x00001268, fileOffset=0x00000000, type=24
__DATA/__common addr=0x1001EB850, size=0x00088681, fileOffset=0x00000000, type=24
ld: 32-bit RIP relative reference out of range (-4295071253 max is +/-4GB): from __ZN14MConsoleStreamC2Ev (0x1000195D0) to ___stdoutp@0x000DF628 (0x00000000) in __ZN14MConsoleStreamC2Ev from /Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Intermediates/console.build/Debug/console.build/Objects-normal/x86_64/mlibrary_part_2.o for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
2012/6/18 Dave Zarzycki
<email@hidden>
In Xcode, for each project and for each target:
1) Go to the build settings
2) Type "dynamic-no-pic" into the search box
3) Ensure that "Generate Position-Dependent Code" is either not set OR is explicitly set to NO
4) Type "other_" into the search box
5) Ensure that "-Wl,-no_pie" is NOT being passed via any of the various "Other … Flags" variables.
On Jun 18, 2012, at 9:09 AM, Vojtěch Meluzín <
email@hidden> wrote:
I tried... but no compiler or linker options seem to have any effect here... And as I said it works with the same compiler options, but not with my sources and the only difference I can see is that the sources are huge, but minimizing them doesn't seem to help... No idea what to do know...
Vojtech
2012/6/18 Dave Zarzycki
<email@hidden>
On Jun 18, 2012, at 9:05 AM, Vojtěch Meluzín <
email@hidden> wrote:
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in __ZN14MConsoleStreamC2Ev from /Users/melda/Library/Developer/Xcode/DerivedData/console-elzukurmumezgoaajfaamjcaoeol/Build/Intermediates/console.build/Debug/console.build/Objects-normal/x86_64/mlibrary_part_2.o. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
You should fix the above first before trying to figure out the "32-bit RIP relative reference out of range" error.
davez
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden