public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Undefined symbols AsmCpuid, AsmReadCr0 etc. when building OvmfPkgX64 on FreeBSD
@ 2018-12-22 22:19 Rebecca Cran
  2018-12-26 20:16 ` Laszlo Ersek
  0 siblings, 1 reply; 2+ messages in thread
From: Rebecca Cran @ 2018-12-22 22:19 UTC (permalink / raw)
  To: edk2-devel-01

While the RELEASE build of OvmfPkgX64 works fine, the DEBUG build is failing with undefined symbols AsmCpuid etc. when building on my FreeBSD 13-CURRENT system.
I’m trying to build git revision 559a07d84e5af3db09ae91844e4cb924b8f60668 (from Thu Dec 13 16:48:44 2018 -0700).
I’m building with gcc 7.4, running the command:

build -p OvmfPkg/OvmfPkgX64.dsc -t GCC5 -b DEBUG -a X64

The last few lines of output are:


"gcc" -o /home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe/DEBUG/Ps2KeyboardDxe.dll -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40 -Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint -Wl,-Map,/home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe/DEBUG/Ps2KeyboardDxe.map,--whole-archive -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie -flto -Os -Wl,--start-group,@/home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe/OUTPUT/static_library_files.lst,--end-group -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=Ps2KeyboardDxeStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 -Wl,--script=/home/bcran/workspace/edk2/BaseTools/Scripts/GccBase.lds -Wno-error
Building ... /home/bcran/workspace/edk2/PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf [X64]
make: Nothing to be done for 'tbuild'.
Building ... /home/bcran/workspace/edk2/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf [X64]
Building ... /home/bcran/workspace/edk2/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf [X64]
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
make: Nothing to be done for 'tbuild'.
Building ... /home/bcran/workspace/edk2/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf [X64]
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `GetMemEncryptionAddressMask':
Building ... /home/bcran/workspace/edk2/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf [X64]
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:57: undefined reference to `AsmCpuid'
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `WriteBackInvalidateDataCacheRange':
/home/bcran/workspace/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c:141: undefined reference to `AsmCpuid'
/home/bcran/workspace/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c:143: undefined reference to `AsmWbinvd'
/home/bcran/workspace/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c:160: undefined reference to `AsmFlushCacheLine'
make: Nothing to be done for 'tbuild'.
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `IsReadOnlyPageWriteProtected':
make: Nothing to be done for 'tbuild'.
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:521: undefined reference to `AsmReadCr0'
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `DisableReadOnlyPageWriteProtect':
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:534: undefined reference to `AsmReadCr0'
Building ... /home/bcran/workspace/edk2/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf [X64]
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:534: undefined reference to `AsmWriteCr0'
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `SetMemoryEncDec':
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:655: undefined reference to `AsmReadCr3'
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `EnableReadOnlyPageWriteProtect':
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:545: undefined reference to `AsmReadCr0'
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:545: undefined reference to `AsmWriteCr0'
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `InternalMemEncryptSevIsEnabled':
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/MemEncryptSevLibInternal.c:52: undefined reference to `AsmCpuid'
/home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/MemEncryptSevLibInternal.c:57: undefined reference to `AsmCpuid'
/tmp//ccVNNewx.ltrans0.ltrans.o: In function `AsmReadMsr32':
/home/bcran/workspace/edk2/MdePkg/Library/BaseLib/X86Msr.c:39: undefined reference to `AsmReadMsr64'
collect2: error: ld returned 1 exit status
make: *** [GNUmakefile:397: /home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AmdSevDxe/AmdSevDxe/DEBUG/AmdSevDxe.dll] Error 1


— 
Rebecca
>From Achin.Gupta@arm.com  Sun Dec 23 04:36:34 2018
Return-Path: <Achin.Gupta@arm.com>
X-Original-To: edk2-devel@lists.01.org
Delivered-To: edk2-devel@lists.01.org
Received-SPF: Pass (sender SPF authorized) identity

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

* Re: Undefined symbols AsmCpuid, AsmReadCr0 etc. when building OvmfPkgX64 on FreeBSD
  2018-12-22 22:19 Undefined symbols AsmCpuid, AsmReadCr0 etc. when building OvmfPkgX64 on FreeBSD Rebecca Cran
@ 2018-12-26 20:16 ` Laszlo Ersek
  0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2018-12-26 20:16 UTC (permalink / raw)
  To: Rebecca Cran, edk2-devel-01

