I have to admit that on my previous patchset I was saddened that I had to 
resort to a #define to solve this since it's counter to the codebase convention 
but this was the only way to get conditional assembly of the .align directive.  
Since inline #ifdefs were also counter to the codebase convention I figured a 
global initialized conditionally would be more familiar (like a boolean PCD) 
but I hadn't considered the optimization impact.

Reviewed-by: Eugene Cohen <eug...@hp.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Thursday, March 17, 2016 7:20 AM
> To: edk2-devel@lists.01.org; leif.lindh...@linaro.org; Cohen, Eugene
> <eug...@hp.com>
> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
> Subject: [edk2] [PATCH 5/7] ArmPkg/ArmExceptionLib: make build time
> define visible to the compiler
> 
> The global gArmRelocateVectorTable is a build time constant, but due to its
> external linkage and lack of constness, the compiler does not see that.
> So turn it into a static boolean, and at the same time, make the function
> CopyExceptionHandlers() (which is only called if gArmRelocateVectorTable is
> set) static as well, so that the compiler can eliminate it completely if we 
> are
> using the vector table in place.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
> ---
>  ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> index 5977a3e8fae1..0cf0766b9cbf 100644
> --- a/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> +++ b/ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.c
> @@ -26,6 +26,7 @@
>  #include <Library/DebugLib.h>
>  #include <Library/DefaultExceptionHandlerLib.h>
> 
> +STATIC
>  RETURN_STATUS
>  CopyExceptionHandlers(
>    IN  PHYSICAL_ADDRESS        BaseAddress
> @@ -66,9 +67,9 @@ extern UINTN                    gDebuggerNoHandlerValue;
>  // library we cannot represent this in a PCD since PCDs are evaluated on  // 
> a
> per-module basis.
>  #if defined(ARM_RELOCATE_VECTORS)
> -BOOLEAN gArmRelocateVectorTable = TRUE;
> +STATIC CONST BOOLEAN gArmRelocateVectorTable = TRUE;
>  #else
> -BOOLEAN gArmRelocateVectorTable = FALSE;
> +STATIC CONST BOOLEAN gArmRelocateVectorTable = FALSE;
>  #endif
> 
> 
> @@ -151,6 +152,7 @@ with default exception handlers.
>  @retval EFI_UNSUPPORTED       This function is not supported.
> 
>  **/
> +STATIC
>  RETURN_STATUS
>  CopyExceptionHandlers(
>    IN  PHYSICAL_ADDRESS        BaseAddress
> --
> 2.5.0
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to