[llvm-bugs] [Bug 35701] New: "32-bit RIP relative reference out of range" error when linking large binary with code coverage instrumentation on macOS

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 19 14:12:04 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35701

            Bug ID: 35701
           Summary: "32-bit RIP relative reference out of range" error
                    when linking large binary with code coverage
                    instrumentation on macOS
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mmoroz at google.com
                CC: llvm-bugs at lists.llvm.org

We're getting the following error while building a large binary on macOS with
code coverage instrumentation:

FAILED: v8_context_snapshot_generator
export DEVELOPER_DIR=/Users/liaoyuke/chromium/src/build/mac_files/Xcode.app; 
TOOL_VERSION=1505258040 ../../build/toolchain/mac/linker_driver.py
../../third_party/llvm-build/Release+Asserts/bin/clang++  -stdlib=libc++ -arch
x86_64 -segprot PROTECTED_MEMORY rw r -Werror -isysroot
../../build/mac_files/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
-mmacosx-version-min=10.9.0 -fprofile-instr-generate -Wl,-ObjC
-L../../build/mac_files/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib
-o "./v8_context_snapshot_generator"
-Wl,-filelist,"./v8_context_snapshot_generator.rsp"  -framework Cocoa
-framework Foundation -framework IOKit -framework Security -framework
SystemConfiguration -framework CoreFoundation -framework ApplicationServices
-framework AppKit -lbsm -framework CFNetwork -framework CoreServices -lresolv
-framework CoreGraphics -framework CoreText -framework Accelerate -framework
AudioUnit -framework Carbon -framework CoreVideo -framework IOSurface
-framework AudioToolbox -framework CoreAudio -framework OpenGL -framework
Quartz -framework AVFoundation -framework CoreMedia -framework VideoToolbox
-framework QuartzCore -framework DiskArbitration -lsandbox -framework
IOBluetooth
final section layout:
    __TEXT/__text addr=0x100002900, size=0x1025492D, fileOffset=0x00002900,
type=1
    __TEXT/__stubs addr=0x11025722E, size=0x00001926, fileOffset=0x1025722E,
type=28
    __TEXT/__stub_helper addr=0x110258B54, size=0x000029BE,
fileOffset=0x10258B54, type=32
    __TEXT/__cstring addr=0x11025B520, size=0x003FFBCC, fileOffset=0x1025B520,
type=13
    __TEXT/__const addr=0x11065B100, size=0x0024D228, fileOffset=0x1065B100,
type=0
    __TEXT/__ustring addr=0x1108A8328, size=0x00000D78, fileOffset=0x108A8328,
type=16
    __TEXT/__gcc_except_tab addr=0x1108A90A0, size=0x0001168C,
fileOffset=0x108A90A0, type=0
    __TEXT/__objc_methname addr=0x1108BA72C, size=0x00005A97,
fileOffset=0x108BA72C, type=14
    __TEXT/__objc_classname addr=0x1108C01C3, size=0x000006F5,
fileOffset=0x108C01C3, type=14
    __TEXT/__objc_methtype addr=0x1108C08B8, size=0x0000F655,
fileOffset=0x108C08B8, type=14
    __TEXT/__unwind_info addr=0x1108CFF10, size=0x000463B0,
fileOffset=0x108CFF10, type=22
    __TEXT/__eh_frame addr=0x1109162C0, size=0x00045CF0, fileOffset=0x109162C0,
type=19
    __DATA/__nl_symbol_ptr addr=0x11095C000, size=0x00000010,
fileOffset=0x1095C000, type=29
    __DATA/__got addr=0x11095C010, size=0x00000CF0, fileOffset=0x1095C010,
type=29
    __DATA/__la_symbol_ptr addr=0x11095CD00, size=0x00002188,
fileOffset=0x1095CD00, type=27
    __DATA/__mod_init_func addr=0x11095EE88, size=0x00000088,
fileOffset=0x1095EE88, type=33
    __DATA/__const addr=0x11095EF20, size=0x00264230, fileOffset=0x1095EF20,
type=0
    __DATA/__cfstring addr=0x110BC3150, size=0x00000F60, fileOffset=0x10BC3150,
