From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mx.groups.io with SMTP id smtpd.web08.8192.1622813488061115136 for ; Fri, 04 Jun 2021 06:31:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=10Xs2wup; spf=pass (domain: nuviainc.com, ip: 209.85.128.42, mailfrom: leif@nuviainc.com) Received: by mail-wm1-f42.google.com with SMTP id h5-20020a05600c3505b029019f0654f6f1so7399845wmq.0 for ; Fri, 04 Jun 2021 06:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yANFh3pGQYkZZmkDrDH9NnfbG3aCv5i/GA4zZ7BSC5Q=; b=10Xs2wupxY+A3Z0VUBZHKV8wZ3t5kmd/3DuRwpYYCtZdnNluAdIspapCWuqCFj5D+g aOKc1oMtKG3G6SEhMKeac5QA4JB1LOzCgHKAWvHUbcR4MN1BgEW2rzYW30Ppn/mkFz7n QG8x6lVf9xINMx3ttEkD62Qk34X9s6X4DtHmmjn00zYnp1gd4hh5gAqo99tLTQekUu02 f/ZhqCDSgg1q7++GDCB5U7AYcb5XFSqk5DVgaozeFa7Zzm7BSZGJyJCg1blPkjakxuBM 6L+7sArbv8glLy9oA6WVzybxskJ/rHW3hGOkWMG02WoBsMsJbnyB4dF7fneTKJILnEyt /PdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yANFh3pGQYkZZmkDrDH9NnfbG3aCv5i/GA4zZ7BSC5Q=; b=YkuQbirxRREnQrqjKAiaTlC2eApoU8pn6clKhB4QkFHchYAK7bPoE6wB61rh9jHPj6 XbMOr1nzgSbvxe62N+yAZia6vU70fxXNs0k/mmTBHiCfPoTyqRd9pryA7o52t/ybwkoZ b9kTGcN+Tdn5Hz7D+uBtVJtt3AJrbNbSMxU7+lRoAQvvQBCMJWFMLehZlhBOqXiMZ0hO 23MyifXmlESJesz9Wojfdsj0SONzR9xNJWSylCwr9S1Qn6ERcZg6xDgzDVY4vKdMJuHr K7/+Zzz8P1/nekEMwC0U/YIk3drZL8fRDmTfkLRC6UAr1SYLsYoygIc0aWKkcOuwcmZR JaSg== X-Gm-Message-State: AOAM532rIyF75zF4h5EkDQNma0hlryOU/mI5T3zntjK21XEU+lFVSe9u ql2eJjaen3px8OsGAHSIyVsFdCWqu9em1JixX/cvMCUzs6UtE3gEgo/R0/xlLkZFyIuJwZXR3+i tfJ3nczNBMwV1dYRyEQ4z3ZFxQJtxr87Yfqtpq2Zm/xjuK0ZkvH1Q9zcEUohD5BylZQ== X-Google-Smtp-Source: ABdhPJw2sMYAq/fq9On6KriC83O8D9BT2fxh8r+9Cijoyct3W+qOrrzto/kk+V42/t2XTw9LkbJ+pw== X-Received: by 2002:a1c:4b12:: with SMTP id y18mr3725405wma.70.1622813486303; Fri, 04 Jun 2021 06:31:26 -0700 (PDT) Return-Path: Received: from leviathan (cpc1-cmbg19-2-0-cust915.5-4.cable.virginm.net. [82.27.183.148]) by smtp.gmail.com with ESMTPSA id a15sm8038281wrs.63.2021.06.04.06.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 06:31:25 -0700 (PDT) Date: Fri, 4 Jun 2021 14:31:24 +0100 From: "Leif Lindholm" To: devel@edk2.groups.io, ray.ni@intel.com Cc: Liming Gao , Feng Bob C Subject: Re: [edk2-devel] [PATCH v2 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Message-ID: <20210604133124.knyesmliadsvvb5v@leviathan> References: <20210602081145.265-1-ray.ni@intel.com> <20210602081145.265-3-ray.ni@intel.com> MIME-Version: 1.0 In-Reply-To: <20210602081145.265-3-ray.ni@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Ray, On Wed, Jun 02, 2021 at 16:11:41 +0800, Ni, Ray wrote: > From: Liming Gao > > 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 > Reviewed-by: Feng Bob C This commit breaks many of the ARM platforms. I end up seeing GenFw: Elf64Convert.c:719: ScanSections64: Assertion `FALSE' failed. when generating certain ACPI tables. Note: this applies to both GCC5 and CLANG38 - it is not isolated to CLANG8ELF. Reverting to commit c1aa3bab1259 makes these builds work again. / Leif > --- > BaseTools/Source/C/GenFw/Elf32Convert.c | 12 +++--------- > BaseTools/Source/C/GenFw/Elf64Convert.c | 5 +++-- > 2 files changed, 6 insertions(+), 11 deletions(-) > > diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c > index 2485b2cb7a..7c8a065678 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)) == SHF_ALLOC); > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)); > } > > STATIC > @@ -261,7 +261,7 @@ IsDataShdr ( > if (IsHiiRsrcShdr(Shdr)) { > return FALSE; > } > - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); > + return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); > } > > STATIC > @@ -749,13 +749,7 @@ WriteSections32 ( > if (SymName == NULL) { > SymName = (const UINT8 *)""; > } > - > - Error (NULL, 0, 3000, "Invalid", > - "%s: Bad definition for symbol '%s'@%#x or unsupported symbol type. " > - "For example, absolute and undefined symbols are not supported.", > - mInImageName, SymName, Sym->st_value); > - > - exit(EXIT_FAILURE); > + continue; > } > SymShdr = GetShdrByIndex(Sym->st_shndx); > > diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c > index d097db8632..8fe672e984 100644 > --- a/BaseTools/Source/C/GenFw/Elf64Convert.c > +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c > @@ -246,7 +246,7 @@ IsTextShdr ( > Elf_Shdr *Shdr > ) > { > - return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)); > } > > STATIC > @@ -269,7 +269,7 @@ IsDataShdr ( > if (IsHiiRsrcShdr(Shdr)) { > return FALSE; > } > - return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); > + return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE); > } > > STATIC > @@ -1060,6 +1060,7 @@ WriteSections64 ( > > exit(EXIT_FAILURE); > } > + continue; > } > SymShdr = GetShdrByIndex(Sym->st_shndx); > > -- > 2.31.1.windows.1 > > > > > >