Skip to content

BSA ACS does not build with Clang 20 #52

@hrw

Description

@hrw

EDK2 can be built with either GCC or Clang. BSA ACS fails to build with latter one.

tools/scripts/acsbuild.sh needs "s/-t GCC/-t CLANGDWARF/" change to test it.

Then it fails:

/sysarch-acs/pal/uefi_acpi/src/pal_acpi.c:31:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
   31 | #include "include/pal_pmu.h"
      |          ^
/sysarch-acs/pal/uefi_acpi/include/pal_pmu.h:54:9: note: previous '#pragma pack' directive that modifies alignment is here
   54 | #pragma pack(1)
      |         ^
/sysarch-acs/pal/uefi_acpi/src/pal_acpi.c:32:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]
   32 | #include "include/pal_mpam.h"
      |          ^
/sysarch-acs/pal/uefi_acpi/include/pal_mpam.h:66:9: note: previous '#pragma pack' directive that modifies alignment is here
   66 | #pragma pack()
      |         ^

Other place:

/sysarch-acs/pal/uefi_acpi/src/pal_pcie.c:277:40: error: implicit conversion from enumeration type 'EFI_PCI_IO_PROTOCOL_WIDTH' to different enumeration type 'EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH' [-Werror,-Wenum-conversion]
  277 |           Status = Pci->Mem.Read (Pci, EfiPciIoWidthUint32, address, 1, data);
      |                    ~~~                 ^~~~~~~~~~~~~~~~~~~
/sysarch-acs/pal/uefi_acpi/src/pal_pcie.c:325:41: error: implicit conversion from enumeration type 'EFI_PCI_IO_PROTOCOL_WIDTH' to different enumeration type 'EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH' [-Werror,-Wenum-conversion]
  325 |           Status = Pci->Mem.Write (Pci, EfiPciIoWidthUint32, address, 1, &data);
      |                    ~~~                  ^~~~~~~~~~~~~~~~~~~

I know that you target GCC toolchain only. But using two different ones allows to catch mistakes like above.

$ clang --version
clang version 20.1.8 (Fedora 20.1.8-1.fc42)
Target: aarch64-redhat-linux-gnu

Metadata

Metadata

Labels

bsaBase System Architecture ACS specific issues/enhancements/questions.drtmDRTM specific issues/enhancements/questions.mem-testMemory consistency test specific issues/enhancements/questions.pc-bsaPC BSA ACS specific issues/enhancements/questions.sbsaServer Base System Architecture ACS specific issues/enhancements/questions.sys-mpamSystem MPAM ACS specific issues/enhancements/questions.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions