diff mbox series

[edk2] BaseTools/tools_def: suppress GCC predefined macros in DTB compilation

Message ID 20171026101209.31630-1-ard.biesheuvel@linaro.org
State Accepted
Commit 8512fc5731df2268227e61f3fe220a1f96929a4b
Headers show
Series [edk2] BaseTools/tools_def: suppress GCC predefined macros in DTB compilation | expand

Commit Message

Ard Biesheuvel Oct. 26, 2017, 10:12 a.m. UTC
The standard GCC preprocessor we use to preprocess device tree sources
files has a whole bunch of macros predefined, among which

This causes a property like 'linux,code' to be converted into '1,code'
which is obviously wrong. So let's get rid of all the predefined macros
by passing -undef to the preprocessor command line.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.11.0

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

Comments

Laszlo Ersek Oct. 26, 2017, 11:09 a.m. UTC | #1
On 10/26/17 12:12, Ard Biesheuvel wrote:
> The standard GCC preprocessor we use to preprocess device tree sources

> files has a whole bunch of macros predefined, among which

> 


The example you wanted to paste is missing.

> This causes a property like 'linux,code' to be converted into '1,code'

> which is obviously wrong. So let's get rid of all the predefined macros

> by passing -undef to the preprocessor command line.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

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

> ---

>  BaseTools/Conf/tools_def.template | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

> index df7c109438fd..98df0ffc9294 100755

> --- a/BaseTools/Conf/tools_def.template

> +++ b/BaseTools/Conf/tools_def.template

> @@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -DVFRCOMPILE --include $(DEST_DI

>  DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

>  DEFINE GCC_ASLCC_FLAGS             = -x c

>  DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

> -DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

> +DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

>  DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --rename-section .data=.hii

>  DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --rename-section .data=.hii

>  DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --rename-section .data=.hii

> 


With the commit message fixed:

Acked-by: Laszlo Ersek <lersek@redhat.com>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Oct. 26, 2017, 11:11 a.m. UTC | #2
On 26 October 2017 at 12:09, Laszlo Ersek <lersek@redhat.com> wrote:
> On 10/26/17 12:12, Ard Biesheuvel wrote:

>> The standard GCC preprocessor we use to preprocess device tree sources

>> files has a whole bunch of macros predefined, among which

>>

>

> The example you wanted to paste is missing.

>


Yeah, the leading # made git-commit throw them away :-)

#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1


>> This causes a property like 'linux,code' to be converted into '1,code'

>> which is obviously wrong. So let's get rid of all the predefined macros

>> by passing -undef to the preprocessor command line.

>>

>> Contributed-under: TianoCore Contribution Agreement 1.1

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

>> ---

>>  BaseTools/Conf/tools_def.template | 2 +-

>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

>> index df7c109438fd..98df0ffc9294 100755

>> --- a/BaseTools/Conf/tools_def.template

>> +++ b/BaseTools/Conf/tools_def.template

>> @@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -DVFRCOMPILE --include $(DEST_DI

>>  DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

>>  DEFINE GCC_ASLCC_FLAGS             = -x c

>>  DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

>> -DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

>> +DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

>>  DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --rename-section .data=.hii

>>  DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --rename-section .data=.hii

>>  DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --rename-section .data=.hii

>>

>

> With the commit message fixed:

>

> Acked-by: Laszlo Ersek <lersek@redhat.com>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Oct. 26, 2017, 11:33 a.m. UTC | #3
On Thu, Oct 26, 2017 at 12:11:16PM +0100, Ard Biesheuvel wrote:
> On 26 October 2017 at 12:09, Laszlo Ersek <lersek@redhat.com> wrote:

> > On 10/26/17 12:12, Ard Biesheuvel wrote:

> >> The standard GCC preprocessor we use to preprocess device tree sources

> >> files has a whole bunch of macros predefined, among which

> >>

> >

> > The example you wanted to paste is missing.

> >

> 

> Yeah, the leading # made git-commit throw them away :-)


Haha :)

> #define __linux 1

> #define __linux__ 1

> #define __gnu_linux__ 1

> #define linux 1


How did you make it not throw them away?
(I can find a few suggestions online, neither sounds optimal.)

> >> This causes a property like 'linux,code' to be converted into '1,code'

> >> which is obviously wrong. So let's get rid of all the predefined macros

> >> by passing -undef to the preprocessor command line.

> >>

> >> Contributed-under: TianoCore Contribution Agreement 1.1

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

> >> ---

> >>  BaseTools/Conf/tools_def.template | 2 +-

> >>  1 file changed, 1 insertion(+), 1 deletion(-)

> >>

> >> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

> >> index df7c109438fd..98df0ffc9294 100755

> >> --- a/BaseTools/Conf/tools_def.template

> >> +++ b/BaseTools/Conf/tools_def.template

> >> @@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -DVFRCOMPILE --include $(DEST_DI

> >>  DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

> >>  DEFINE GCC_ASLCC_FLAGS             = -x c

> >>  DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

> >> -DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

> >> +DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

> >>  DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --rename-section .data=.hii

> >>  DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --rename-section .data=.hii

> >>  DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --rename-section .data=.hii

> >>

> >

> > With the commit message fixed:

> >

> > Acked-by: Laszlo Ersek <lersek@redhat.com>


With the same precondition:

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


/
    Leif
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Oct. 26, 2017, 11:34 a.m. UTC | #4
On 26 October 2017 at 12:33, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Thu, Oct 26, 2017 at 12:11:16PM +0100, Ard Biesheuvel wrote:

>> On 26 October 2017 at 12:09, Laszlo Ersek <lersek@redhat.com> wrote:

>> > On 10/26/17 12:12, Ard Biesheuvel wrote:

>> >> The standard GCC preprocessor we use to preprocess device tree sources

>> >> files has a whole bunch of macros predefined, among which

>> >>

>> >

>> > The example you wanted to paste is missing.

>> >

>>

>> Yeah, the leading # made git-commit throw them away :-)

>

> Haha :)

>

>> #define __linux 1

>> #define __linux__ 1

>> #define __gnu_linux__ 1

>> #define linux 1

>

> How did you make it not throw them away?

> (I can find a few suggestions online, neither sounds optimal.)

>


Oh Gmail doesn't care, so pasting them here is not a problem

In Git, I just added some spaces at the beginning.

>> >> This causes a property like 'linux,code' to be converted into '1,code'

>> >> which is obviously wrong. So let's get rid of all the predefined macros

>> >> by passing -undef to the preprocessor command line.

>> >>

>> >> Contributed-under: TianoCore Contribution Agreement 1.1

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

>> >> ---

>> >>  BaseTools/Conf/tools_def.template | 2 +-

>> >>  1 file changed, 1 insertion(+), 1 deletion(-)

>> >>

>> >> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

>> >> index df7c109438fd..98df0ffc9294 100755

>> >> --- a/BaseTools/Conf/tools_def.template

>> >> +++ b/BaseTools/Conf/tools_def.template

>> >> @@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -DVFRCOMPILE --include $(DEST_DI

>> >>  DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

>> >>  DEFINE GCC_ASLCC_FLAGS             = -x c

>> >>  DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

>> >> -DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

>> >> +DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

>> >>  DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --rename-section .data=.hii

>> >>  DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --rename-section .data=.hii

>> >>  DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --rename-section .data=.hii

>> >>

>> >

>> > With the commit message fixed:

>> >

>> > Acked-by: Laszlo Ersek <lersek@redhat.com>

>

> With the same precondition:

>

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

>

> /

>     Leif

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Laszlo Ersek Oct. 26, 2017, 3:08 p.m. UTC | #5
On 10/26/17 13:34, Ard Biesheuvel wrote:
> On 26 October 2017 at 12:33, Leif Lindholm <leif.lindholm@linaro.org> wrote:

>> On Thu, Oct 26, 2017 at 12:11:16PM +0100, Ard Biesheuvel wrote:

>>> On 26 October 2017 at 12:09, Laszlo Ersek <lersek@redhat.com> wrote:

>>>> On 10/26/17 12:12, Ard Biesheuvel wrote:

>>>>> The standard GCC preprocessor we use to preprocess device tree sources

>>>>> files has a whole bunch of macros predefined, among which

>>>>>

>>>>

>>>> The example you wanted to paste is missing.

>>>>

>>>

>>> Yeah, the leading # made git-commit throw them away :-)

>>

>> Haha :)


Been there, burned myself similarly :)

>>> #define __linux 1

>>> #define __linux__ 1

>>> #define __gnu_linux__ 1

>>> #define linux 1

>>

>> How did you make it not throw them away?

>> (I can find a few suggestions online, neither sounds optimal.)

>>

> 

> Oh Gmail doesn't care, so pasting them here is not a problem

> 

> In Git, I just added some spaces at the beginning.


Or use email-style quoting ("> ").

Thanks,
Laszlo

>>>>> This causes a property like 'linux,code' to be converted into '1,code'

>>>>> which is obviously wrong. So let's get rid of all the predefined macros

>>>>> by passing -undef to the preprocessor command line.

>>>>>

>>>>> Contributed-under: TianoCore Contribution Agreement 1.1

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

>>>>> ---

>>>>>  BaseTools/Conf/tools_def.template | 2 +-

>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)

>>>>>

>>>>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template

>>>>> index df7c109438fd..98df0ffc9294 100755

>>>>> --- a/BaseTools/Conf/tools_def.template

>>>>> +++ b/BaseTools/Conf/tools_def.template

>>>>> @@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -DVFRCOMPILE --include $(DEST_DI

>>>>>  DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

>>>>>  DEFINE GCC_ASLCC_FLAGS             = -x c

>>>>>  DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

>>>>> -DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

>>>>> +DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

>>>>>  DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --rename-section .data=.hii

>>>>>  DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --rename-section .data=.hii

>>>>>  DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --rename-section .data=.hii

>>>>>

>>>>

>>>> With the commit message fixed:

>>>>

>>>> Acked-by: Laszlo Ersek <lersek@redhat.com>

>>

>> With the same precondition:

>>

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

>>

>> /

>>     Leif


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Gao, Liming Oct. 31, 2017, 5:41 a.m. UTC | #6
Ard:
  I have no other comments. 

Reviewed-by: Liming Gao <liming.gao@intel.com>


Thanks
Liming
>-----Original Message-----

>From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]

