# Re: \[PATCH v5 16/17\] arm64: compile the kernel with ptrauth return address signing

- From: Vincenzo Frascino \<vincenzo.frascino@arm.com\>
- Date: 2020-03-04 10:53:08 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2020/03/8791740
- Thread: https://ratatoskr.run/linux-arm-kernel/2020/02/8791161/t.md

```text
Hi Catalin,

On 2/28/20 6:23 PM, Catalin Marinas wrote:
> On Mon, Feb 17, 2020 at 02:57:47PM +0530, Amit Daniel Kachhap wrote:
>> +ifeq ($(CONFIG_ARM64_PTR_AUTH),y)
>> +branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all
>> +branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf
>> +# -march=armv8.3-a enables the non-nops instructions for PAC, to avoid the compiler
>> +# to generate them and consequently to break the single image contract we pass it
>> +# only to the assembler when clang is selected as a compiler. For the GNU toolchain
>> +# this option is not used.
>> +branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
>> +KBUILD_CFLAGS += $(branch-prot-flags-y)
>> +endif
> 
> Does this work with the clang integrated assembler? AFAIK it ignores the
> -Wa, though it may be fine with the instructions generated by the
> compiler. (while we don't officially support it, we merged patches to
> facilitate it).
> 

The kernel is currently built with "-no-integrated-as" (Makefile +538) when
clang is selected. This means that the only assembler supported is the one
provide by binutils in this scenario.

The only patch series that I am aware of that is trying to do something with the
integrated as is [1] that uses it for inline assembly when LTO is enabled
(mainly for Android kernels at the moment). And this series is still being
reviewed.

Curiosity, which one is the series you are referring to? And how do I enable the
clang assembler for building the kernel?

[1] https://github.com/samitolvanen/linux/commits/clang-cfi

-- 
Regards,
Vincenzo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
