From 21200d9fe6d5b8078b93dbddfbcdf536308b67e4 Mon Sep 17 00:00:00 2001 From: Jose Marinho Date: Tue, 5 Apr 2022 18:57:23 +0100 Subject: [PATCH] PrmPkg: Build Prm Samples with GCC for AARCH64 - Add the --prm flag to the GENFW_FLAGS - Add the --no-gc-section to the linker flags so that apparently unreferenced symbols are not prematurely removed from the .dll which is used to generate the Prm module .efi. - Force the linker to maintain the PrmModuleExportDescriptor symbol. - Force the linker to maintain the PRM handler funtion's symbol. Signed-off-by: Jose Marinho Signed-off-by: Sami Mujawar Reviewed-by: Michael Kubacki Reviewed-by: Ard Biesheuvel --- .../PrmSampleAcpiParameterBufferModule.inf | 4 ++++ .../PrmSampleContextBufferModule.inf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.inf b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.inf index e8b71a970d..04addecc86 100644 --- a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.inf +++ b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.inf @@ -7,6 +7,7 @@ # code at OS runtime. # # Copyright (c) Microsoft Corporation +# Copyright (c) 2022, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -39,3 +40,6 @@ [BuildOptions.common] MSFT:*_*_*_DLINK_FLAGS = /DLL /SUBSYSTEM:CONSOLE /VERSION:1.0 MSFT:*_*_*_GENFW_FLAGS = --keepoptionalheader + + GCC:*_*_AARCH64_GENFW_FLAGS = --prm + GCC:*_*_AARCH64_DLINK_FLAGS = -Wl,--no-gc-sections -Wl,--require-defined=PrmModuleExportDescriptor -Wl,--require-defined=CheckParamBufferPrmHandler diff --git a/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.inf b/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.inf index b97af923c4..ff72a23366 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.inf +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.inf @@ -7,6 +7,7 @@ # # Copyright (c) 2020, Intel Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation +# Copyright (c) 2022, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -42,3 +43,6 @@ [BuildOptions.common] MSFT:*_*_*_DLINK_FLAGS = /DLL /SUBSYSTEM:CONSOLE /VERSION:1.0 MSFT:*_*_*_GENFW_FLAGS = --keepoptionalheader + + GCC:*_*_AARCH64_GENFW_FLAGS = --keepoptionalheader --prm + GCC:*_*_AARCH64_DLINK_FLAGS = -Wl,--no-gc-sections -Wl,--require-defined=PrmModuleExportDescriptor -Wl,--require-defined=CheckStaticDataBufferPrmHandler