From: Fangrui Song <maskray@google.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>,
kbuild test robot <lkp@intel.com>,
kbuild-all@lists.01.org,
clang-built-linux <clang-built-linux@googlegroups.com>,
linux-efi <linux-efi@vger.kernel.org>
Subject: Re: [efi:next 22/40] ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
Date: Wed, 20 May 2020 10:34:25 -0700 [thread overview]
Message-ID: <20200520173425.ovn4kvv2cvkdlrnn@google.com> (raw)
In-Reply-To: <CAMj1kXGNmDPQRCCtRYFRa+0NW9kADnx327FzPbNge+MU+NFoVg@mail.gmail.com>
On 2020-05-20, Ard Biesheuvel wrote:
>On Wed, 20 May 2020 at 17:53, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>>
>> On Wed, May 20, 2020 at 10:28:13AM +0800, kbuild test robot wrote:
>> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
>> > head: e5fbadd1179cdadeaa44d71a9ec068c5bc100524
>> > commit: ce5e3f909fc0ed67e58367b9c56a54c20a51080b [22/40] efi/printf: Add 64-bit and 8-bit integer support
>> > config: x86_64-defconfig (attached as .config)
>> > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
>> > reproduce:
>> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> > chmod +x ~/bin/make.cross
>> > # install x86_64 cross compiling tool for clang build
>> > # apt-get install binutils-x86-64-linux-gnu
>> > git checkout ce5e3f909fc0ed67e58367b9c56a54c20a51080b
>> > # save the attached .config to linux build tree
>> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
>> >
>> > If you fix the issue, kindly add following tag as appropriate
>> > Reported-by: kbuild test robot <lkp@intel.com>
>> >
>> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> >
>> > >> ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
>> >
>> > ---
>> > 0-DAY CI Kernel Test Service, Intel Corporation
>> > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>>
>> Clang folk, is anything actually wrong here? This seems to result from
>> use of unreachable() annotation, which generates these
>> .discard.unreachable sections apparently to help objtool.
>>
>
>This came up before, and IIRC, it has already been fixed, only this
>branch is based on v5.7-rc2.
LLD reports the diagnostic because a PC-relative relocation referencing a
SHF_ALLOC section from a non-SHF_ALLOC section (.discard.unreachable) cannot be
reasonably represented. A non-SHF_ALLOC section is not part of the memory image, thus conceptually
the distance between a non-SHF_ALLOC and a SHF_ALLOC is not a constant which can be resolved at linktime.
This is actually a nice diagnostic which has caught a number of issues.
% readelf -Wr drivers/firmware/efi/libstub/vsprintf.stub.o
..
Relocation section '.rela.discard.unreachable' at offset 0xe38 contains 1 entry:
Offset Info Type Symbol's Value Symbol's Name + Addend
0000000000000000 0000000600000002 R_X86_64_PC32 0000000000000000 .text + ac0
---
The linker command line is:
% ld.lld -m elf_x86_64 -T arch/x86/boot/compressed/vmlinux.lds arch/x86/boot/compressed/kernel_info.o arch/x86/boot/compressed/head_64.o arch/x86/boot/compressed/misc.o arch/x86/boot/compressed/string.o arch/x86/boot/compressed/cmdline.o arch/x86/boot/compressed/error.o arch/x86/boot/compressed/piggy.o arch/x86/boot/compressed/cpuflags.o arch/x86/boot/compressed/early_serial_console.o arch/x86/boot/compressed/kaslr.o arch/x86/boot/compressed/kaslr_64.o arch/x86/boot/compressed/mem_encrypt.o arch/x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o drivers/firmware/efi/libstub/lib.a arch/x86/boot/compressed/efi_thunk_64.o -o arch/x86/boot/compressed/vmlinux
ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
arch/x86/boot/compressed/vmlinux has an output section .discard.unreachable , which is likely desired.
Note that arch/x86/kernel/vmlinux.lds.S has an output section description /DISCARD/ : { ... *(.discard.*) ... },
but arch/x86/boot/compressed/vmlinux doesn't.
We can let arch/x86/boot/compressed/vmlinux reuse the /DISCARD/ to fix the issue.
WARNING: multiple messages have this Message-ID (diff)
From: Fangrui Song <maskray@google.com>
To: kbuild-all@lists.01.org
Subject: Re: [efi:next 22/40] ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
Date: Wed, 20 May 2020 10:34:25 -0700 [thread overview]
Message-ID: <20200520173425.ovn4kvv2cvkdlrnn@google.com> (raw)
In-Reply-To: <CAMj1kXGNmDPQRCCtRYFRa+0NW9kADnx327FzPbNge+MU+NFoVg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3849 bytes --]
On 2020-05-20, Ard Biesheuvel wrote:
>On Wed, 20 May 2020 at 17:53, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>>
>> On Wed, May 20, 2020 at 10:28:13AM +0800, kbuild test robot wrote:
>> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
>> > head: e5fbadd1179cdadeaa44d71a9ec068c5bc100524
>> > commit: ce5e3f909fc0ed67e58367b9c56a54c20a51080b [22/40] efi/printf: Add 64-bit and 8-bit integer support
>> > config: x86_64-defconfig (attached as .config)
>> > compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 135b877874fae96b4372c8a3fbfaa8ff44ff86e3)
>> > reproduce:
>> > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> > chmod +x ~/bin/make.cross
>> > # install x86_64 cross compiling tool for clang build
>> > # apt-get install binutils-x86-64-linux-gnu
>> > git checkout ce5e3f909fc0ed67e58367b9c56a54c20a51080b
>> > # save the attached .config to linux build tree
>> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
>> >
>> > If you fix the issue, kindly add following tag as appropriate
>> > Reported-by: kbuild test robot <lkp@intel.com>
>> >
>> > All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> >
>> > >> ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
>> >
>> > ---
>> > 0-DAY CI Kernel Test Service, Intel Corporation
>> > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>>
>> Clang folk, is anything actually wrong here? This seems to result from
>> use of unreachable() annotation, which generates these
>> .discard.unreachable sections apparently to help objtool.
>>
>
>This came up before, and IIRC, it has already been fixed, only this
>branch is based on v5.7-rc2.
LLD reports the diagnostic because a PC-relative relocation referencing a
SHF_ALLOC section from a non-SHF_ALLOC section (.discard.unreachable) cannot be
reasonably represented. A non-SHF_ALLOC section is not part of the memory image, thus conceptually
the distance between a non-SHF_ALLOC and a SHF_ALLOC is not a constant which can be resolved at linktime.
This is actually a nice diagnostic which has caught a number of issues.
% readelf -Wr drivers/firmware/efi/libstub/vsprintf.stub.o
..
Relocation section '.rela.discard.unreachable' at offset 0xe38 contains 1 entry:
Offset Info Type Symbol's Value Symbol's Name + Addend
0000000000000000 0000000600000002 R_X86_64_PC32 0000000000000000 .text + ac0
---
The linker command line is:
% ld.lld -m elf_x86_64 -T arch/x86/boot/compressed/vmlinux.lds arch/x86/boot/compressed/kernel_info.o arch/x86/boot/compressed/head_64.o arch/x86/boot/compressed/misc.o arch/x86/boot/compressed/string.o arch/x86/boot/compressed/cmdline.o arch/x86/boot/compressed/error.o arch/x86/boot/compressed/piggy.o arch/x86/boot/compressed/cpuflags.o arch/x86/boot/compressed/early_serial_console.o arch/x86/boot/compressed/kaslr.o arch/x86/boot/compressed/kaslr_64.o arch/x86/boot/compressed/mem_encrypt.o arch/x86/boot/compressed/pgtable_64.o arch/x86/boot/compressed/acpi.o drivers/firmware/efi/libstub/lib.a arch/x86/boot/compressed/efi_thunk_64.o -o arch/x86/boot/compressed/vmlinux
ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol ''
arch/x86/boot/compressed/vmlinux has an output section .discard.unreachable , which is likely desired.
Note that arch/x86/kernel/vmlinux.lds.S has an output section description /DISCARD/ : { ... *(.discard.*) ... },
but arch/x86/boot/compressed/vmlinux doesn't.
We can let arch/x86/boot/compressed/vmlinux reuse the /DISCARD/ to fix the issue.
next prev parent reply other threads:[~2020-05-20 17:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 2:28 [efi:next 22/40] ld.lld: warning: vsprintf.c:(.discard.unreachable+0x0): has non-ABS relocation R_X86_64_PC32 against symbol '' kbuild test robot
2020-05-20 2:28 ` kbuild test robot
2020-05-20 15:53 ` Arvind Sankar
2020-05-20 16:14 ` Ard Biesheuvel
2020-05-20 16:14 ` Ard Biesheuvel
2020-05-20 17:34 ` Fangrui Song [this message]
2020-05-20 17:34 ` Fangrui Song
2020-05-20 17:39 ` Arvind Sankar
2020-05-20 17:41 ` Arvind Sankar
2020-05-20 17:56 ` Nick Desaulniers
2020-05-20 17:56 ` Nick Desaulniers
2020-05-21 0:23 ` Philip Li
2020-05-21 0:23 ` Philip Li
2020-05-20 18:26 ` Fangrui Song
2020-05-20 18:26 ` Fangrui Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200520173425.ovn4kvv2cvkdlrnn@google.com \
--to=maskray@google.com \
--cc=ardb@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-efi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=nivedita@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.