public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Rebecca Cran <rebecca@bluestop.org>,
	edk2-devel-01 <edk2-devel@lists.01.org>
Subject: Re: Undefined symbols AsmCpuid, AsmReadCr0 etc. when building OvmfPkgX64 on FreeBSD
Date: Wed, 26 Dec 2018 21:16:41 +0100	[thread overview]
Message-ID: <c9957298-4303-c092-afa4-066e860d5c28@redhat.com> (raw)
In-Reply-To: <etPan.5c1eb85f.615599c7.34b6@bluestop.org>

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

      reply	other threads:[~2018-12-26 20:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9957298-4303-c092-afa4-066e860d5c28@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox