From nobody Mon Feb 9 16:03:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39647+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39647+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1556289780; cv=none; d=zoho.com; s=zohoarc; b=HDekKSpbc/YhKNE9+y8QBgMK8wXhFsUJmd3YY0G9/c9G9tEVgzmZyIgw7JIg9XUsofl5tjgR55hUcNG45jlcTvpNEOUBNNhCj6BOhaLp7yqnkZ8VLqFhELdhmNgh+UfRCNhKqOKdrM4S7a6rh2qlu5BEqZxLpiM4FSjCME3opho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556289780; h=Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=52nvFeLN7IerjHmYcoKggNHWpZO3hAQPDbDZTgjFGxw=; b=Py9DsE9Z4+xrznkdOSh0kmNvUQtN3oa2fpzb9X3V70DyXVER/wTWd2zAWc9FMuDEalgh1MMwJ/8vvcNET0+8RMt5YnB9O7FLO7w3svojyCbEWJvMatVlZNKyNORFUN8UIEc9qoOvYRF14HqdgsQYZhQ18mjBVuSi5wvx/QrVZfw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39647+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556289780924866.1791359976403; Fri, 26 Apr 2019 07:43:00 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com []) by groups.io with SMTP; Fri, 26 Apr 2019 07:43:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 07:43:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,397,1549958400"; d="scan'208";a="145975674" X-Received: from lgao4-mobl1.ccr.corp.intel.com ([10.255.29.102]) by orsmga003.jf.intel.com with ESMTP; 26 Apr 2019 07:42:59 -0700 From: "Liming Gao" To: devel@edk2.groups.io Subject: [edk2-devel] [Patch 2/7] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Date: Fri, 26 Apr 2019 22:42:37 +0800 Message-Id: <20190426144242.19024-3-liming.gao@intel.com> In-Reply-To: <20190426144242.19024-1-liming.gao@intel.com> References: <20190426144242.19024-1-liming.gao@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,liming.gao@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556289780; bh=OfBSgWscP4ad5ndst9AXVwe9mQAAMtuabC0amjJBRgw=; h=Date:From:Reply-To:Subject:To; b=iSQZ58VpVGbYHYgDr0yYZBkGiWgiMyViEPx5K037cKjFbmC1A498xCq6B+yxtSvZv1s +IYUywnRoDKJ0zQUK0BBNU+CG96bZ2kOikzgaeZEFDgFk7rVaj92m4A6EShNDd50HLz+T n0XYvueuhd3ZJFTaHONNhny4lOoEr7Zccwc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" CLANG8ELF tool chain generated ELF image with the different attributes in section. Update GenFw to handle them. 1. .text section with writable attribute (support) 2. .reloc section has the symbol for *ABS* (skip) Signed-off-by: Liming Gao --- BaseTools/Source/C/GenFw/Elf32Convert.c | 12 +++--------- BaseTools/Source/C/GenFw/Elf64Convert.c | 11 +++-------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/G= enFw/Elf32Convert.c index 46089ff370..fd13278e3d 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -238,7 +238,7 @@ IsTextShdr ( Elf_Shdr *Shdr ) { - return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D SHF_= ALLOC); + return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) =3D=3D = (SHF_EXECINSTR | SHF_ALLOC)); } =20 STATIC @@ -261,7 +261,7 @@ IsDataShdr ( if (IsHiiRsrcShdr(Shdr)) { return FALSE; } - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D (SHF_= ALLOC | SHF_WRITE); + return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLO= C)) =3D=3D (SHF_ALLOC | SHF_WRITE); } =20 STATIC @@ -749,13 +749,7 @@ WriteSections32 ( if (SymName =3D=3D NULL) { SymName =3D (const UINT8 *)""; } - - Error (NULL, 0, 3000, "Invalid", - "%s: Bad definition for symbol '%s'@%#x or unsupported sy= mbol type. " - "For example, absolute and undefined symbols are not supp= orted.", - mInImageName, SymName, Sym->st_value); - - exit(EXIT_FAILURE); + continue; } SymShdr =3D GetShdrByIndex(Sym->st_shndx); =20 diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/G= enFw/Elf64Convert.c index 3d6319c821..35cebad27d 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -239,7 +239,7 @@ IsTextShdr ( Elf_Shdr *Shdr ) { - return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D SHF_= ALLOC); + return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) =3D=3D = (SHF_EXECINSTR | SHF_ALLOC)); } =20 STATIC @@ -262,7 +262,7 @@ IsDataShdr ( if (IsHiiRsrcShdr(Shdr)) { return FALSE; } - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) =3D=3D (SHF_= ALLOC | SHF_WRITE); + return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLO= C)) =3D=3D (SHF_ALLOC | SHF_WRITE); } =20 STATIC @@ -894,12 +894,7 @@ WriteSections64 ( SymName =3D (const UINT8 *)""; } =20 - Error (NULL, 0, 3000, "Invalid", - "%s: Bad definition for symbol '%s'@%#llx or unsupported = symbol type. " - "For example, absolute and undefined symbols are not supp= orted.", - mInImageName, SymName, Sym->st_value); - - exit(EXIT_FAILURE); + continue; } SymShdr =3D GetShdrByIndex(Sym->st_shndx); =20 --=20 2.13.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39647): https://edk2.groups.io/g/devel/message/39647 Mute This Topic: https://groups.io/mt/31354046/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-