diff mbox series

[edk2] MdePkg: Arm/AArch64 - filter #pragma pack() when __ASSEMBLER__

Message ID 20171206170745.8705-1-leif.lindholm@linaro.org
State Accepted
Commit 5b8766bb92debfa7b2f45a4a6d683b4227360d66
Headers show
Series [edk2] MdePkg: Arm/AArch64 - filter #pragma pack() when __ASSEMBLER__ | expand

Commit Message

Leif Lindholm Dec. 6, 2017, 5:07 p.m. UTC
clang, when used as a preprocessor for dtc, does not discard #pragma
statements although -x assembler-with-cpp is specified. This causes dtc
to barf at a #pragma pack() statement that is already filtered out for
__GNUC__. So add a check to also filter this out if __ASSEMBLER__.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 MdePkg/Include/AArch64/ProcessorBind.h | 2 +-
 MdePkg/Include/Arm/ProcessorBind.h     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ard Biesheuvel Dec. 6, 2017, 5:09 p.m. UTC | #1
On 6 December 2017 at 17:07, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> clang, when used as a preprocessor for dtc, does not discard #pragma

> statements although -x assembler-with-cpp is specified. This causes dtc

> to barf at a #pragma pack() statement that is already filtered out for

> __GNUC__. So add a check to also filter this out if __ASSEMBLER__.

>

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>


Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


> ---

>  MdePkg/Include/AArch64/ProcessorBind.h | 2 +-

>  MdePkg/Include/Arm/ProcessorBind.h     | 2 +-

>  2 files changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h

> index 775e7498c5..7b0f0ff32f 100644

> --- a/MdePkg/Include/AArch64/ProcessorBind.h

> +++ b/MdePkg/Include/AArch64/ProcessorBind.h

> @@ -26,7 +26,7 @@

>  //

>  // Make sure we are using the correct packing rules per EFI specification

>  //

> -#ifndef __GNUC__

> +#if !defined(__GNUC__) && !defined(__ASSEMBLER__)

>  #pragma pack()

>  #endif

>

> diff --git a/MdePkg/Include/Arm/ProcessorBind.h b/MdePkg/Include/Arm/ProcessorBind.h

> index dde1fd1152..42ea2f3055 100644

> --- a/MdePkg/Include/Arm/ProcessorBind.h

> +++ b/MdePkg/Include/Arm/ProcessorBind.h

> @@ -24,7 +24,7 @@

>  //

>  // Make sure we are using the correct packing rules per EFI specification

>  //

> -#ifndef __GNUC__

> +#if !defined(__GNUC__) && !defined(__ASSEMBLER__)

>  #pragma pack()

>  #endif

>

> --

> 2.11.0

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Gao, Liming Dec. 7, 2017, 3:09 a.m. UTC | #2
Reviewed-by: Liming Gao <liming.gao@intel.com>


>-----Original Message-----

>From: Leif Lindholm [mailto:leif.lindholm@linaro.org]

>Sent: Thursday, December 07, 2017 1:08 AM

>To: edk2-devel@lists.01.org

>Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming

><liming.gao@intel.com>; ard.biesheuvel@linaro.org

>Subject: [PATCH] MdePkg: Arm/AArch64 - filter #pragma pack() when

>__ASSEMBLER__

>

>clang, when used as a preprocessor for dtc, does not discard #pragma

>statements although -x assembler-with-cpp is specified. This causes dtc

>to barf at a #pragma pack() statement that is already filtered out for

>__GNUC__. So add a check to also filter this out if __ASSEMBLER__.

>

>Contributed-under: TianoCore Contribution Agreement 1.1

>Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

>---

> MdePkg/Include/AArch64/ProcessorBind.h | 2 +-

> MdePkg/Include/Arm/ProcessorBind.h     | 2 +-

> 2 files changed, 2 insertions(+), 2 deletions(-)

>

>diff --git a/MdePkg/Include/AArch64/ProcessorBind.h

>b/MdePkg/Include/AArch64/ProcessorBind.h

>index 775e7498c5..7b0f0ff32f 100644

>--- a/MdePkg/Include/AArch64/ProcessorBind.h

>+++ b/MdePkg/Include/AArch64/ProcessorBind.h

>@@ -26,7 +26,7 @@

> //

> // Make sure we are using the correct packing rules per EFI specification

> //

>-#ifndef __GNUC__

>+#if !defined(__GNUC__) && !defined(__ASSEMBLER__)

