[PATCH v2 07/14] powerpc/vdso: Improve linker flags

Nathan Chancellor nathan at kernel.org
Wed Jan 25 03:14:52 AEDT 2023


On Mon, Jan 23, 2023 at 09:07:16AM -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Wed, Jan 11, 2023 at 08:05:04PM -0700, Nathan Chancellor wrote:
> > When clang's -Qunused-arguments is dropped from KBUILD_CPPFLAGS, there
> > are several warnings in the PowerPC vDSO:
> > 
> >   clang-16: error: -Wl,-soname=linux-vdso32.so.1: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> >   clang-16: error: -Wl,--hash-style=both: 'linker' input unused [-Werror,-Wunused-command-line-argument]
> >   clang-16: error: argument unused during compilation: '-shared' [-Werror,-Wunused-command-line-argument]
> > 
> >   clang-16: error: argument unused during compilation: '-nostdinc' [-Werror,-Wunused-command-line-argument]
> >   clang-16: error: argument unused during compilation: '-Wa,-maltivec' [-Werror,-Wunused-command-line-argument]
> 
> There is nothing wrong with the warnings, but as usual, -Werror is very
> counterproductive.
> 
> > The first group of warnings point out that linker flags were being added
> > to all invocations of $(CC), even though they will only be used during
> > the final vDSO link. Move those flags to ldflags-y.
> 
> Which is explicitly allowed, and won't do anything, so nothing harmful
> either.  It is not a bad idea to avoid this if that is trivial to do,
> of course.

I think this patch shows that it is trivial to do this, the primary core
of the diff is only a few lines.

> > The second group of warnings are compiler or assembler flags that will
> > be unused during linking. Filter them out from KBUILD_CFLAGS so that
> > they are not used during linking.
> 
> And here it is even more obviously fine.  If you need obfuscation like
> in your patch, it is better not to do this imo.

I do not think this patch really obfuscates anything? The filtering is
pretty clear to me.

If this is a real objection to the patch, I suppose we could just
localize '-Qunused-arguments' to this Makefile and be done with it but I
do not think this change is a bad solution to the problem either.

Cheers,
Nathan


More information about the Linuxppc-dev mailing list