Skip to content

Commit

Permalink
ArmPkg: Include: Add CLANGPDB Support in Assembly Macros
Browse files Browse the repository at this point in the history
The change will guard the CLANG-unsupported directives outside of the
__clang__ macro define.

This change does not have functional change other than minimal section
literals.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
  • Loading branch information
kuqin12 committed Jun 5, 2024
1 parent 8f20fe3 commit 40a19d1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ArmPkg/Include/AsmMacroIoLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@
#ifndef ASM_MACRO_IO_LIB_H_
#define ASM_MACRO_IO_LIB_H_

#ifndef __clang__ // MU_CHANGE
#define _ASM_FUNC(Name, Section) \
.global Name ; \
.section #Section, "ax" ; \
.type Name, %function ; \
.p2align 2 ; \
Name:
// MU_CHANGE Starts: CLANGPDB support
#else
#define _ASM_FUNC(Name, Section) \
.global Name ; \
.section #Section, "ax" ; \
.p2align 2 ; \
Name:
#endif
// MU_CHANGE Ends

#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)

Expand Down
21 changes: 21 additions & 0 deletions ArmPkg/Include/AsmMacroIoLibV8.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,41 @@ bgt %b6 __CR__ \

#if !defined (_MSC_VER)

#ifndef __clang__ // MU_CHANGE
#define _ASM_FUNC(Name, Section) \
.global Name ; \
.section #Section, "ax" ; \
.type Name, %function ; \
Name: ; \
AARCH64_BTI(c)
// MU_CHANGE Starts: CLANGPDB support
#else
#define _ASM_FUNC(Name, Section) \
.global Name ; \
.section #Section, "ax" ; \
Name: ; \
AARCH64_BTI(c)
#endif
// MU_CHANGE Ends

#ifndef __clang__ // MU_CHANGE
#define _ASM_FUNC_ALIGN(Name, Section, Align) \
.global Name ; \
.section #Section, "ax" ; \
.type Name, %function ; \
.balign Align ; \
Name: ; \
AARCH64_BTI(c)
// MU_CHANGE Starts: CLANGPDB support
#else
#define _ASM_FUNC_ALIGN(Name, Section, Align) \
.global Name ; \
.section #Section, "ax" ; \
.balign Align ; \
Name: ; \
AARCH64_BTI(c)
#endif
// MU_CHANGE Ends

#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)

Expand Down
9 changes: 9 additions & 0 deletions ArmPkg/Include/Chipset/AArch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,18 @@
#define VECTOR_ENTRY(tbl, off) \
.org off

#ifndef __clang__ // MU_CHANGE
#define VECTOR_END(tbl) \
.org 0x800; \
.previous
// MU_CHANGE Starts: CLANGPDB support
#else
#define VECTOR_END(tbl) \
.org 0x800; \
.section .text.##tbl##,"ax"; \
.align 3
#endif
// MU_CHANGE Ends

#else

Expand Down

0 comments on commit 40a19d1

Please sign in to comment.