public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Building EDK2 code on arm64 (aarch64) - BaseTools fails
@ 2019-04-10  4:57 Rebecca Cran
  2019-04-10 14:41 ` [edk2-devel] " Philippe Mathieu-Daudé
  2019-04-10 17:31 ` Laszlo Ersek
  0 siblings, 2 replies; 7+ messages in thread
From: Rebecca Cran @ 2019-04-10  4:57 UTC (permalink / raw)
  To: devel

Is there any expectation that EDK2 will build on non-x86 systems?

I tried building BaseTools (from git master, 
ae2fb9ead47b5abaf2a4e815b5f57c8f4838b221) using GCC 8.2 on a SoftIron 
OverDrive 1000 (running FreeBSD) but there are lots of errors, such as:


gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I 
../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/Arm/  
-MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict 
-Wno-unused-result -nostdlib -g -O2  BasePeCoff.c -o BasePeCoff.o
BasePeCoff.c: In function 'PeCoffLoaderGetPeHeader':
BasePeCoff.c:120:49: error: cast from pointer to integer of different 
size [-Werror=pointer-to-int-cast]
    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) 
((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
                                                  ^
BasePeCoff.c:120:12: error: cast to pointer from integer of different 
size [-Werror=int-to-pointer-cast]
    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *) 
((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
             ^
BasePeCoff.c: In function 'PeCoffLoaderImageAddress':
BasePeCoff.c:551:10: error: cast to pointer from integer of different 
size [-Werror=int-to-pointer-cast]
    return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
           ^


-- 
Rebecca Cran


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools fails
  2019-04-10  4:57 Building EDK2 code on arm64 (aarch64) - BaseTools fails Rebecca Cran
@ 2019-04-10 14:41 ` Philippe Mathieu-Daudé
  2019-04-10 15:04   ` Rebecca Cran
  2019-04-10 17:31 ` Laszlo Ersek
  1 sibling, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-04-10 14:41 UTC (permalink / raw)
  To: devel, rebecca; +Cc: Ard Biesheuvel, Laszlo Ersek

On 4/10/19 6:57 AM, Rebecca Cran via Groups.Io wrote:
> Is there any expectation that EDK2 will build on non-x86 systems?

I have no problem using Ubuntu Bionic on Aarch64 using the default GCC.

$ lsb_release -cd
Description:    Ubuntu 18.04.2 LTS
Codename:       bionic

$ uname -ms
Linux aarch64

$ gcc -v
gcc version 7.3.0 (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04)

> I tried building BaseTools (from git master,
> ae2fb9ead47b5abaf2a4e815b5f57c8f4838b221) using GCC 8.2 on a SoftIron
> OverDrive 1000 (running FreeBSD) but there are lots of errors, such as:
> 
> 
> gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I
> ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/Arm/ 
> -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror
> -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict
> -Wno-unused-result -nostdlib -g -O2  BasePeCoff.c -o BasePeCoff.o
> BasePeCoff.c: In function 'PeCoffLoaderGetPeHeader':
> BasePeCoff.c:120:49: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
> ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
>                                                  ^
> BasePeCoff.c:120:12: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
> ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
>             ^
> BasePeCoff.c: In function 'PeCoffLoaderImageAddress':
> BasePeCoff.c:551:10: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>    return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
>           ^

This doesn't look like an architecture problem. It seems your GCC
version isn't checked correctly by BaseTools. This warning is supposed
to be disabled, see:

StdLib/LibC/Stdio/Stdio.inf:  GCC:*_*_*_CC_FLAGS    = -fno-builtin
-Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-format

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools fails
  2019-04-10 14:41 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-04-10 15:04   ` Rebecca Cran
  0 siblings, 0 replies; 7+ messages in thread
From: Rebecca Cran @ 2019-04-10 15:04 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, devel; +Cc: Ard Biesheuvel, Laszlo Ersek

On 2019-04-10 08:41, Philippe Mathieu-Daudé wrote:
>
> This doesn't look like an architecture problem. It seems your GCC
> version isn't checked correctly by BaseTools. This warning is supposed
> to be disabled, see:
>
> StdLib/LibC/Stdio/Stdio.inf:  GCC:*_*_*_CC_FLAGS    = -fno-builtin
> -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-format


Thanks! I shouldn't have posted so late, I didn't look closely enough at 
the error messages before sending my email.


-- 
Rebecca Cran


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools fails
  2019-04-10  4:57 Building EDK2 code on arm64 (aarch64) - BaseTools fails Rebecca Cran
  2019-04-10 14:41 ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-04-10 17:31 ` Laszlo Ersek
  2019-04-11  0:09   ` Liming Gao
  1 sibling, 1 reply; 7+ messages in thread
From: Laszlo Ersek @ 2019-04-10 17:31 UTC (permalink / raw)
  To: devel, rebecca

On 04/10/19 06:57, Rebecca Cran via Groups.Io wrote:
> Is there any expectation that EDK2 will build on non-x86 systems?

Yes. It should certainly build on aarch64 (Linux at least).

> 
> I tried building BaseTools (from git master,
> ae2fb9ead47b5abaf2a4e815b5f57c8f4838b221) using GCC 8.2 on a SoftIron
> OverDrive 1000 (running FreeBSD) but there are lots of errors, such as:

The issue here must be "FreeBSD". That's not supported as a build host
OS, to my knowledge.

I assume the build platform check in the BaseTools makefiles / scripts
fail due to FreeBSD.

edk2 platforms are otherwise regularly built on aarch64 Linux.

Thanks
Laszlo

> 
> 
> gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I
> ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/Arm/ 
> -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror
> -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict
> -Wno-unused-result -nostdlib -g -O2  BasePeCoff.c -o BasePeCoff.o
> BasePeCoff.c: In function 'PeCoffLoaderGetPeHeader':
> BasePeCoff.c:120:49: error: cast from pointer to integer of different
> size [-Werror=pointer-to-int-cast]
>    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
> ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
>                                                  ^
> BasePeCoff.c:120:12: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
> ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
>             ^
> BasePeCoff.c: In function 'PeCoffLoaderImageAddress':
> BasePeCoff.c:551:10: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
>    return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
>           ^
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools fails
  2019-04-10 17:31 ` Laszlo Ersek
@ 2019-04-11  0:09   ` Liming Gao
  2019-04-11  2:07     ` Rebecca Cran
       [not found]     ` <159449609038BC58.19288@groups.io>
  0 siblings, 2 replies; 7+ messages in thread
From: Liming Gao @ 2019-04-11  0:09 UTC (permalink / raw)
  To: devel@edk2.groups.io, lersek@redhat.com, rebecca@bluestop.org

Yes. No test on FreeBSD. If possible, can you contribute the patch to fix this issue on FreeBSD? 

Thanks
Liming
>-----Original Message-----
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>Laszlo Ersek
>Sent: Thursday, April 11, 2019 1:31 AM
>To: devel@edk2.groups.io; rebecca@bluestop.org
>Subject: Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools
>fails
>
>On 04/10/19 06:57, Rebecca Cran via Groups.Io wrote:
>> Is there any expectation that EDK2 will build on non-x86 systems?
>
>Yes. It should certainly build on aarch64 (Linux at least).
>
>>
>> I tried building BaseTools (from git master,
>> ae2fb9ead47b5abaf2a4e815b5f57c8f4838b221) using GCC 8.2 on a SoftIron
>> OverDrive 1000 (running FreeBSD) but there are lots of errors, such as:
>
>The issue here must be "FreeBSD". That's not supported as a build host
>OS, to my knowledge.
>
>I assume the build platform check in the BaseTools makefiles / scripts
>fail due to FreeBSD.
>
>edk2 platforms are otherwise regularly built on aarch64 Linux.
>
>Thanks
>Laszlo
>
>>
>>
>> gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I
>> ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/Arm/
>> -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror
>> -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict
>> -Wno-unused-result -nostdlib -g -O2  BasePeCoff.c -o BasePeCoff.o
>> BasePeCoff.c: In function 'PeCoffLoaderGetPeHeader':
>> BasePeCoff.c:120:49: error: cast from pointer to integer of different
>> size [-Werror=pointer-to-int-cast]
>>    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
>> ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
>>                                                  ^
>> BasePeCoff.c:120:12: error: cast to pointer from integer of different
>> size [-Werror=int-to-pointer-cast]
>>    *PeHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)
>> ((UINTN)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
>>             ^
>> BasePeCoff.c: In function 'PeCoffLoaderImageAddress':
>> BasePeCoff.c:551:10: error: cast to pointer from integer of different
>> size [-Werror=int-to-pointer-cast]
>>    return (UINT8 *) ((UINTN) ImageContext->ImageAddress + Address);
>>           ^
>>
>>
>
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools fails
  2019-04-11  0:09   ` Liming Gao
@ 2019-04-11  2:07     ` Rebecca Cran
       [not found]     ` <159449609038BC58.19288@groups.io>
  1 sibling, 0 replies; 7+ messages in thread
From: Rebecca Cran @ 2019-04-11  2:07 UTC (permalink / raw)
  To: devel, liming.gao, lersek@redhat.com

On 2019-04-10 18:09, Liming Gao wrote:
> Yes. No test on FreeBSD. If possible, can you contribute the patch to fix this issue on FreeBSD?



Thanks. I'm working on fixing it now: it looks like it needs new 
compiler flags in BaseTools/Source/C/Makefiles/header.makefile, as well 
as recognizing arm64 as a platform name in addition to aarch64.


-- 
Rebecca Cran


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Building EDK2 code on arm64 (aarch64) - BaseTools fails
       [not found]     ` <159449609038BC58.19288@groups.io>
@ 2019-04-11  3:21       ` Rebecca Cran
  0 siblings, 0 replies; 7+ messages in thread
From: Rebecca Cran @ 2019-04-11  3:21 UTC (permalink / raw)
  To: devel, liming.gao, lersek@redhat.com

On 2019-04-10 20:07, Rebecca Cran via Groups.Io wrote:
> Thanks. I'm working on fixing it now: it looks like it needs new 
> compiler flags in BaseTools/Source/C/Makefiles/header.makefile, as 
> well as recognizing arm64 as a platform name in addition to aarch64


It didn't need any compiler flag changes after all: it only needed the 
change to recognize 'arm64' as a platform name, in addition to avoiding 
falling through to the 'arm' case which was causing it to still pull in 
the ARM instead of AARCH64 headers.


-- 
Rebecca Cran


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-11  3:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-10  4:57 Building EDK2 code on arm64 (aarch64) - BaseTools fails Rebecca Cran
2019-04-10 14:41 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-04-10 15:04   ` Rebecca Cran
2019-04-10 17:31 ` Laszlo Ersek
2019-04-11  0:09   ` Liming Gao
2019-04-11  2:07     ` Rebecca Cran
     [not found]     ` <159449609038BC58.19288@groups.io>
2019-04-11  3:21       ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox