[PATCH] D30256: [ELF] - Implemented -z noreloc-overflow.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 08:16:45 PST 2017


>>That is a really odd name if that is what it does. What fails to link if
>>you just ignore the option?
>>
>>Cheers,
>>Rafael
>
>Currently LLD links kernel fine because next lines that used as check:
>
>LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \
>        && echo "-z noreloc-overflow -pie --no-dynamic-linker")
>
>never work for us, so build system does not add
>-z noreloc-overflow -pie --no-dynamic-linker to invokation.
>That works now because KASLR is disabled (kernel does not execute self relocation code).
>
>But when I take reproduce and ignore that option then BFD output for reproduce is:
>/usr/bin/ld: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o: relocation R_X86_64_32 against symbol >`z_input_len' can not be used when making a shared object; recompile with -fPIC
>/usr/bin/ld: final link failed: Nonrepresentable section on output
>
>I think generally this option is used just to skip all possible checks for dynamic relocations and let the
>user of output to do all job on his side.

And LLD output for now would be:

/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against symbol '_end' defined in (internal)
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(function startup_32): can't create dynamic relocation R_X86_64_32 against symbol 'startup_64' defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(.head.text+0x21B): can't create dynamic relocation R_X86_64_32 against symbol '_end' defined in (internal)
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(.head.text+0x225): can't create dynamic relocation R_X86_64_32S against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(.head.text+0x237): can't create dynamic relocation R_X86_64_32S against symbol '_bss' defined in (internal)
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(.head.text+0x23E): can't create dynamic relocation R_X86_64_32S against symbol '_bss' defined in (internal)
/home/umb/LLVM/build/bin/ld.lld: error: home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o:(.head.text+0x24F): can't create dynamic relocation R_X86_64_32S against local symbol in readonly segment defined in home/umb/linux_kernel/linux/linux/arch/x86/boot/compressed/head_64.o

George.


More information about the llvm-commits mailing list