* Re: [PATCH] s390: vDSO: Drop '-fPIC' from LDFLAGS
2024-01-31 3:14 [PATCH] s390: vDSO: Drop '-fPIC' from LDFLAGS Nathan Chancellor
@ 2024-01-31 3:28 ` Fangrui Song
2024-02-01 14:56 ` Heiko Carstens
2024-02-08 23:00 ` Justin Stitt
2 siblings, 0 replies; 4+ messages in thread
From: Fangrui Song @ 2024-01-31 3:28 UTC (permalink / raw)
To: Nathan Chancellor
Cc: hca, gor, agordeev, borntraeger, svens, ndesaulniers, morbo,
justinstitt, linux-s390, llvm, patches
On Tue, Jan 30, 2024 at 7:14 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> '-fPIC' as an option to the linker does not do what it seems like it
> should. With ld.bfd, it is treated as '-f PIC', which does not make
> sense based on the meaning of '-f':
>
> -f SHLIB, --auxiliary SHLIB Auxiliary filter for shared object symbol table
>
> When building with ld.lld (currently under review in a GitHub pull
> request), it just errors out because '-f' means nothing and neither does
> '-fPIC':
>
> ld.lld: error: unknown argument '-fPIC'
>
> '-fPIC' was blindly copied from CFLAGS when the vDSO stopped being
> linked with '$(CC)', it should not be needed. Remove it to clear up the
> build failure with ld.lld.
>
> Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
> Link: https://github.com/llvm/llvm-project/pull/75643
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Hi all,
>
> The LLVM folks are working on SystemZ support in ld.lld and this issue
> came up from my initial testing. There are also some other issues that I
> have come across in testing that I note in the GitHub pull request
> linked above. If they seem like kernel issues, any expertise or help
> would be greatly appreciated towards getting this working.
>
> Cheers,
> Nathan
> ---
> arch/s390/kernel/vdso32/Makefile | 2 +-
> arch/s390/kernel/vdso64/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
> index caec7db6f966..b12a274cbb47 100644
> --- a/arch/s390/kernel/vdso32/Makefile
> +++ b/arch/s390/kernel/vdso32/Makefile
> @@ -22,7 +22,7 @@ KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
> KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32))
> KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin
>
> -LDFLAGS_vdso32.so.dbg += -fPIC -shared -soname=linux-vdso32.so.1 \
> +LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \
> --hash-style=both --build-id=sha1 -melf_s390 -T
>
> $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
> diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
> index e3c9085f8fa7..caa4ebff8a19 100644
> --- a/arch/s390/kernel/vdso64/Makefile
> +++ b/arch/s390/kernel/vdso64/Makefile
> @@ -26,7 +26,7 @@ KBUILD_AFLAGS_64 += -m64
> KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
> KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64))
> KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
> -ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \
> +ldflags-y := -shared -soname=linux-vdso64.so.1 \
> --hash-style=both --build-id=sha1 -T
>
> $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
>
> ---
> base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3
> change-id: 20240130-s390-vdso-drop-fpic-from-ldflags-0338365b4bc5
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
>
Yeah, this is a problem of GNU ld using getopt_long with a
`required_argument` short option, and mixing one-dash and two-dash
long options...
There is also a grouped short option problem (-ts => -t -s, -st =>
`unrecognized option '-st'`), which I managed to nudge Nick Clifton
into implementing a warning for common misused cases...
Reviewed-by: Fangrui Song <maskray@google.com>
--
宋方睿
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] s390: vDSO: Drop '-fPIC' from LDFLAGS
2024-01-31 3:14 [PATCH] s390: vDSO: Drop '-fPIC' from LDFLAGS Nathan Chancellor
2024-01-31 3:28 ` Fangrui Song
@ 2024-02-01 14:56 ` Heiko Carstens
2024-02-08 23:00 ` Justin Stitt
2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2024-02-01 14:56 UTC (permalink / raw)
To: Nathan Chancellor
Cc: gor, agordeev, borntraeger, svens, ndesaulniers, morbo,
justinstitt, linux-s390, llvm, patches
On Tue, Jan 30, 2024 at 08:14:28PM -0700, Nathan Chancellor wrote:
> '-fPIC' as an option to the linker does not do what it seems like it
> should. With ld.bfd, it is treated as '-f PIC', which does not make
> sense based on the meaning of '-f':
>
> -f SHLIB, --auxiliary SHLIB Auxiliary filter for shared object symbol table
>
> When building with ld.lld (currently under review in a GitHub pull
> request), it just errors out because '-f' means nothing and neither does
> '-fPIC':
>
> ld.lld: error: unknown argument '-fPIC'
>
> '-fPIC' was blindly copied from CFLAGS when the vDSO stopped being
> linked with '$(CC)', it should not be needed. Remove it to clear up the
> build failure with ld.lld.
>
> Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
> Link: https://github.com/llvm/llvm-project/pull/75643
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Applied.
> Hi all,
>
> The LLVM folks are working on SystemZ support in ld.lld and this issue
> came up from my initial testing. There are also some other issues that I
> have come across in testing that I note in the GitHub pull request
> linked above. If they seem like kernel issues, any expertise or help
> would be greatly appreciated towards getting this working.
This is great news! Please feel free to involve us at any time.
We will do our best to help if possible.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] s390: vDSO: Drop '-fPIC' from LDFLAGS
2024-01-31 3:14 [PATCH] s390: vDSO: Drop '-fPIC' from LDFLAGS Nathan Chancellor
2024-01-31 3:28 ` Fangrui Song
2024-02-01 14:56 ` Heiko Carstens
@ 2024-02-08 23:00 ` Justin Stitt
2 siblings, 0 replies; 4+ messages in thread
From: Justin Stitt @ 2024-02-08 23:00 UTC (permalink / raw)
To: Nathan Chancellor
Cc: hca, gor, agordeev, borntraeger, svens, ndesaulniers, morbo,
linux-s390, llvm, patches
On Tue, Jan 30, 2024 at 7:14 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> '-fPIC' as an option to the linker does not do what it seems like it
> should. With ld.bfd, it is treated as '-f PIC', which does not make
> sense based on the meaning of '-f':
>
> -f SHLIB, --auxiliary SHLIB Auxiliary filter for shared object symbol table
>
> When building with ld.lld (currently under review in a GitHub pull
> request), it just errors out because '-f' means nothing and neither does
> '-fPIC':
>
> ld.lld: error: unknown argument '-fPIC'
>
> '-fPIC' was blindly copied from CFLAGS when the vDSO stopped being
> linked with '$(CC)', it should not be needed. Remove it to clear up the
> build failure with ld.lld.
>
> Fixes: 2b2a25845d53 ("s390/vdso: Use $(LD) instead of $(CC) to link vDSO")
> Link: https://github.com/llvm/llvm-project/pull/75643
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Yep, fixes the problems I was having with ld.lld.
Reviewed-by: Justin Stitt <justinstitt@google.com>
> ---
> Hi all,
>
> The LLVM folks are working on SystemZ support in ld.lld and this issue
> came up from my initial testing. There are also some other issues that I
> have come across in testing that I note in the GitHub pull request
> linked above. If they seem like kernel issues, any expertise or help
> would be greatly appreciated towards getting this working.
>
> Cheers,
> Nathan
> ---
> arch/s390/kernel/vdso32/Makefile | 2 +-
> arch/s390/kernel/vdso64/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
> index caec7db6f966..b12a274cbb47 100644
> --- a/arch/s390/kernel/vdso32/Makefile
> +++ b/arch/s390/kernel/vdso32/Makefile
> @@ -22,7 +22,7 @@ KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
> KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32))
> KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin
>
> -LDFLAGS_vdso32.so.dbg += -fPIC -shared -soname=linux-vdso32.so.1 \
> +LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \
> --hash-style=both --build-id=sha1 -melf_s390 -T
>
> $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
> diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
> index e3c9085f8fa7..caa4ebff8a19 100644
> --- a/arch/s390/kernel/vdso64/Makefile
> +++ b/arch/s390/kernel/vdso64/Makefile
> @@ -26,7 +26,7 @@ KBUILD_AFLAGS_64 += -m64
> KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
> KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64))
> KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
> -ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \
> +ldflags-y := -shared -soname=linux-vdso64.so.1 \
> --hash-style=both --build-id=sha1 -T
>
> $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
>
> ---
> base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3
> change-id: 20240130-s390-vdso-drop-fpic-from-ldflags-0338365b4bc5
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
^ permalink raw reply [flat|nested] 4+ messages in thread