[llvm-bugs] [Bug 38200] New: Linking error: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_align

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 17 13:38:02 PDT 2018


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

            Bug ID: 38200
           Summary: Linking error: error: relocation R_X86_64_PC32 cannot
                    refer to absolute symbol:
                    __typeid__ZTSFvvE.generalized_align
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: tom at ritter.vg
                CC: llvm-bugs at lists.llvm.org

> clang version 7.0.0 (trunk) (llvm/trunk 337005)
> Target: x86_64-unknown-linux-gnu

The following code was compiled into a .o :

>
>  if (aType & nsCFIType::ICALL_INVALID_ENTRY_POINT) {
>
>    int val = setjmp(env);
>
>    if (val == 0) {
>      fn_ptr slide_to_the_left = (fn_ptr)((uintptr_t)(not_entry_point) + 0x20);
>      slide_to_the_left();  // Line 690
>    }
>
>    return NS_OK;
>  }
>
>
>  if (aType & nsCFIType::ICALL_INVALID_SIGNATURE) {
>    int_arg_fn get_down_now_yall = (int_arg_fn)int_arg;
>
>    int ret = get_down_now_yall(5);  // Line 709
>
>    get_down_now_yall = (int_arg_fn)float_arg;
>    ret = get_down_now_yall(5);  // Line 713
>
>    return NS_OK;
>  }

And then linked with the following command:

> ../../../../../../../../clang++ \
> -fuse-ld=lld \
> -flto=thin \
> -fsanitize=cfi-icall \
> -pipe \
> -g \
> -fPIC \
> -shared \
> -o \
> libxul.so \
> trimmed_tmp.list \
> -fcolor-diagnostics \
> -Wl,--error-limit,0

It yields the following errors:

> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_align
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:0 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:0)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))

> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFvvE.generalized_size_m1
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:690 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:690)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))

> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_align
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:0 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:0)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))

> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_size_m1
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:709 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:709)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))

> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_align
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:0 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:0)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))

> /home/tom/Documents/moz/mozilla-unified-cfi-icall/reproduce-bug/xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library/../../../../../../../../ld.lld: error: relocation R_X86_64_PC32 cannot refer to absolute symbol: __typeid__ZTSFiiE.generalized_size_m1
> >>> defined in lto.tmp
> >>> referenced by nsDebugImpl.cpp:713 (/home/tom/Documents/moz/mozilla-unified-cfi-icall/xpcom/base/nsDebugImpl.cpp:713)
> >>>               lto.tmp:(nsDebugImpl::CfiCrash(int))



The reproduction steps are:

> wget https://ritter.vg/misc/transient/R_X86_64_PC32.tgz
> tar xf R_X86_64_PC32.tgz
> cd xul-repro/home/tom/Documents/moz/mozilla-unified-cfi-icall/obj-x86_64-pc-linux-gnu/toolkit/library
> # Clear your terminal
> # Run the above compile command; search for R_X86_64_PC32


I tried to reproduce the compilation command to take it from the source code to
the .o file; but had a lot of difficulty doing that, so I decided to file this
with what I had. My file is too large to attach to bugzilla; but it is
minimized as much as I could, down from 2 GB and 1000+ object files.

-- 
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/20180717/0824a706/attachment.html>


More information about the llvm-bugs mailing list