From: Ard Biesheuvel Date: Wed, 12 Dec 2018 10:04:44 +0000 (+0100) Subject: MdePkg/BaseMemoryLibOptDxe ARM: add missing function annotations X-Git-Tag: edk2-stable201903~483 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=decaac5d0d4a5ae348035a33e820ffd902103383;ds=sidebyside MdePkg/BaseMemoryLibOptDxe ARM: add missing function annotations ARM uses the low order bit of a branch target address to decide in which execution mode (ARM or Thumb) a function needs to be called. In order for this to work across object files, ELF function symbols will have the low bit set if they were emitted in Thumb mode and cleared otherwise. This annotation is only emitted if the ELF symbols are annotated as function, since taking the address of some data symbol (e.g., a literal) should not produce a value with the low bit set, even if it appears in an object file containing Thumb code. This means that all functions coded in assembler must have this function annotation, or they may end up getting called in the wrong mode, crashing the program. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Acked-by: Laszlo Ersek Reviewed-by: Leif Lindholm Reviewed-by: Liming Gao --- diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S index 6d0089049d..b74056fa1f 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S @@ -30,6 +30,7 @@ .thumb .syntax unified .align 5 + .type ASM_PFX(InternalMemCompareGuid), %function ASM_GLOBAL ASM_PFX(InternalMemCompareGuid) ASM_PFX(InternalMemCompareGuid): push {r4, lr} diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S index 9483aab61a..25a9a09945 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S @@ -46,6 +46,7 @@ .thumb .syntax unified .align 5 + .type ASM_PFX(InternalMemCompareMem), %function ASM_GLOBAL ASM_PFX(InternalMemCompareMem) ASM_PFX(InternalMemCompareMem): push {r4-r8, lr} diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S index 195a0b23f7..e1543f3c2a 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S @@ -42,6 +42,7 @@ InternalMemCopyMem ( IN UINTN Length ) **/ + .type ASM_PFX(InternalMemCopyMem), %function ASM_GLOBAL ASM_PFX(InternalMemCopyMem) ASM_PFX(InternalMemCopyMem): push {r4-r11, lr} diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S index 2d8f4d5b86..928c1a12d5 100644 --- a/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S +++ b/MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S @@ -16,6 +16,7 @@ .thumb .syntax unified .align 5 + .type ASM_PFX(InternalMemSetMem16), %function ASM_GLOBAL ASM_PFX(InternalMemSetMem16) ASM_PFX(InternalMemSetMem16): uxth r2, r2 @@ -23,17 +24,20 @@ ASM_PFX(InternalMemSetMem16): orr r2, r2, r2, lsl #16 b 0f + .type ASM_PFX(InternalMemSetMem32), %function ASM_GLOBAL ASM_PFX(InternalMemSetMem32) ASM_PFX(InternalMemSetMem32): lsl r1, r1, #2 b 0f + .type ASM_PFX(InternalMemSetMem64), %function ASM_GLOBAL ASM_PFX(InternalMemSetMem64) ASM_PFX(InternalMemSetMem64): lsl r1, r1, #3 b 1f .align 5 + .type ASM_PFX(InternalMemSetMem), %function ASM_GLOBAL ASM_PFX(InternalMemSetMem) ASM_PFX(InternalMemSetMem): uxtb r2, r2 @@ -41,6 +45,7 @@ ASM_PFX(InternalMemSetMem): orr r2, r2, r2, lsl #16 b 0f + .type ASM_PFX(InternalMemZeroMem), %function ASM_GLOBAL ASM_PFX(InternalMemZeroMem) ASM_PFX(InternalMemZeroMem): movs r2, #0