On 12/22/18 23:19, Rebecca Cran via edk2-devel wrote:
> While the RELEASE build of OvmfPkgX64 works fine, the DEBUG build is failing with undefined symbols AsmCpuid etc. when building on my FreeBSD 13-CURRENT system.
> I’m trying to build git revision 559a07d84e5af3db09ae91844e4cb924b8f60668 (from Thu Dec 13 16:48:44 2018 -0700).
> I’m building with gcc 7.4, running the command:
> 
> build -p OvmfPkg/OvmfPkgX64.dsc -t GCC5 -b DEBUG -a X64
> 
> The last few lines of output are:
> 
> 
> "gcc" -o /home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe/DEBUG/Ps2KeyboardDxe.dll -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x40 -Wl,--entry,_ModuleEntryPoint -u _ModuleEntryPoint -Wl,-Map,/home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe/DEBUG/Ps2KeyboardDxe.map,--whole-archive -Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie -flto -Os -Wl,--start-group,@/home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe/OUTPUT/static_library_files.lst,--end-group -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=Ps2KeyboardDxeStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 -Wl,--script=/home/bcran/workspace/edk2/BaseTools/Scripts/GccBase.lds -Wno-error
> Building ... /home/bcran/workspace/edk2/PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf [X64]
> make: Nothing to be done for 'tbuild'.
> Building ... /home/bcran/workspace/edk2/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf [X64]
> Building ... /home/bcran/workspace/edk2/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf [X64]
> make: Nothing to be done for 'tbuild'.
> make: Nothing to be done for 'tbuild'.
> make: Nothing to be done for 'tbuild'.
> Building ... /home/bcran/workspace/edk2/MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf [X64]
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `GetMemEncryptionAddressMask':
> Building ... /home/bcran/workspace/edk2/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf [X64]
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:57: undefined reference to `AsmCpuid'
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `WriteBackInvalidateDataCacheRange':
> /home/bcran/workspace/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c:141: undefined reference to `AsmCpuid'
> /home/bcran/workspace/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c:143: undefined reference to `AsmWbinvd'
> /home/bcran/workspace/edk2/MdePkg/Library/BaseCacheMaintenanceLib/X86Cache.c:160: undefined reference to `AsmFlushCacheLine'
> make: Nothing to be done for 'tbuild'.
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `IsReadOnlyPageWriteProtected':
> make: Nothing to be done for 'tbuild'.
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:521: undefined reference to `AsmReadCr0'
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `DisableReadOnlyPageWriteProtect':
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:534: undefined reference to `AsmReadCr0'
> Building ... /home/bcran/workspace/edk2/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf [X64]
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:534: undefined reference to `AsmWriteCr0'
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `SetMemoryEncDec':
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:655: undefined reference to `AsmReadCr3'
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `EnableReadOnlyPageWriteProtect':
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:545: undefined reference to `AsmReadCr0'
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c:545: undefined reference to `AsmWriteCr0'
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `InternalMemEncryptSevIsEnabled':
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/MemEncryptSevLibInternal.c:52: undefined reference to `AsmCpuid'
> /home/bcran/workspace/edk2/OvmfPkg/Library/BaseMemEncryptSevLib/MemEncryptSevLibInternal.c:57: undefined reference to `AsmCpuid'
> /tmp//ccVNNewx.ltrans0.ltrans.o: In function `AsmReadMsr32':
> /home/bcran/workspace/edk2/MdePkg/Library/BaseLib/X86Msr.c:39: undefined reference to `AsmReadMsr64'
> collect2: error: ld returned 1 exit status
> make: *** [GNUmakefile:397: /home/bcran/workspace/edk2/Build/OvmfX64/DEBUG_GCC5/X64/OvmfPkg/AmdSevDxe/AmdSevDxe/DEBUG/AmdSevDxe.dll] Error 1

looks like an LTO bug in gcc-7 to me. I've googled LTO bugs with
reference to gcc-7, and I've found two (in the gcc bugzilla tracker).
Those had been reported for gcc-7.1 and gcc-7.2 though, and they should
be fixed in gcc-7.4 (which is what you are using). Sorry, no better idea.

Laszlo

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

end of thread, other threads:[~2018-12-26 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-22 22:19 Undefined symbols AsmCpuid, AsmReadCr0 etc. when building OvmfPkgX64 on FreeBSD Rebecca Cran
2018-12-26 20:16 ` Laszlo Ersek

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