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.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Eugene Cohen <eugene@hp.com>
This commit is contained in:
Ard Biesheuvel 2016-03-17 11:33:58 +01:00
parent 2187f9a052
commit 8a771a2e39
1 changed files with 4 additions and 2 deletions

View File

@ -26,6 +26,7 @@
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/DefaultExceptionHandlerLib.h> #include <Library/DefaultExceptionHandlerLib.h>
STATIC
RETURN_STATUS RETURN_STATUS
CopyExceptionHandlers( CopyExceptionHandlers(
IN PHYSICAL_ADDRESS BaseAddress IN PHYSICAL_ADDRESS BaseAddress
@ -66,9 +67,9 @@ extern UINTN gDebuggerNoHandlerValue;
// library we cannot represent this in a PCD since PCDs are evaluated on // library we cannot represent this in a PCD since PCDs are evaluated on
// a per-module basis. // a per-module basis.
#if defined(ARM_RELOCATE_VECTORS) #if defined(ARM_RELOCATE_VECTORS)
BOOLEAN gArmRelocateVectorTable = TRUE; STATIC CONST BOOLEAN gArmRelocateVectorTable = TRUE;
#else #else
BOOLEAN gArmRelocateVectorTable = FALSE; STATIC CONST BOOLEAN gArmRelocateVectorTable = FALSE;
#endif #endif
@ -151,6 +152,7 @@ with default exception handlers.
@retval EFI_UNSUPPORTED This function is not supported. @retval EFI_UNSUPPORTED This function is not supported.
**/ **/
STATIC
RETURN_STATUS RETURN_STATUS
CopyExceptionHandlers( CopyExceptionHandlers(
IN PHYSICAL_ADDRESS BaseAddress IN PHYSICAL_ADDRESS BaseAddress