Unfortunately, Clang does not support the use of symbol references in .org
directives, and bails with the following error message when it encounters
them:

  <...>:error: expected assembly-time absolute expression
  .org DebugAgentVectorTable + 0x000

So replace the .org arguments with absolute values, and move the whole
vector table into a subsection with the appropriate alignment, and
starting at .org 0x0. This gives the same protection with respect to
entries that exceed 128 bytes, in a way that Clang supports as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
---

Surprisingly, this worked fine in Clang-3.5 but not in 3.6 or 3.7

 ArmPkg/Include/Chipset/AArch64.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArch64.h
index 5e1653bcb69d..7be18546799c 100644
--- a/ArmPkg/Include/Chipset/AArch64.h
+++ b/ArmPkg/Include/Chipset/AArch64.h
@@ -119,15 +119,18 @@
 #define ARM_VECTOR_LOW_A32_SERR 0x780
 
 #define VECTOR_BASE(tbl)          \
+  .section .text.##tbl##,"aw";    \
   .align 11;                      \
+  .org 0x0;                       \
   GCC_ASM_EXPORT(tbl);            \
   ASM_PFX(tbl):                   \
 
 #define VECTOR_ENTRY(tbl, off)    \
-  .org ASM_PFX(tbl) + off
+  .org off
 
 #define VECTOR_END(tbl)           \
-  .org ASM_PFX(tbl) + 0x800
+  .org 0x800;                     \
+  .previous
 
 VOID
 EFIAPI
-- 
2.5.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to