[llvm-dev] Compilation issue "unsupported relocation on symbol" with clang 3.7.1
via llvm-dev
llvm-dev at lists.llvm.org
Tue Nov 28 22:43:20 PST 2017
Hi,
I downloaded the all LLVM suite version 5.0.0 from LLVM website. So I'm trying to compiler
compiler-rt version 5.0.0. But looking at git mirror I noticed the assembly.h was different.
So yes, USE_THUMB_1 is defined and I can patch assembly.h.
However, is version 5.0.0 the latest one ?
November 28, 2017 5:23 PM, "Peter Smith" <peter.smith at linaro.org> wrote:
> The file builtins/assembly.h has code to define things like
> USE_THUMB_1. Depending on how old your version of compiler-rt is, the
> chances are that you don't have an up to date assembly.h so
> USE_THUMB_1 isn't going to be defined. Are you able to take the latest
> version of compiler-rt? That would minimise your chances of running
> into problems like this. If you must keep the existing version of
> compiler-rt that you have I suggest that you either adapt USE_THUMB_1
> to the defines in your assembly.h or add USE_THUMB_1 to your
> assembly.h in the appropriate place.
>
> Peter
>
> On 28 November 2017 at 08:04, <shiftag at nanotek.info> wrote:
>
>> Hi again,
>>
>> So I applied the patch but I have still the same issue.
>>
>> ---
>>
>> -- Build files have been written to: /tmp/aki/llvm-5.0.0.src/build
>> [1465/5024] Creating library symlink lib/libc++.so.1 lib/libc++.so
>> GENERATING SCRIPT: 'INPUT(libc++.so.1 -lc++abi)' as file
>> /tmp/aki/llvm-5.0.0.src/build/lib/libc++.so
>> [1588/5024] Building C object
>> projects/compiler-rt/lib...ins/CMakeFiles/clang_rt.builtins-arm.dir/cpu_model.c.o
>> ../projects/compiler-rt/lib/builtins/cpu_model.c:596:7: warning: ISO C requires a translation unit
>> to contain at least one declaration [-Wempty-translation-unit]
>> #endif
>> ^
>> 1 warning generated.
>> [1786/5024] Building C object
>> projects/compiler-rt/lib.../CMakeFiles/clang_rt.builtins-armv6m.dir/cpu_model.c.o
>> ../projects/compiler-rt/lib/builtins/cpu_model.c:596:7: warning: ISO C requires a translation unit
>> to contain at least one declaration [-Wempty-translation-unit]
>> #endif
>> ^
>> 1 warning generated.
>> [1915/5024] Building ASM object
>> projects/compiler-rt/l...iles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o
>> FAILED:
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o
>> /usr/bin/clang -DLLVM_BUILD_GLOBAL_ISEL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE
>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>> -Iprojects/compiler-rt/lib/builtins -I../projects/compiler-rt/lib/builtins -Iinclude -I../include
>> -fPIC -O3 -DNDEBUG -march=armv6m -mfloat-abi=soft -fno-lto -MD -MT
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o -MF
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o.d -o
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o -c
>> ../projects/compiler-rt/lib/builtins/arm/aeabi_memcmp.S
>> clang -cc1as: fatal error: error in backend: unsupported relocation on symbol
>> [1917/5024] Building ASM object
>> projects/compiler-rt/l...iles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o
>> FAILED:
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o
>> /usr/bin/clang -DLLVM_BUILD_GLOBAL_ISEL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE
>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>> -Iprojects/compiler-rt/lib/builtins -I../projects/compiler-rt/lib/builtins -Iinclude -I../include
>> -fPIC -O3 -DNDEBUG -march=armv6m -mfloat-abi=soft -fno-lto -MD -MT
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o -MF
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o.d -o
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o -c
>> ../projects/compiler-rt/lib/builtins/arm/aeabi_memcpy.S
>> clang -cc1as: fatal error: error in backend: unsupported relocation on symbol
>> [1918/5024] Building ASM object
>> projects/compiler-rt/l...les/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o
>> FAILED:
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o
>> /usr/bin/clang -DLLVM_BUILD_GLOBAL_ISEL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE
>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
>> -Iprojects/compiler-rt/lib/builtins -I../projects/compiler-rt/lib/builtins -Iinclude -I../include
>> -fPIC -O3 -DNDEBUG -march=armv6m -mfloat-abi=soft -fno-lto -MD -MT
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o -MF
>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o.d
>> -o projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o
>> -c ../projects/compiler-rt/lib/builtins/arm/aeabi_memmove.S
>> clang -cc1as: fatal error: error in backend: unsupported relocation on symbol
>> [1920/5024] Building CXX object
>> lib/Target/ARM/MCTargetDesc/CMakeFiles/LLVMARMDesc.dir/ARMMCTargetDesc.cpp.o
>> ninja: build stopped: subcommand failed
>>
>> ---
>>
>> So if we check the content of the following file :
>>
>> projects/compiler-rt/lib/builtins/arm/aeabi_memcmp.S
>>
>> ---
>>
>> //===-- aeabi_memcmp.S - EABI memcmp implementation -----------------------===//
>> //
>> // The LLVM Compiler Infrastructure
>> //
>> // This file is dual licensed under the MIT and the University of Illinois Open
>> // Source Licenses. See LICENSE.TXT for details.
>> //
>> //===----------------------------------------------------------------------===//
>>
>> #include "../assembly.h"
>>
>> // void __aeabi_memcmp(void *dest, void *src, size_t n) { memcmp(dest, src, n); }
>>
>> .syntax unified
>> .p2align 2
>> DEFINE_COMPILERRT_FUNCTION(__aeabi_memcmp)
>> #ifdef USE_THUMB_1
>> push {r7, lr}
>> bl memcmp
>> pop {r7, pc}
>> #else
>> b memcmp
>> #endif
>> END_COMPILERRT_FUNCTION(__aeabi_memcmp)
>>
>> DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp4, __aeabi_memcmp)
>> DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memcmp8, __aeabi_memcmp)
>>
>> NO_EXEC_STACK_DIRECTIVE
>>
>> ---
>>
>> The file has been correctly patch but do I need to provide a switch to the pre-processor
>> for USE_THUMB_1 like "-DUSE_THUMB_1" ?
>>
>> Cheers
>>
>> November 27, 2017 3:36 PM, "via llvm-dev" <llvm-dev at lists.llvm.org> wrote:
>>
>>> Thank you Peter, I will try to patch instead.
>>>
>>> Cheers
>>>
>>> November 27, 2017 3:12 PM, "Peter Smith" <peter.smith at linaro.org> wrote:
>>
>> A very recent change to compiler-rt https://reviews.llvm.org/D39700
>> recently the unconditional branch for v6-m in some of the aeabi_
>> functions, if you are able to use compiler-rt from trunk or alter the
>> compiler-rt source yourself you may be able to work around the problem
>> without changing versions of llvm.
>>
>> I'm not sure what to recommend otherwise, you may be able to turn off
>> the integrated assembler and use arm-non-eabi-as for the files with
>> unconditional branches, but I couldn't guarantee that would wouldn't
>> result in other problems.
>>
>> Peter
>>
>> On 27 November 2017 at 11:02, <shiftag at nanotek.info> wrote:
>>> November 27, 2017 2:43 PM, "Peter Smith" <peter.smith at linaro.org> wrote:
>>
>> My best guess is that this is PR30279
>> https://bugs.llvm.org/show_bug.cgi?id=30279 which was fixed in r280651
>> in September 2016. Can you try again with a version of clang/llvm from
>> after that point? Some versions of aeabi_memcpy.S contain an
>> unconditional branch to memcpy (a branch out of section that can't be
>> resolved at assembly time). The v6m unconditional branch has a very
>> short range and earlier versions of llvm did not support the
>> relocation.
>>
>> Hope this helps
>>> Hi Peter,
>>>
>>> Thank you for your answer. I saw that pages before but I didn't find any
>>> information about how to fix this. And unfortunately, I can't use a different
>>> version of clang/llvm.
>>>
>>> Thanks
>>
>> On 26 November 2017 at 12:09, via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>> Hi List,
>>>
>>> I'm trying to build llvm-5.0.0 with clang-3.7.1 on ARM (native building). At
>>> some point I have the following issue :
>>>
>>> ----
>>>
>>> [1588/5024] Building C object
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-arm.dir/cpu_model.c.o
>>> ../projects/compiler-rt/lib/builtins/cpu_model.c:596:7: warning: ISO C
>>> requires a translation unit to contain at least one declaration
>>> [-Wempty-translation-unit]
>>> #endif
>>> ^
>>> 1 warning generated.
>>> [1786/5024] Building C object
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/cpu_model.c.o
>>> ../projects/compiler-rt/lib/builtins/cpu_model.c:596:7: warning: ISO C
>>> requires a translation unit to contain at least one declaration
>>> [-Wempty-translation-unit]
>>> #endif
>>> ^
>>> 1 warning generated.
>>> [1915/5024] Building ASM object
>>> projects/compiler-rt/lib/built...s/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o
>>> FAILED:
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o
>>> /usr/bin/clang -DLLVM_BUILD_GLOBAL_ISEL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
>>> -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
>>> -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/builtins
>>> -I../projects/compiler-rt/lib/builtins -Iinclude -I../include -fPIC -O3
>>> -DNDEBUG -march=armv6m -mfloat-abi=soft -fno-lto -MD -MT
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o
>>> -MF
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o.d
>>> -o
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcmp.S.o
>>> -c ../projects/compiler-rt/lib/builtins/arm/aeabi_memcmp.S
>>> clang -cc1as: fatal error: error in backend: unsupported relocation on
>>> symbol
>>> [1917/5024] Building ASM object
>>> projects/compiler-rt/lib/built.../CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o
>>> FAILED:
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o
>>> /usr/bin/clang -DLLVM_BUILD_GLOBAL_ISEL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
>>> -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
>>> -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/builtins
>>> -I../projects/compiler-rt/lib/builtins -Iinclude -I../include -fPIC -O3
>>> -DNDEBUG -march=armv6m -mfloat-abi=soft -fno-lto -MD -MT
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o
>>> -MF
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memmove.S.o.d
>>> -o
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins----armv6m.dir/arm/aeabi_memmove.S.o
>>> -c ../projects/compiler-rt/lib/builtins/arm/aeabi_memmove.S
>>> clang -cc1as: fatal error: error in backend: unsupported relocation on
>>> symbol
>>> [1918/5024] Building ASM object
>>> projects/compiler-rt/lib/built...s/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o
>>> FAILED:
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o
>>> /usr/bin/clang -DLLVM_BUILD_GLOBAL_ISEL -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
>>> -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
>>> -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/builtins
>>> -I../projects/compiler-rt/lib/builtins -Iinclude -I../include -fPIC -O3
>>> -DNDEBUG -march=armv6m -mfloat-abi=soft -fno-lto -MD -MT
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o
>>> -MF
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o.d
>>> -o
>>> projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins-armv6m.dir/arm/aeabi_memcpy.S.o
>>> -c ../projects/compiler-rt/lib/builtins/arm/aeabi_memcpy.S
>>> clang -cc1as: fatal error: error in backend: unsupported relocation on
>>> symbol
>>> [1920/5024] Building CXX object
>>> lib/Target/ARM/MCTargetDesc/CMakeFiles/LLVMARMDesc.dir/ARMMCTargetDesc.cpp.o
>>> ninja: build stopped: subcommand failed.
>>>
>>> ----
>>>
>>> Relevant stuff:
>>> clang -cc1as: fatal error: error in backend: unsupported relocation on
>>> symbol
>>>
>>> Well, I don't know how to fix that. Any ideas ?
>>>
>>> Let me know if you need further info.
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> llvm-dev at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the llvm-dev
mailing list