From 84572a0c798181ba59bf6d8af1cad35a86153cf7 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Mon, 26 Sep 2022 15:49:56 -0700 Subject: [PATCH] ANDROID: fips140: split dump-section+add-section into 2 ops It looks like llvm-objcopy regressed the ability to simultaneously dump then re-add a section with a new name. Prefer 2 invocations of $(OBJCOPY); dump-sections in the first, add-section and set-section-flags in the second. This copies the sections rather than rename them. Test: BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.i686 build/build.sh Bug: 247603894 Link: https://reviews.llvm.org/D120486 Suggested-by: Eric Biggers Suggested-by: Fangrui Song Signed-off-by: Nick Desaulniers Change-Id: I7f102f05b048b6c5f7aaeb0e438af84c2d2b4d1a --- arch/arm64/Makefile.postlink | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/Makefile.postlink b/arch/arm64/Makefile.postlink index a13789148bfb..8cf297fb7dd9 100644 --- a/arch/arm64/Makefile.postlink +++ b/arch/arm64/Makefile.postlink @@ -20,7 +20,8 @@ CMD_FIPS140_GEN_HMAC = crypto/fips140_gen_hmac quiet_cmd_gen_hmac = HMAC $@ cmd_gen_hmac = $(OBJCOPY) $@ \ --dump-section=$(shell $(READELF) -SW $@|grep -Eo '\.rela\.text\S*')=$@.rela.text \ - --dump-section=$(shell $(READELF) -SW $@|grep -Eo '\.rela\.rodata\S*')=$@.rela.rodata \ + --dump-section=$(shell $(READELF) -SW $@|grep -Eo '\.rela\.rodata\S*')=$@.rela.rodata && \ + $(OBJCOPY) $@ \ --add-section=.init.rela.text=$@.rela.text \ --add-section=.init.rela.rodata=$@.rela.rodata \ --set-section-flags=.init.rela.text=alloc,readonly \