public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"
@ 2023-05-10 16:23 Rebecca Cran
  2023-05-10 16:27 ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Rebecca Cran @ 2023-05-10 16:23 UTC (permalink / raw)
  To: Ard Biesheuvel, Thomas Abraham, Sami Mujawar,
	devel@edk2.groups.io

I ran my script that tries to build all Arm platforms in edk2-platforms 
(with the exception of known broken ones) with the GCC5/GCC toolchain, 
and noticed a new breakage since I last ran it a few months ago.

Building JunoPkg for ARM doesn't work.

I also noticed it passes both -march=armv7-a and -march=armv8-a.


"arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x 
assembler -imacros AutoGen.h -mlittle-endian -o 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf 
-I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG 
-I/home/bcran/src/uefi/edk2/ArmPkg 
-I/home/bcran/src/uefi/edk2/ArmPkg/Include 
-I/home/bcran/src/uefi/edk2/MdeModulePkg 
-I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include 
-I/home/bcran/src/uefi/edk2/MdeModulePkg/Include 
-I/home/bcran/src/uefi/edk2/MdePkg 
-I/home/bcran/src/uefi/edk2/MdePkg/Include 
-I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include 
-I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include 
-I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include 
-I/home/bcran/src/uefi/edk2/ShellPkg 
-I/home/bcran/src/uefi/edk2/ShellPkg/Include 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii
Trim --trim-long --source-code -o 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.iiii 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
Trim --trim-long --source-code -o 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.iiii 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii: 
Assembler messages:
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:17: 
Error: bad instruction `aarch64_bti(c)'
make: *** [GNUmakefile:363: 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj] 
Error 1


-- 
Rebecca Cran


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

* Re: JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"
  2023-05-10 16:23 JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'" Rebecca Cran
@ 2023-05-10 16:27 ` Ard Biesheuvel
  2023-05-10 16:52   ` Rebecca Cran
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10 16:27 UTC (permalink / raw)
  To: Rebecca Cran
  Cc: Ard Biesheuvel, Thomas Abraham, Sami Mujawar,
	devel@edk2.groups.io

Hi Rebecca,

On Wed, 10 May 2023 at 18:23, Rebecca Cran <rebecca@bsdio.com> wrote:
>
> I ran my script that tries to build all Arm platforms in edk2-platforms
> (with the exception of known broken ones) with the GCC5/GCC toolchain,
> and noticed a new breakage since I last ran it a few months ago.
>
> Building JunoPkg for ARM doesn't work.
>
> I also noticed it passes both -march=armv7-a and -march=armv8-a.
>

This looks like a bug in the Juno package - if I grep for aarch64_bti
in edk2, every single hit is in a aarch64 specific source or header
file, but it is getting pulled into an ARM build.

Does the below help?

diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
index 50efcfacdfe6..7d5eed94b25f 100644
--- a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
+++ b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
@@ -4,7 +4,7 @@
 //  SPDX-License-Identifier: BSD-2-Clause-Patent
 //

-#include <AsmMacroIoLibV8.h>
+#include <AsmMacroIoLib.h>

 // VOID
 // RunAxfPivot (



>
> "arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x
> assembler -imacros AutoGen.h -mlittle-endian -o
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf
> -I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG
> -I/home/bcran/src/uefi/edk2/ArmPkg
> -I/home/bcran/src/uefi/edk2/ArmPkg/Include
> -I/home/bcran/src/uefi/edk2/MdeModulePkg
> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include
> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Include
> -I/home/bcran/src/uefi/edk2/MdePkg
> -I/home/bcran/src/uefi/edk2/MdePkg/Include
> -I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include
> -I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include
> -I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include
> -I/home/bcran/src/uefi/edk2/ShellPkg
> -I/home/bcran/src/uefi/edk2/ShellPkg/Include
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii
> Trim --trim-long --source-code -o
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.iiii
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
> Trim --trim-long --source-code -o
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.iiii
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:
> Assembler messages:
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:17:
> Error: bad instruction `aarch64_bti(c)'
> make: *** [GNUmakefile:363:
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj]
> Error 1
>
>
> --
> Rebecca Cran
>

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

* Re: JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"
  2023-05-10 16:27 ` Ard Biesheuvel
@ 2023-05-10 16:52   ` Rebecca Cran
  2023-05-10 16:54     ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Rebecca Cran @ 2023-05-10 16:52 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Ard Biesheuvel, Thomas Abraham, Sami Mujawar,
	devel@edk2.groups.io

Thanks. Yes, that fixes it.


I also tried running the build script with CLANGDWARF, and it seems to 
have found some valid problems with 
Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c


/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:11: 
error: variable 'FileSize' is used uninitialized whenever 'if' condition 
is false [-Werror,-Wsometimes-uninitialized]
       if (FileHandle != NULL) {
           ^~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here
   WriteBackDataCacheRange (FileData, FileSize);
                                      ^~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:7: 
note: remove the 'if' if its condition is always true
       if (FileHandle != NULL) {
       ^~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9: 
error: variable 'FileSize' is used uninitialized whenever 'if' condition 
is true [-Werror,-Wsometimes-uninitialized]
     if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here
   WriteBackDataCacheRange (FileData, FileSize);
                                      ^~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:5: 
note: remove the 'if' if its condition is always false
     if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9: 
error: variable 'FileSize' is used uninitialized whenever '||' condition 
is true [-Werror,-Wsometimes-uninitialized]
     if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here
   WriteBackDataCacheRange (FileData, FileSize);
                                      ^~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9: 
note: remove the '||' if its condition is always false
     if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:7: 
error: variable 'FileSize' is used uninitialized whenever 'if' condition 
is true [-Werror,-Wsometimes-uninitialized]
   if (EFI_ERROR (Status)) {
       ^~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2/MdePkg/Include/Uefi/UefiBaseType.h:159:23: 
note: expanded from macro 'EFI_ERROR'
#define EFI_ERROR(A)  RETURN_ERROR(A)
                       ^~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2/MdePkg/Include/Base.h:1061:35: note: expanded 
from macro 'RETURN_ERROR'
#define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here
   WriteBackDataCacheRange (FileData, FileSize);
                                      ^~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:3: 
note: remove the 'if' if its condition is always false
   if (EFI_ERROR (Status)) {
   ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:136:39: 
note: initialize the variable 'FileSize' to silence this warning
   UINTN                       FileSize;
                                       ^
                                        = 0
4 errors generated.
make: *** [GNUmakefile:342: 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_CLANGDWARF/AARCH64/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/RunAxf.obj] 
Error 1

-- 

Rebecca Cran



On 5/10/23 10:27, Ard Biesheuvel wrote:
> Hi Rebecca,
>
> On Wed, 10 May 2023 at 18:23, Rebecca Cran <rebecca@bsdio.com> wrote:
>> I ran my script that tries to build all Arm platforms in edk2-platforms
>> (with the exception of known broken ones) with the GCC5/GCC toolchain,
>> and noticed a new breakage since I last ran it a few months ago.
>>
>> Building JunoPkg for ARM doesn't work.
>>
>> I also noticed it passes both -march=armv7-a and -march=armv8-a.
>>
> This looks like a bug in the Juno package - if I grep for aarch64_bti
> in edk2, every single hit is in a aarch64 specific source or header
> file, but it is getting pulled into an ARM build.
>
> Does the below help?
>
> diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> index 50efcfacdfe6..7d5eed94b25f 100644
> --- a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> +++ b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> @@ -4,7 +4,7 @@
>   //  SPDX-License-Identifier: BSD-2-Clause-Patent
>   //
>
> -#include <AsmMacroIoLibV8.h>
> +#include <AsmMacroIoLib.h>
>
>   // VOID
>   // RunAxfPivot (
>
>
>
>> "arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x
>> assembler -imacros AutoGen.h -mlittle-endian -o
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj
>> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm
>> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf
>> -I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG
>> -I/home/bcran/src/uefi/edk2/ArmPkg
>> -I/home/bcran/src/uefi/edk2/ArmPkg/Include
>> -I/home/bcran/src/uefi/edk2/MdeModulePkg
>> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include
>> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Include
>> -I/home/bcran/src/uefi/edk2/MdePkg
>> -I/home/bcran/src/uefi/edk2/MdePkg/Include
>> -I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include
>> -I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include
>> -I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm
>> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM
>> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include
>> -I/home/bcran/src/uefi/edk2/ShellPkg
>> -I/home/bcran/src/uefi/edk2/ShellPkg/Include
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii
>> Trim --trim-long --source-code -o
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.iiii
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
>> Trim --trim-long --source-code -o
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.iiii
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:
>> Assembler messages:
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:17:
>> Error: bad instruction `aarch64_bti(c)'
>> make: *** [GNUmakefile:363:
>> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj]
>> Error 1
>>
>>
>> --
>> Rebecca Cran
>>

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

* Re: JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"
  2023-05-10 16:52   ` Rebecca Cran
@ 2023-05-10 16:54     ` Ard Biesheuvel
  2023-05-10 17:06       ` Leif Lindholm
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2023-05-10 16:54 UTC (permalink / raw)
  To: Rebecca Cran, Leif Lindholm
  Cc: Ard Biesheuvel, Thomas Abraham, Sami Mujawar,
	devel@edk2.groups.io

(cc Leif)

On Wed, 10 May 2023 at 18:52, Rebecca Cran <rebecca@bsdio.com> wrote:
>
> Thanks. Yes, that fixes it.
>
>
> I also tried running the build script with CLANGDWARF, and it seems to
> have found some valid problems with
> Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
>

Seems to me like an excellent opportunity to rip that thing out completely.


>
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:11:
> error: variable 'FileSize' is used uninitialized whenever 'if' condition
> is false [-Werror,-Wsometimes-uninitialized]
>        if (FileHandle != NULL) {
>            ^~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>    WriteBackDataCacheRange (FileData, FileSize);
>                                       ^~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:7:
> note: remove the 'if' if its condition is always true
>        if (FileHandle != NULL) {
>        ^~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> error: variable 'FileSize' is used uninitialized whenever 'if' condition
> is true [-Werror,-Wsometimes-uninitialized]
>      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>    WriteBackDataCacheRange (FileData, FileSize);
>                                       ^~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:5:
> note: remove the 'if' if its condition is always false
>      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> error: variable 'FileSize' is used uninitialized whenever '||' condition
> is true [-Werror,-Wsometimes-uninitialized]
>      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>    WriteBackDataCacheRange (FileData, FileSize);
>                                       ^~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> note: remove the '||' if its condition is always false
>      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:7:
> error: variable 'FileSize' is used uninitialized whenever 'if' condition
> is true [-Werror,-Wsometimes-uninitialized]
>    if (EFI_ERROR (Status)) {
>        ^~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2/MdePkg/Include/Uefi/UefiBaseType.h:159:23:
> note: expanded from macro 'EFI_ERROR'
> #define EFI_ERROR(A)  RETURN_ERROR(A)
>                        ^~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2/MdePkg/Include/Base.h:1061:35: note: expanded
> from macro 'RETURN_ERROR'
> #define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>    WriteBackDataCacheRange (FileData, FileSize);
>                                       ^~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:3:
> note: remove the 'if' if its condition is always false
>    if (EFI_ERROR (Status)) {
>    ^~~~~~~~~~~~~~~~~~~~~~~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:136:39:
> note: initialize the variable 'FileSize' to silence this warning
>    UINTN                       FileSize;
>                                        ^
>                                         = 0
> 4 errors generated.
> make: *** [GNUmakefile:342:
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_CLANGDWARF/AARCH64/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/RunAxf.obj]
> Error 1
>
> --
>
> Rebecca Cran
>
>
>
> On 5/10/23 10:27, Ard Biesheuvel wrote:
> > Hi Rebecca,
> >
> > On Wed, 10 May 2023 at 18:23, Rebecca Cran <rebecca@bsdio.com> wrote:
> >> I ran my script that tries to build all Arm platforms in edk2-platforms
> >> (with the exception of known broken ones) with the GCC5/GCC toolchain,
> >> and noticed a new breakage since I last ran it a few months ago.
> >>
> >> Building JunoPkg for ARM doesn't work.
> >>
> >> I also noticed it passes both -march=armv7-a and -march=armv8-a.
> >>
> > This looks like a bug in the Juno package - if I grep for aarch64_bti
> > in edk2, every single hit is in a aarch64 specific source or header
> > file, but it is getting pulled into an ARM build.
> >
> > Does the below help?
> >
> > diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > index 50efcfacdfe6..7d5eed94b25f 100644
> > --- a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > +++ b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > @@ -4,7 +4,7 @@
> >   //  SPDX-License-Identifier: BSD-2-Clause-Patent
> >   //
> >
> > -#include <AsmMacroIoLibV8.h>
> > +#include <AsmMacroIoLib.h>
> >
> >   // VOID
> >   // RunAxfPivot (
> >
> >
> >
> >> "arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x
> >> assembler -imacros AutoGen.h -mlittle-endian -o
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj
> >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm
> >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf
> >> -I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG
> >> -I/home/bcran/src/uefi/edk2/ArmPkg
> >> -I/home/bcran/src/uefi/edk2/ArmPkg/Include
> >> -I/home/bcran/src/uefi/edk2/MdeModulePkg
> >> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include
> >> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Include
> >> -I/home/bcran/src/uefi/edk2/MdePkg
> >> -I/home/bcran/src/uefi/edk2/MdePkg/Include
> >> -I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include
> >> -I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include
> >> -I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm
> >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM
> >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include
> >> -I/home/bcran/src/uefi/edk2/ShellPkg
> >> -I/home/bcran/src/uefi/edk2/ShellPkg/Include
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii
> >> Trim --trim-long --source-code -o
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.iiii
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
> >> Trim --trim-long --source-code -o
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.iiii
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:
> >> Assembler messages:
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:17:
> >> Error: bad instruction `aarch64_bti(c)'
> >> make: *** [GNUmakefile:363:
> >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj]
> >> Error 1
> >>
> >>
> >> --
> >> Rebecca Cran
> >>

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

* Re: JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"
  2023-05-10 16:54     ` Ard Biesheuvel
@ 2023-05-10 17:06       ` Leif Lindholm
  0 siblings, 0 replies; 5+ messages in thread
From: Leif Lindholm @ 2023-05-10 17:06 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Rebecca Cran, Ard Biesheuvel, Thomas Abraham, Sami Mujawar,
	devel@edk2.groups.io

On Wed, May 10, 2023 at 18:54:04 +0200, Ard Biesheuvel wrote:
> (cc Leif)
> 
> On Wed, 10 May 2023 at 18:52, Rebecca Cran <rebecca@bsdio.com> wrote:
> >
> > Thanks. Yes, that fixes it.
> >
> >
> > I also tried running the build script with CLANGDWARF, and it seems to
> > have found some valid problems with
> > Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
> >
> 
> Seems to me like an excellent opportunity to rip that thing out completely.

Sounds like the ideal solution. The /dev/mem of program loaders.

/
    Leif

> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:11:
> > error: variable 'FileSize' is used uninitialized whenever 'if' condition
> > is false [-Werror,-Wsometimes-uninitialized]
> >        if (FileHandle != NULL) {
> >            ^~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >    WriteBackDataCacheRange (FileData, FileSize);
> >                                       ^~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:7:
> > note: remove the 'if' if its condition is always true
> >        if (FileHandle != NULL) {
> >        ^~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> > error: variable 'FileSize' is used uninitialized whenever 'if' condition
> > is true [-Werror,-Wsometimes-uninitialized]
> >      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >    WriteBackDataCacheRange (FileData, FileSize);
> >                                       ^~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:5:
> > note: remove the 'if' if its condition is always false
> >      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> > error: variable 'FileSize' is used uninitialized whenever '||' condition
> > is true [-Werror,-Wsometimes-uninitialized]
> >      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >    WriteBackDataCacheRange (FileData, FileSize);
> >                                       ^~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> > note: remove the '||' if its condition is always false
> >      if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:7:
> > error: variable 'FileSize' is used uninitialized whenever 'if' condition
> > is true [-Werror,-Wsometimes-uninitialized]
> >    if (EFI_ERROR (Status)) {
> >        ^~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2/MdePkg/Include/Uefi/UefiBaseType.h:159:23:
> > note: expanded from macro 'EFI_ERROR'
> > #define EFI_ERROR(A)  RETURN_ERROR(A)
> >                        ^~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2/MdePkg/Include/Base.h:1061:35: note: expanded
> > from macro 'RETURN_ERROR'
> > #define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >    WriteBackDataCacheRange (FileData, FileSize);
> >                                       ^~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:3:
> > note: remove the 'if' if its condition is always false
> >    if (EFI_ERROR (Status)) {
> >    ^~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:136:39:
> > note: initialize the variable 'FileSize' to silence this warning
> >    UINTN                       FileSize;
> >                                        ^
> >                                         = 0
> > 4 errors generated.
> > make: *** [GNUmakefile:342:
> > /home/bcran/src/uefi/Build/ArmJuno/RELEASE_CLANGDWARF/AARCH64/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/RunAxf.obj]
> > Error 1
> >
> > --
> >
> > Rebecca Cran
> >
> >
> >
> > On 5/10/23 10:27, Ard Biesheuvel wrote:
> > > Hi Rebecca,
> > >
> > > On Wed, 10 May 2023 at 18:23, Rebecca Cran <rebecca@bsdio.com> wrote:
> > >> I ran my script that tries to build all Arm platforms in edk2-platforms
> > >> (with the exception of known broken ones) with the GCC5/GCC toolchain,
> > >> and noticed a new breakage since I last ran it a few months ago.
> > >>
> > >> Building JunoPkg for ARM doesn't work.
> > >>
> > >> I also noticed it passes both -march=armv7-a and -march=armv8-a.
> > >>
> > > This looks like a bug in the Juno package - if I grep for aarch64_bti
> > > in edk2, every single hit is in a aarch64 specific source or header
> > > file, but it is getting pulled into an ARM build.
> > >
> > > Does the below help?
> > >
> > > diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > > b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > > index 50efcfacdfe6..7d5eed94b25f 100644
> > > --- a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > > +++ b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
> > > @@ -4,7 +4,7 @@
> > >   //  SPDX-License-Identifier: BSD-2-Clause-Patent
> > >   //
> > >
> > > -#include <AsmMacroIoLibV8.h>
> > > +#include <AsmMacroIoLib.h>
> > >
> > >   // VOID
> > >   // RunAxfPivot (
> > >
> > >
> > >
> > >> "arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x
> > >> assembler -imacros AutoGen.h -mlittle-endian -o
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj
> > >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm
> > >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf
> > >> -I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG
> > >> -I/home/bcran/src/uefi/edk2/ArmPkg
> > >> -I/home/bcran/src/uefi/edk2/ArmPkg/Include
> > >> -I/home/bcran/src/uefi/edk2/MdeModulePkg
> > >> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include
> > >> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Include
> > >> -I/home/bcran/src/uefi/edk2/MdePkg
> > >> -I/home/bcran/src/uefi/edk2/MdePkg/Include
> > >> -I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include
> > >> -I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include
> > >> -I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm
> > >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM
> > >> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include
> > >> -I/home/bcran/src/uefi/edk2/ShellPkg
> > >> -I/home/bcran/src/uefi/edk2/ShellPkg/Include
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii
> > >> Trim --trim-long --source-code -o
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.iiii
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
> > >> Trim --trim-long --source-code -o
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.iiii
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:
> > >> Assembler messages:
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.iiii:17:
> > >> Error: bad instruction `aarch64_bti(c)'
> > >> make: *** [GNUmakefile:363:
> > >> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj]
> > >> Error 1
> > >>
> > >>
> > >> --
> > >> Rebecca Cran
> > >>

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

end of thread, other threads:[~2023-05-10 17:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-10 16:23 JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'" Rebecca Cran
2023-05-10 16:27 ` Ard Biesheuvel
2023-05-10 16:52   ` Rebecca Cran
2023-05-10 16:54     ` Ard Biesheuvel
2023-05-10 17:06       ` Leif Lindholm

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