Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: ec1f28670a52c3d7ec8cbe8a61e1015b8ab8cba7
      
https://github.com/tianocore/edk2/commit/ec1f28670a52c3d7ec8cbe8a61e1015b8ab8cba7
  Author: Yeoreum Yun <[email protected]>
  Date:   2026-04-10 (Fri, 10 Apr 2026)

  Changed paths:
    M BaseTools/Conf/tools_def.template

  Log Message:
  -----------
  BaseTools: add --apply-dynamic-relocs option for AARCH64 CLAGNDWARF

StandaloneMm is loaded failure when it built with clang-22.
This is because mMmMemoryMap is intialised incorrectly by compiler:

  MmMain - 0xFF025040
  [StandaloneMmMain:849] mMmMemoryMap: 0xFF21D238
  [StandaloneMmMain:850] mMmMemoryMap->ForwardLink: 0xFF201000
  [StandaloneMmMain:851] mMmMemoryMap->BackLink: 0xFF201000

The 0xFF20100 is loaded image address. However list_head -- mMemoryMap
doesn't initialised properly by ld-lld.

Here, ld with gcc initialised mMmMemoryMap list head properly:

  // 0x12490: &mMmMemoryMap
  # hexdump -Cv -s 0x12490 -n 64 StandaloneMmCore.efi

  00012490  90 24 01 00 00 00 00 00  90 24 01 00 00 00 00 00  |.$.......$......|
  ...

However, ld-lld with clang doesn't:

  // 0x1c238: &mMmMemoryMap
  # hexdump -Cv -s 0x1c238 -n 64 StandaloneMmCore.efi

  0001c238  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

To address this, add --apply-dynamic-relocs linker option.
After this patch, StandaloneMm is loaded preoperly and mMmMemoryMap
is intialised correctly:

ld-lld with clang with --aply-dynamic-reclos option:

  // 0x1d238: &mMmMemoryMap
  # hexdump -Cv -s 0x1d238 -n 64 StandaloneMmCore.efi

  0001d238  38 d2 01 00 00 00 00 00  38 d2 01 00 00 00 00 00  |8.......8.......|

Signed-off-by: Yeoreum Yun <[email protected]>


  Commit: 5107351f77b5bb873ae03f2a32a27113f579f7e2
      
https://github.com/tianocore/edk2/commit/5107351f77b5bb873ae03f2a32a27113f579f7e2
  Author: Yeoreum Yun <[email protected]>
  Date:   2026-04-10 (Fri, 10 Apr 2026)

  Changed paths:
    M TcgTpmPkg/Library/TpmLib/TpmLib.inf

  Log Message:
  -----------
  TcgTpmPkg: fix build failure of TpmLib with CLANGDWARF

When TpmLib is built with llvm, below error is splat:

  edk2/TcgTpmPkg/Library/TpmLib/TPM/TPMCmd/tpm/src/crypt/CryptRand.c:388:12: 
error: logical not is only applied to the left hand side of this comparison 
[-Werror,-Wlogical-not-parentheses]
    388 |         if(DRBG_ENCRYPT_SETUP((BYTE*)key, DRBG_KEY_SIZE_BITS, 
&localKeySchedule) != 0)

To build TCG TPM v2.0 reference library properly, ignore above warning.

Signed-off-by: Yeoreum Yun <[email protected]>


Compare: https://github.com/tianocore/edk2/compare/11a89ec0305f...5107351f77b5

To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to