Re: [PATCH v2 02/10] arm64: asm: Override SYM_FUNC_START when building the kernel with BTI

Mark Brown
2020-05-06T11:44:00Z

[-- Attachment #1.1: Type: text/plain, Size: 2125 bytes --]

On Wed, May 06, 2020 at 11:50:06AM +0100, Will Deacon wrote:
> On Wed, May 06, 2020 at 11:41:52AM +0100, Mark Brown wrote:

> > Well, the theory behind the warning is that if the compiler is emitting
> > code suitable for the features described in the note then it should
> > always emit the appropriate annotations so the warning is more intended
> > to be telling the user that the code is trying to link in code that's
> > not built properly and will most likely fail at runtime. In the current

> Hmm, I suppose, although it's a bit belt-and-braces given that we've got
> the right options in KBUILD_CFLAGS. What about:

We know we're doing fine but the warning is being emitted by the linker
rather than something in the kernel tree and it doesn't know what the
users are or that they invoked their compilers correctly.

> "Your compiler is not emitting '.note.gnu.property' sections: forcing
> support for BTI in the linker, but check your CFLAGS and consider
> upgrading your toolchain."

> I'd usually not be too bothered, but having run into this yesterday and
> not understood the problem, I'd like to save somebody else from puzzling
> over this if we can!

That's a bit C specific - CFLAGS isn't going to apply to other
languages and binutils could be linking pretty much anything. TBH I'd
expect one of the common cases would be assembler given the pain
involved in generating notes. Possibly "build configuration and
toolchain" instead but that's also pretty vague so might not help much
with people being confused? Either way any diagnostic change would be a
binutils change, I've flagged this up to the toolchain people
internally.

I do think that this will be a lot easier going forwards - hopefully the
problem with the toolchain not generating notes is not going to be an
issue by the time people are actively deploying BTI (people using GCC
are going to need a shiny new version anyway and I don't know how
widespread the clang versions that have issues are), and if people do
start running into it then it'll be possible to usefully search for the
error message online which should help a lot.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]