>Sent: Thursday, October 26, 2017 6:12 PM

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

>Cc: leif.lindholm@linaro.org; Gao, Liming <liming.gao@intel.com>; Zhu,

>Yonghong <yonghong.zhu@intel.com>; Ard Biesheuvel

><ard.biesheuvel@linaro.org>

>Subject: [PATCH] BaseTools/tools_def: suppress GCC predefined macros in

>DTB compilation

>

>The standard GCC preprocessor we use to preprocess device tree sources

>files has a whole bunch of macros predefined, among which

>

>This causes a property like 'linux,code' to be converted into '1,code'

>which is obviously wrong. So let's get rid of all the predefined macros

>by passing -undef to the preprocessor command line.

>

>Contributed-under: TianoCore Contribution Agreement 1.1

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

>---

> BaseTools/Conf/tools_def.template | 2 +-

> 1 file changed, 1 insertion(+), 1 deletion(-)

>

>diff --git a/BaseTools/Conf/tools_def.template

>b/BaseTools/Conf/tools_def.template

>index df7c109438fd..98df0ffc9294 100755

>--- a/BaseTools/Conf/tools_def.template

>+++ b/BaseTools/Conf/tools_def.template

>@@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -

>DVFRCOMPILE --include $(DEST_DI

> DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

> DEFINE GCC_ASLCC_FLAGS             = -x c

> DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

>-DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros

>$(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

>+DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros

>$(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

> DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --

>rename-section .data=.hii

> DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --

>rename-section .data=.hii

> DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --

>rename-section .data=.hii

>--

>2.11.0


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Oct. 31, 2017, 8:27 a.m. UTC | #7
On 31 October 2017 at 05:41, Gao, Liming <liming.gao@intel.com> wrote:
> Ard:

>   I have no other comments.

>

> Reviewed-by: Liming Gao <liming.gao@intel.com>

>


Thanks. I already pushed this as 8512fc5731df



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

>>From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]

>>Sent: Thursday, October 26, 2017 6:12 PM

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

>>Cc: leif.lindholm@linaro.org; Gao, Liming <liming.gao@intel.com>; Zhu,

>>Yonghong <yonghong.zhu@intel.com>; Ard Biesheuvel

>><ard.biesheuvel@linaro.org>

>>Subject: [PATCH] BaseTools/tools_def: suppress GCC predefined macros in

>>DTB compilation

>>

>>The standard GCC preprocessor we use to preprocess device tree sources

>>files has a whole bunch of macros predefined, among which

>>

>>This causes a property like 'linux,code' to be converted into '1,code'

>>which is obviously wrong. So let's get rid of all the predefined macros

>>by passing -undef to the preprocessor command line.

>>

>>Contributed-under: TianoCore Contribution Agreement 1.1

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

>>---

>> BaseTools/Conf/tools_def.template | 2 +-

>> 1 file changed, 1 insertion(+), 1 deletion(-)

>>

>>diff --git a/BaseTools/Conf/tools_def.template

>>b/BaseTools/Conf/tools_def.template

>>index df7c109438fd..98df0ffc9294 100755

>>--- a/BaseTools/Conf/tools_def.template

>>+++ b/BaseTools/Conf/tools_def.template

>>@@ -4369,7 +4369,7 @@ DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -

>>DVFRCOMPILE --include $(DEST_DI

>> DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h

>> DEFINE GCC_ASLCC_FLAGS             = -x c

>> DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff

>>-DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros

>>$(DEST_DIR_DEBUG)/AutoGen.h -nostdinc

>>+DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros

>>$(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef

>> DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --

>>rename-section .data=.hii

>> DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --

>>rename-section .data=.hii

>> DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --

>>rename-section .data=.hii

>>--

>>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/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index df7c109438fd..98df0ffc9294 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4369,7 +4369,7 @@  DEFINE GCC_VFRPP_FLAGS             = -x c -E -P -DVFRCOMPILE --include $(DEST_DI
 DEFINE GCC_ASLPP_FLAGS             = -x c -E -include AutoGen.h
 DEFINE GCC_ASLCC_FLAGS             = -x c
 DEFINE GCC_WINDRES_FLAGS           = -J rc -O coff
-DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc
+DEFINE GCC_DTCPP_FLAGS             = -E -x assembler-with-cpp -imacros $(DEST_DIR_DEBUG)/AutoGen.h -nostdinc -undef
 DEFINE GCC_IA32_RC_FLAGS           = -I binary -O elf32-i386          -B i386    --rename-section .data=.hii
 DEFINE GCC_X64_RC_FLAGS            = -I binary -O elf64-x86-64        -B i386    --rename-section .data=.hii
 DEFINE GCC_IPF_RC_FLAGS            = -I binary -O elf64-ia64-little   -B ia64    --rename-section .data=.hii