Re: [GIT PULL] License cleanup: add SPDX license identifiers to some kernel files

From: Linus Torvalds
Date: Thu Nov 02 2017 - 14:53:58 EST


On Thu, Nov 2, 2017 at 11:21 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> The wreckage is with the *.lds.S ones which are used to generate .lds with
> some gcc preprocessor magic. And then ld falls flat on its nose with the //
> comment.

The cpp phase should just get rid of them.

But we actually explicitly use "cpp -C" for the lds file to keep
comments around. Which makes no sense to me, but there it is.

That is *completely* crazy. I wonder why we do that brain-damage.

Literally just removing that -C fixes the problem:

- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -C -U$(ARCH) \
+ cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \

and there is no reason to keep them that I can possibly see.

Seriously, we should fix that regardless, but if it actually keeps us
from having C++ style comments in header files that might be included
in lds.S files, we should _definitely_ fix it.

It seems to be a historical oddity. The "-C" was added in 51b563fc93c8
("arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash
4.0"), but it came from our old

export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)

which predates the git history.

Hmm.. Digging down, long long ago we used to do

arch/$(ARCH)/vmlinux.lds.s: arch/$(ARCH)/vmlinux.lds.S
$(CPP) $(CPPFLAGS) $(CPPFLAGS_$@) -P -C -U$(ARCH) $< -o $@

and that's where the -C comes from. And *that* came from MIPS, ia64
and sh doing so back in 2002.

But they used to use "-traditional" too.

So I'm pretty sure that the whole stupid "-C" is just a bogus result
of history that should have been gotten rid of long long long ago.

Linus