]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/BaseMemoryLibOptDxe ARM: add missing function annotations
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 12 Dec 2018 10:04:44 +0000 (11:04 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 13 Dec 2018 11:45:49 +0000 (12:45 +0100)
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 <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareGuid.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CompareMem.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/CopyMem.S
MdePkg/Library/BaseMemoryLibOptDxe/Arm/SetMem.S

index 6d0089049d48134dab034e51ff5f13b9362f8b5b..b74056fa1f5ff4e72e27a3acba20c50f929ff349 100644 (file)
@@ -30,6 +30,7 @@
     .thumb\r
     .syntax unified\r
     .align  5\r
+    .type   ASM_PFX(InternalMemCompareGuid), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemCompareGuid)\r
 ASM_PFX(InternalMemCompareGuid):\r
     push    {r4, lr}\r
index 9483aab61a0c8810bf0bdc75e4e5a791081c84b6..25a9a09945241dad16edc050e37d0915fa6cd275 100644 (file)
@@ -46,6 +46,7 @@
     .thumb\r
     .syntax unified\r
     .align  5\r
+    .type   ASM_PFX(InternalMemCompareMem), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemCompareMem)\r
 ASM_PFX(InternalMemCompareMem):\r
     push    {r4-r8, lr}\r
index 195a0b23f770a30a6dbb2fcdb83d1d5ef55c9d39..e1543f3c2a43dd0340a03359ede28649f1ae8122 100644 (file)
@@ -42,6 +42,7 @@ InternalMemCopyMem (
   IN      UINTN                     Length\r
   )\r
 **/\r
+    .type   ASM_PFX(InternalMemCopyMem), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemCopyMem)\r
 ASM_PFX(InternalMemCopyMem):\r
     push    {r4-r11, lr}\r
index 2d8f4d5b86213df2ad8a01f1b42c7974a0b41baf..928c1a12d5581d5ac97379ebae71d48d9ea0d1d3 100644 (file)
@@ -16,6 +16,7 @@
     .thumb\r
     .syntax unified\r
     .align  5\r
+    .type   ASM_PFX(InternalMemSetMem16), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemSetMem16)\r
 ASM_PFX(InternalMemSetMem16):\r
     uxth    r2, r2\r
@@ -23,17 +24,20 @@ ASM_PFX(InternalMemSetMem16):
     orr     r2, r2, r2, lsl #16\r
     b       0f\r
 \r
+    .type   ASM_PFX(InternalMemSetMem32), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemSetMem32)\r
 ASM_PFX(InternalMemSetMem32):\r
     lsl     r1, r1, #2\r
     b       0f\r
 \r
+    .type   ASM_PFX(InternalMemSetMem64), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemSetMem64)\r
 ASM_PFX(InternalMemSetMem64):\r
     lsl     r1, r1, #3\r
     b       1f\r
 \r
     .align  5\r
+    .type   ASM_PFX(InternalMemSetMem), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemSetMem)\r
 ASM_PFX(InternalMemSetMem):\r
     uxtb    r2, r2\r
@@ -41,6 +45,7 @@ ASM_PFX(InternalMemSetMem):
     orr     r2, r2, r2, lsl #16\r
     b       0f\r
 \r
+    .type   ASM_PFX(InternalMemZeroMem), %function\r
 ASM_GLOBAL ASM_PFX(InternalMemZeroMem)\r
 ASM_PFX(InternalMemZeroMem):\r
     movs    r2, #0\r