> #pragma pack()

> #endif

>

>diff --git a/MdePkg/Include/Arm/ProcessorBind.h

>b/MdePkg/Include/Arm/ProcessorBind.h

>index dde1fd1152..42ea2f3055 100644

>--- a/MdePkg/Include/Arm/ProcessorBind.h

>+++ b/MdePkg/Include/Arm/ProcessorBind.h

>@@ -24,7 +24,7 @@

> //

> // Make sure we are using the correct packing rules per EFI specification

> //

>-#ifndef __GNUC__

>+#if !defined(__GNUC__) && !defined(__ASSEMBLER__)

> #pragma pack()

> #endif

>

>--

>2.11.0


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Dec. 7, 2017, 11:33 a.m. UTC | #3
On Thu, Dec 07, 2017 at 03:09:17AM +0000, Gao, Liming wrote:
> Reviewed-by: Liming Gao <liming.gao@intel.com>


Thanks!

Pushed as 5b8766bb92.

> >-----Original Message-----

> >From: Leif Lindholm [mailto:leif.lindholm@linaro.org]

> >Sent: Thursday, December 07, 2017 1:08 AM

> >To: edk2-devel@lists.01.org

> >Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming

> ><liming.gao@intel.com>; ard.biesheuvel@linaro.org

> >Subject: [PATCH] MdePkg: Arm/AArch64 - filter #pragma pack() when

> >__ASSEMBLER__

> >

> >clang, when used as a preprocessor for dtc, does not discard #pragma

> >statements although -x assembler-with-cpp is specified. This causes dtc

> >to barf at a #pragma pack() statement that is already filtered out for

> >__GNUC__. So add a check to also filter this out if __ASSEMBLER__.

> >

> >Contributed-under: TianoCore Contribution Agreement 1.1

> >Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> >---

> > MdePkg/Include/AArch64/ProcessorBind.h | 2 +-

> > MdePkg/Include/Arm/ProcessorBind.h     | 2 +-

> > 2 files changed, 2 insertions(+), 2 deletions(-)

> >

> >diff --git a/MdePkg/Include/AArch64/ProcessorBind.h

> >b/MdePkg/Include/AArch64/ProcessorBind.h

> >index 775e7498c5..7b0f0ff32f 100644

> >--- a/MdePkg/Include/AArch64/ProcessorBind.h

> >+++ b/MdePkg/Include/AArch64/ProcessorBind.h

> >@@ -26,7 +26,7 @@

> > //

> > // Make sure we are using the correct packing rules per EFI specification

> > //

> >-#ifndef __GNUC__

> >+#if !defined(__GNUC__) && !defined(__ASSEMBLER__)

> > #pragma pack()

> > #endif

> >

> >diff --git a/MdePkg/Include/Arm/ProcessorBind.h

> >b/MdePkg/Include/Arm/ProcessorBind.h

> >index dde1fd1152..42ea2f3055 100644

> >--- a/MdePkg/Include/Arm/ProcessorBind.h

> >+++ b/MdePkg/Include/Arm/ProcessorBind.h

> >@@ -24,7 +24,7 @@

> > //

> > // Make sure we are using the correct packing rules per EFI specification

> > //

> >-#ifndef __GNUC__

> >+#if !defined(__GNUC__) && !defined(__ASSEMBLER__)

> > #pragma pack()

> > #endif

> >

> >--

> >2.11.0

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h
index 775e7498c5..7b0f0ff32f 100644
--- a/MdePkg/Include/AArch64/ProcessorBind.h
+++ b/MdePkg/Include/AArch64/ProcessorBind.h
@@ -26,7 +26,7 @@ 
 //
 // Make sure we are using the correct packing rules per EFI specification
 //
-#ifndef __GNUC__
+#if !defined(__GNUC__) && !defined(__ASSEMBLER__)
 #pragma pack()
 #endif
 
diff --git a/MdePkg/Include/Arm/ProcessorBind.h b/MdePkg/Include/Arm/ProcessorBind.h
index dde1fd1152..42ea2f3055 100644
--- a/MdePkg/Include/Arm/ProcessorBind.h
+++ b/MdePkg/Include/Arm/ProcessorBind.h
@@ -24,7 +24,7 @@ 
 //
 // Make sure we are using the correct packing rules per EFI specification
 //
-#ifndef __GNUC__
+#if !defined(__GNUC__) && !defined(__ASSEMBLER__)
 #pragma pack()
 #endif