From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.8293.1621409011690715786 for ; Wed, 19 May 2021 00:23:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VPf1K9Zr; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621409010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O0CyDlkn2pJItdRejvORKqNYYDHoO9Xm11rr4x9qCc0=; b=VPf1K9Zr6q8cLRWG6RQ9xQtjd0kwC3w+FTlXPxkQdPE39/Kzm6df1Cnu0ZfZpJSr9iuQ/E 5yyFKbKjoMgF6itqls1iLvAeRLknSZYLR1DuD1HivrnC40k5AYfeVEwYdCj70DOVlfufDf tQ4LQz+MbkvFvuX4zz3LCTszOnuGvys= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-nAK8nvBuPOKWOSdE5tFH-A-1; Wed, 19 May 2021 03:23:24 -0400 X-MC-Unique: nAK8nvBuPOKWOSdE5tFH-A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCCA964149; Wed, 19 May 2021 07:23:22 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-238.ams2.redhat.com [10.36.112.238]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DFECF51C35; Wed, 19 May 2021 07:23:20 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] BaseTools: Add -ffat-lto-objects option in GCC5 tool chain To: devel@edk2.groups.io, gaoliming@byosoft.com.cn Cc: Sergei Dmitrouk , Bob Feng , Ard Biesheuvel References: <20210519022704.309-1-gaoliming@byosoft.com.cn> From: "Laszlo Ersek" Message-ID: <4750f3f7-b558-e46d-4977-d8cd8ef24039@redhat.com> Date: Wed, 19 May 2021 09:23:19 +0200 MIME-Version: 1.0 In-Reply-To: <20210519022704.309-1-gaoliming@byosoft.com.cn> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Liming, On 05/19/21 04:27, gaoliming wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3403 > > This option can trig the uninitialized warning when lto is enabled. > The image size data is also collected for OVMF. There is no impact. > > Cc: Sergei Dmitrouk > Cc: Bob Feng > Cc: Ard Biesheuvel > Signed-off-by: Liming Gao > --- > BaseTools/Conf/tools_def.template | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) I've now read the documentation on "-ffat-lto-objects", and I agree that it should not affect the final module executable sizes. However, I don't understand how this option *helps*. You mention "uninitialized warning". I find nothing related to that in the documentation. According to the documentation, "fat" LTO objects include both object code and intermediate language (GIMPLE) bytecode. Such objects can then be linked with, or without, link-time (= interprocedural) optimization. As I understand the documentation, "fat" LTO objects only make a difference if there are parts of the toolchain that are themselves unaware of LTO, and so need the GIMPLE bytecode to be present in the object files. I *guess* that this is the situation that we have in edk2 -- is there perhaps something in our toolchain(s) that does not "notice" LTO without "fat" LTO objects, and therefore we fail to emit a warning? Because, without LTO, we don't notice that an initialization is missing? This is too speculative. The commit message should please include more details. I'd like to understand what code in edk2 is affected, what the specific warning is, what the problematic component in the toolchain is (i.e., what tool requires GIMPLE bytecode to be present in the object file). Thanks, Laszlo > > diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template > index 498696e583..aad5297385 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -2315,10 +2315,10 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 > *_GCC5_IA32_OBJCOPY_FLAGS = > *_GCC5_IA32_NASM_FLAGS = -f elf32 > > - DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os > + DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -ffat-lto-objects -flto -Os > DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386 > > -RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os -Wno-unused-but-set-variable -Wno-unused-const-variable > +RELEASE_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -ffat-lto-objects -flto -Os -Wno-unused-but-set-variable -Wno-unused-const-variable > RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386 > > NOOPT_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -O0 > @@ -2347,10 +2347,10 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl, > *_GCC5_X64_OBJCOPY_FLAGS = > *_GCC5_X64_NASM_FLAGS = -f elf64 > > - DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os > + DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -ffat-lto-objects -flto -DUSING_LTO -Os > DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os > > -RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os -Wno-unused-but-set-variable -Wno-unused-const-variable > +RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -ffat-lto-objects -flto -DUSING_LTO -Os -Wno-unused-but-set-variable -Wno-unused-const-variable > RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os > > NOOPT_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -O0 > @@ -2382,10 +2382,10 @@ RELEASE_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os > *_GCC5_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_GCC5_ARM_CC_XIPFLAGS = DEF(GCC5_ARM_CC_XIPFLAGS) > > - DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > + DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -ffat-lto-objects -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm > > -RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > +RELEASE_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -ffat-lto-objects -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-arm -Wl,-plugin-opt=-pass-through=-llto-arm > > NOOPT_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0 > @@ -2416,11 +2416,11 @@ RELEASE_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS) -flto -Os -L$(WORKS > *_GCC5_AARCH64_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS) > *_GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC5_AARCH64_CC_XIPFLAGS) > > - DEBUG_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > + DEBUG_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -ffat-lto-objects -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > DEBUG_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch > DEBUG_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 > > -RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > +RELEASE_GCC5_AARCH64_CC_FLAGS = DEF(GCC5_AARCH64_CC_FLAGS) -ffat-lto-objects -flto -Wno-unused-but-set-variable -Wno-unused-const-variable > RELEASE_GCC5_AARCH64_DLINK_FLAGS = DEF(GCC5_AARCH64_DLINK_FLAGS) -flto -Os -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 -Wno-lto-type-mismatch > RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 > >