Re: [edk2-devel] OvmfPkgX64: PlatformInitLib.lib(IntelTdx.obj): in function `ValidateHobList': undefined reference to `memcpy' (CLANG38 NOOPT)

2022-09-22 Thread Rebecca Cran

On 9/22/22 15:32, Ard Biesheuvel wrote:

This appears to be due to the use of initializers for the arrays.
Could you please check if the patch below makes the issue go away?

diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
index c6d7c8bb6e0e..0e0e13343b16 100644
--- a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
+++ b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
@@ -153,7 +153,7 @@ BOOLEAN
  EFIAPI
  IsInValidList (
IN UINT32  Value,
-  IN UINT32  *ValidList,
+  IN CONST UINT32  *ValidList,
IN UINT32  ValidListLength
)
  {
@@ -188,7 +188,7 @@ ValidateHobList (
)
  {
EFI_PEI_HOB_POINTERS  Hob;
-  UINT32EFI_BOOT_MODE_LIST[] = {
+  STATIC CONST UINT32   EFI_BOOT_MODE_LIST[] = {
  BOOT_WITH_FULL_CONFIGURATION,
  BOOT_WITH_MINIMAL_CONFIGURATION,
  BOOT_ASSUMING_NO_CONFIGURATION_CHANGES,
@@ -203,7 +203,7 @@ ValidateHobList (
  BOOT_IN_RECOVERY_MODE
};

-  UINT32  EFI_RESOURCE_TYPE_LIST[] = {
+  STATIC CONST UINT32  EFI_RESOURCE_TYPE_LIST[] = {
  EFI_RESOURCE_SYSTEM_MEMORY,
  EFI_RESOURCE_MEMORY_MAPPED_IO,
  EFI_RESOURCE_IO,


Yes, that fixes it.

--

Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94147): https://edk2.groups.io/g/devel/message/94147
Mute This Topic: https://groups.io/mt/93858052/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] OvmfPkgX64: PlatformInitLib.lib(IntelTdx.obj): in function `ValidateHobList': undefined reference to `memcpy' (CLANG38 NOOPT)

2022-09-22 Thread Ard Biesheuvel
On Thu, 22 Sept 2022 at 23:12, Rebecca Cran  wrote:
>
> I just noticed that edk2 master seems broken when building OvmfPkgX64.dsc 
> with -t CLANG38 -b NOOPT (using Debian clang version 11.0.1-2).
>
> "clang" -o
> /home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe/DEBUG/DiskIoDxe.dll
> -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40
> -Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint
> -Wl,-Map,/home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe/DEBUG/DiskIoDxe.map,--whole-archive
> -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie
> -mcmodel=small
> -Wl,--start-group,@/home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe/OUTPUT/static_library_files.lst,--end-group
> -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror
> -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections
> -fdata-sections -DSTRING_ARRAY_NAME=DiskIoDxeStrings
> -Wno-parentheses-equality -Wno-tautological-compare
> -Wno-tautological-constant-out-of-range-compare -Wno-empty-body
> -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option
> -Wno-unused-but-set-variable -Wno-unused-const-variable
> -fno-stack-protector -mms-bitfields -Wno-address
> -Wno-shift-negative-value -Wno-unknown-pragmas
> -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables
> -mno-sse -mno-mmx -msoft-float -mno-implicit-float
> -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
> -funsigned-char -fno-ms-extensions -Wno-null-dereference -m64
> "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie
> -O0 -target x86_64-pc-linux-gnu -g -mno-mmx -mno-sse -D
> DISABLE_NEW_DEPRECATED_INTERFACES -D TDX_GUEST_SUPPORTED -D
> ENABLE_MD5_DEPRECATED_INTERFACES -Wl,--defsym=PECOFF_HEADER_SIZE=0x228
> -Wl,--script=/home/rcran/src/upstream/uefi/edk2/BaseTools/Scripts/GccBase.lds
> -Wno-error -O0
> /usr/bin/ld:
> /home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/OvmfPkg/Library/PlatformInitLib/PlatformInitLib/OUTPUT/PlatformInitLib.lib(IntelTdx.obj):
> in function `ValidateHobList':
> /home/rcran/src/upstream/uefi/edk2/OvmfPkg/Library/PlatformInitLib/IntelTdx.c:191:
> undefined reference to `memcpy'
>

Hello Rebecca,

This appears to be due to the use of initializers for the arrays.
Could you please check if the patch below makes the issue go away?

diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
index c6d7c8bb6e0e..0e0e13343b16 100644
--- a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
+++ b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c
@@ -153,7 +153,7 @@ BOOLEAN
 EFIAPI
 IsInValidList (
   IN UINT32  Value,
-  IN UINT32  *ValidList,
+  IN CONST UINT32  *ValidList,
   IN UINT32  ValidListLength
   )
 {
@@ -188,7 +188,7 @@ ValidateHobList (
   )
 {
   EFI_PEI_HOB_POINTERS  Hob;
-  UINT32EFI_BOOT_MODE_LIST[] = {
+  STATIC CONST UINT32   EFI_BOOT_MODE_LIST[] = {
 BOOT_WITH_FULL_CONFIGURATION,
 BOOT_WITH_MINIMAL_CONFIGURATION,
 BOOT_ASSUMING_NO_CONFIGURATION_CHANGES,
@@ -203,7 +203,7 @@ ValidateHobList (
 BOOT_IN_RECOVERY_MODE
   };

-  UINT32  EFI_RESOURCE_TYPE_LIST[] = {
+  STATIC CONST UINT32  EFI_RESOURCE_TYPE_LIST[] = {
 EFI_RESOURCE_SYSTEM_MEMORY,
 EFI_RESOURCE_MEMORY_MAPPED_IO,
 EFI_RESOURCE_IO,


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94144): https://edk2.groups.io/g/devel/message/94144
Mute This Topic: https://groups.io/mt/93858052/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] OvmfPkgX64: PlatformInitLib.lib(IntelTdx.obj): in function `ValidateHobList': undefined reference to `memcpy' (CLANG38 NOOPT)

2022-09-22 Thread Rebecca Cran

I just noticed that edk2 master seems broken when building OvmfPkgX64.dsc with 
-t CLANG38 -b NOOPT (using Debian clang version 11.0.1-2).

"clang" -o 
/home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe/DEBUG/DiskIoDxe.dll 
-nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40 
-Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint 
-Wl,-Map,/home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe/DEBUG/DiskIoDxe.map,--whole-archive 
-Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat=elf64-x86-64 -Wl,-pie 
-mcmodel=small 
-Wl,--start-group,@/home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe/OUTPUT/static_library_files.lst,--end-group 
-g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror 
-Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections 
-fdata-sections -DSTRING_ARRAY_NAME=DiskIoDxeStrings 
-Wno-parentheses-equality -Wno-tautological-compare 
-Wno-tautological-constant-out-of-range-compare -Wno-empty-body 
-Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option 
-Wno-unused-but-set-variable -Wno-unused-const-variable 
-fno-stack-protector -mms-bitfields -Wno-address 
-Wno-shift-negative-value -Wno-unknown-pragmas 
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables 
-mno-sse -mno-mmx -msoft-float -mno-implicit-float 
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang 
-funsigned-char -fno-ms-extensions -Wno-null-dereference -m64 
"-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie 
-O0 -target x86_64-pc-linux-gnu -g -mno-mmx -mno-sse -D 
DISABLE_NEW_DEPRECATED_INTERFACES -D TDX_GUEST_SUPPORTED -D 
ENABLE_MD5_DEPRECATED_INTERFACES -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 
-Wl,--script=/home/rcran/src/upstream/uefi/edk2/BaseTools/Scripts/GccBase.lds 
-Wno-error -O0
/usr/bin/ld: 
/home/rcran/src/upstream/uefi/edk2/Build/OvmfX64/NOOPT_CLANG38/X64/OvmfPkg/Library/PlatformInitLib/PlatformInitLib/OUTPUT/PlatformInitLib.lib(IntelTdx.obj): 
in function `ValidateHobList':
/home/rcran/src/upstream/uefi/edk2/OvmfPkg/Library/PlatformInitLib/IntelTdx.c:191: 
undefined reference to `memcpy'


--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94143): https://edk2.groups.io/g/devel/message/94143
Mute This Topic: https://groups.io/mt/93858052/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-