public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: devel@edk2.groups.io
Cc: jian.j.wang@intel.com, hao.a.wu@intel.com,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [PATCH 1/2] MdeModulePkg/DxeCore/Image: make local functions STATIC
Date: Thu,  9 Apr 2020 18:09:47 +0200	[thread overview]
Message-ID: <20200409160948.23427-2-ard.biesheuvel@arm.com> (raw)
In-Reply-To: <20200409160948.23427-1-ard.biesheuvel@arm.com>

Use static linkage for functions that are only used locally, to help
the compiler optimize away unused code in non-LTO builds.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
 MdeModulePkg/Core/Dxe/Image/Image.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index d86da89ee704..aae2c1eaa516 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -86,6 +86,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED MACHINE_TYPE_INFO  mMachineTypeInfo[] = {
 
 UINT16 mDxeCoreImageMachineType = 0;
 
+#ifndef MDEPKG_NDEBUG
 /**
  Return machine type name.
 
@@ -93,6 +94,7 @@ UINT16 mDxeCoreImageMachineType = 0;
 
  @return machine type name
 **/
+STATIC
 CHAR16 *
 GetMachineTypeName (
   UINT16 MachineType
@@ -108,6 +110,7 @@ GetMachineTypeName (
 
   return L"<Unknown>";
 }
+#endif
 
 /**
   Notification event handler registered by CoreInitializeImageServices () to
@@ -286,6 +289,7 @@ CoreInitializeImageServices (
                                  into buffer.
 
 **/
+STATIC
 EFI_STATUS
 EFIAPI
 CoreReadImageFile (
@@ -334,6 +338,7 @@ CoreReadImageFile (
   @retval EFI_SUCCESS              The memory range the image will be loaded in is available
   @retval EFI_NOT_FOUND            The memory range the image will be loaded in is not available
 **/
+STATIC
 EFI_STATUS
 CheckAndMarkFixLoadingMemoryUsageBitMap (
   IN  EFI_PHYSICAL_ADDRESS          ImageBase,
@@ -407,6 +412,7 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
   @retval EFI_NOT_FOUND             The image has no assigned fixed loading address.
 
 **/
+STATIC
 EFI_STATUS
 GetPeCoffImageFixLoadingAssignedAddress(
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
@@ -552,6 +558,7 @@ CoreIsImageTypeSupported (
   @retval EFI_BUFFER_TOO_SMALL    Buffer for image is too small
 
 **/
+STATIC
 EFI_STATUS
 CoreLoadPeImage (
   IN BOOLEAN                     BootPolicy,
@@ -877,6 +884,7 @@ CoreLoadPeImage (
   @return Return the image private data associated with ImageHandle.
 
 **/
+STATIC
 LOADED_IMAGE_PRIVATE_DATA *
 CoreLoadedImageInfo (
   IN EFI_HANDLE  ImageHandle
@@ -909,6 +917,7 @@ CoreLoadedImageInfo (
   @param  FreePage                Free allocated pages
 
 **/
+STATIC
 VOID
 CoreUnloadAndCloseImage (
   IN LOADED_IMAGE_PRIVATE_DATA  *Image,
@@ -1105,6 +1114,7 @@ CoreUnloadAndCloseImage (
                                   platform policy specifies that the image should not be started.
 
 **/
+STATIC
 EFI_STATUS
 CoreLoadImageCommon (
   IN  BOOLEAN                          BootPolicy,
-- 
2.17.1


  reply	other threads:[~2020-04-09 16:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 16:09 [PATCH 0/2] MdeModulePkg/DxeCore: clean up image loading functions Ard Biesheuvel
2020-04-09 16:09 ` Ard Biesheuvel [this message]
2020-04-09 19:13   ` [EXTERNAL] [edk2-devel] [PATCH 1/2] MdeModulePkg/DxeCore/Image: make local functions STATIC Bret Barkelew
2020-04-09 16:09 ` [PATCH 2/2] MdeModulePkg/DxeCore/Image: remove unused function arguments Ard Biesheuvel
2020-04-09 19:14   ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-06-01  8:13   ` Dandan Bi
2020-04-10 13:59 ` [edk2-devel] [PATCH 0/2] MdeModulePkg/DxeCore: clean up image loading functions Liming Gao
2020-04-10 14:20   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200409160948.23427-2-ard.biesheuvel@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox