[PATCH 1/2] powerpc/vdso: Remove unused ENTRY in linker scripts

Fangrui Song maskray at google.com
Tue May 10 16:41:02 AEST 2022


On 2022-05-10, Alexey Kardashevskiy wrote:
>
>
>On 5/10/22 06:46, Nathan Chancellor wrote:
>>When linking vdso{32,64}.so.dbg with ld.lld, there is a warning about
>>not finding _start for the starting address:
>>
>>   ld.lld: warning: cannot find entry symbol _start; not setting start address
>>   ld.lld: warning: cannot find entry symbol _start; not setting start address
>>
>>Looking at GCC + GNU ld, the entry point address is 0x0:
>>
>>   $ llvm-readelf -h vdso{32,64}.so.dbg &| rg "(File|Entry point address):"
>>   File: vdso32.so.dbg
>>     Entry point address:               0x0
>>   File: vdso64.so.dbg
>>     Entry point address:               0x0
>>
>>This matches what ld.lld emits:
>>
>>   $ powerpc64le-linux-gnu-readelf -p .comment vdso{32,64}.so.dbg
>>
>>   File: vdso32.so.dbg
>>
>>   String dump of section '.comment':
>>     [     0]  Linker: LLD 14.0.0
>>     [    14]  clang version 14.0.0 (Fedora 14.0.0-1.fc37)
>>
>>   File: vdso64.so.dbg
>>
>>   String dump of section '.comment':
>>     [     0]  Linker: LLD 14.0.0
>>     [    14]  clang version 14.0.0 (Fedora 14.0.0-1.fc37)
>>
>>   $ llvm-readelf -h vdso{32,64}.so.dbg &| rg "(File|Entry point address):"
>>   File: vdso32.so.dbg
>>     Entry point address:               0x0
>>   File: vdso64.so.dbg
>>     Entry point address:               0x0
>>
>>Remove ENTRY to remove the warning, as it is unnecessary for the vDSO to
>>function correctly.

LGTM. e_entry for the vDSO (generally all shared objects, unless invoked
directly as the main executable) is unnecessary.

>Sounds more like a bugfix to me - _start is simply not defined, I 
>wonder why ld is not complaining.

This is a loose behavior in GNU ld. I know this but did not bother
filing a feature request.

Now that you mentioned it:) https://sourceware.org/bugzilla/show_bug.cgi?id=29136 (ld: ENTRY(no_such_symbol) in -shared mode does not report a warning)

>
>Tested-by: Alexey Kardashevskiy <aik at ozlabs.ru>
>Reviewed-by: Alexey Kardashevskiy <aik at ozlabs.ru>
>
>
>>
>>Signed-off-by: Nathan Chancellor <nathan at kernel.org>
>>---
>>  arch/powerpc/kernel/vdso/vdso32.lds.S | 1 -
>>  arch/powerpc/kernel/vdso/vdso64.lds.S | 1 -
>>  2 files changed, 2 deletions(-)
>>
>>diff --git a/arch/powerpc/kernel/vdso/vdso32.lds.S b/arch/powerpc/kernel/vdso/vdso32.lds.S
>>index 58e0099f70f4..e0d19d74455f 100644
>>--- a/arch/powerpc/kernel/vdso/vdso32.lds.S
>>+++ b/arch/powerpc/kernel/vdso/vdso32.lds.S
>>@@ -13,7 +13,6 @@ OUTPUT_FORMAT("elf32-powerpcle", "elf32-powerpcle", "elf32-powerpcle")
>>  OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
>>  #endif
>>  OUTPUT_ARCH(powerpc:common)
>>-ENTRY(_start)
>>  SECTIONS
>>  {
>>diff --git a/arch/powerpc/kernel/vdso/vdso64.lds.S b/arch/powerpc/kernel/vdso/vdso64.lds.S
>>index 0288cad428b0..1a4a7bc4c815 100644
>>--- a/arch/powerpc/kernel/vdso/vdso64.lds.S
>>+++ b/arch/powerpc/kernel/vdso/vdso64.lds.S
>>@@ -13,7 +13,6 @@ OUTPUT_FORMAT("elf64-powerpcle", "elf64-powerpcle", "elf64-powerpcle")
>>  OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc")
>>  #endif
>>  OUTPUT_ARCH(powerpc:common64)
>>-ENTRY(_start)
>>  SECTIONS
>>  {
>


More information about the Linuxppc-dev mailing list