type=17
    __DATA/__objc_classlist addr=0x110BC40B0, size=0x00000190,
fileOffset=0x10BC40B0, type=0
    __DATA/__objc_catlist addr=0x110BC4240, size=0x00000078,
fileOffset=0x10BC4240, type=24
    __DATA/__objc_protolist addr=0x110BC42B8, size=0x00000068,
fileOffset=0x10BC42B8, type=0
    __DATA/__objc_imageinfo addr=0x110BC4320, size=0x00000008,
fileOffset=0x10BC4320, type=0
    __DATA/__objc_const addr=0x110BC4328, size=0x00007368,
fileOffset=0x10BC4328, type=0
    __DATA/__objc_selrefs addr=0x110BCB690, size=0x00001980,
fileOffset=0x10BCB690, type=15
    __DATA/__objc_protorefs addr=0x110BCD010, size=0x00000020,
fileOffset=0x10BCD010, type=0
    __DATA/__objc_classrefs addr=0x110BCD030, size=0x00000348,
fileOffset=0x10BCD030, type=23
    __DATA/__objc_superrefs addr=0x110BCD378, size=0x00000130,
fileOffset=0x10BCD378, type=0
    __DATA/__objc_ivar addr=0x110BCD4A8, size=0x00000310,
fileOffset=0x10BCD4A8, type=0
    __DATA/__objc_data addr=0x110BCD7B8, size=0x00000FA0,
fileOffset=0x10BCD7B8, type=0
    __DATA/__data addr=0x110BCE760, size=0x000FBDD0, fileOffset=0x10BCE760,
type=0
    __DATA/__llvm_prf_cnts addr=0x110CCA530, size=0x00F7C958,
fileOffset=0x10CCA530, type=0
    __DATA/__llvm_prf_data addr=0x111C46E88, size=0x029A2EE0,
fileOffset=0x11C46E88, type=0
    __DATA/__llvm_prf_names addr=0x1145E9D70, size=0x280817B6,
fileOffset=0x145E9D70, type=0
    __DATA/__thread_vars addr=0x13C66B528, size=0x00000030,
fileOffset=0x3C66B528, type=38
    __DATA/crashpad_info addr=0x13C66B558, size=0x00000038,
fileOffset=0x3C66B558, type=0
    __DATA/__llvm_prf_vnds addr=0x13C66B590, size=0x00006000,
fileOffset=0x3C66B590, type=0
    __DATA/__thread_data addr=0x13C671590, size=0x00000010,
fileOffset=0x3C671590, type=40
    __DATA/__thread_bss addr=0x13C6715A0, size=0x00000004,
fileOffset=0x00000000, type=39
    __DATA/__bss addr=0x13C6715B0, size=0x000AF07C, fileOffset=0x00000000,
type=25
    __DATA/__common addr=0x13C720640, size=0x00087F3C, fileOffset=0x00000000,
type=25
    __DATA/__huge addr=0x13C7A857C, size=0x00000000, fileOffset=0x00000000,
type=25
    __LLVM_COV/__llvm_covmap addr=0x13C7A9000, size=0x76810924,
fileOffset=0x3C672000, type=0
    PROTECTED_MEMORY/protected_memory addr=0x1B2FBA000, size=0x00000010,
fileOffset=0xB2E83000, type=0
ld: 32-bit RIP relative reference out of range (2845947809 max is +/-4GB): from
__ZN2gl23SetGLGetProcAddressProcEPFPFvvEPKcE (0x10959E780) to
__ZN2gl12_GLOBAL__N_118g_get_proc_addressE (0x1B2FBA008) in
'__ZN2gl23SetGLGetProcAddressProcEPFPFvvEPKcE' from
obj/ui/gl/libgl_wrapper.a(gl_implementation.o) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Is there anything we can do to avoid that issue? As I understand, __llvm_covmap
referenced are RIP relative, but is it really necessary? The same binary links
successfully on Linux, even though __llvm_covmap section is even larger over
there.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171219/d190ed63/attachment.html>


More information about the llvm-bugs mailing list