From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web08.7552.1622856932540071579 for ; Fri, 04 Jun 2021 18:35:33 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.224.112.124]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Sat, 05 Jun 2021 09:35:28 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 101.224.112.124 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Leif Lindholm'" Cc: "'Feng, Bob C'" References: <20210602081145.265-1-ray.ni@intel.com> <20210602081145.265-3-ray.ni@intel.com> <20210604133124.knyesmliadsvvb5v@leviathan> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYyIDIvNl0gQmFzZVRvb2xzIEdlbkZ3OiBTdXBwb3J0IENMQU5HOEVMRiB3aXRoIGNvbnZlcnNpb24gRUxGIHRvIFBFL0NPRkYgaW1hZ2U=?= Date: Sat, 5 Jun 2021 09:35:30 +0800 Message-ID: <001001d759ab$123baf20$36b30d60$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFOOTmnleENGS6zI6PMov9mD1u1LQHriH5fAiiwlacCy0rUlKvf3kDQ Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Ray: When convert the image to ACPI data, only data section is required. So, = we can update GenFw tool not do this check when convert ACPI data.=20 I just send the patch to update GenFw tool. This issue happens on GCC49 tool chain. So, it is not detected in open C= I with GCC5 tool chain.=20 Below is the attributes for the generated aslc elf image with GCC49. Its= . text section has no CODE attribute.=20 Sections: Idx Name Size VMA LMA File off Algn 0 .text 00000008 0000000000000000 0000000000000000 00010000 2**5 CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA 1 .data 00000350 0000000000000020 0000000000000020 00010020 2**5 CONTENTS, ALLOC, LOAD, DATA Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA= =B1=ED Ni, Ray > =B7=A2=CB=CD=CA=B1=BC=E4: 2021=C4=EA6=D4=C25=C8=D5 8:07 > =CA=D5=BC=FE=C8=CB: Leif Lindholm ; devel@edk2.groups= .io > =B3=AD=CB=CD: Liming Gao ; Feng, Bob C > > =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v2 2/6] BaseTools GenFw: Support C= LANG8ELF > with conversion ELF to PE/COFF image >=20 > Leif, > Sorry to hear that. It seems a CI gap that doesn't capture such errors. > It looks like the logic update to detect .text section doesn't work in your case. >=20 > I am trying to build the OVMF Bhyve because I saw it contains an AcpiTables > module that has .aslc file. >=20 > Thanks, > Ray >=20 >=20 > > -----Original Message----- > > From: Leif Lindholm > > Sent: Friday, June 4, 2021 9:31 PM > > To: devel@edk2.groups.io; Ni, Ray > > 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 > > > > 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 attribut= es > > > 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)) =3D= =3D > SHF_ALLOC); > > > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) > =3D=3D (SHF_EXECINSTR | SHF_ALLOC)); > > > } > > > > > > 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_ALLOC)) =3D=3D (SHF_ALLOC | SHF_WRITE); > > > } > > > > > > 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 symbol type. " > > > - "For example, absolute and undefined symbols are > not supported.", > > > - mInImageName, SymName, Sym->st_value); > > > - > > > - exit(EXIT_FAILURE); > > > + continue; > > > } > > > SymShdr =3D 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)) =3D= =3D > SHF_ALLOC); > > > + return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) > =3D=3D (SHF_EXECINSTR | SHF_ALLOC)); > > > } > > > > > > STATIC > > > @@ -269,7 +269,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_ALLOC)) =3D=3D (SHF_ALLOC | SHF_WRITE); > > > } > > > > > > STATIC > > > @@ -1060,6 +1060,7 @@ WriteSections64 ( > > > > > > exit(EXIT_FAILURE); > > > } > > > + continue; > > > } > > > SymShdr =3D GetShdrByIndex(Sym->st_shndx); > > > > > > -- > > > 2.31.1.windows.1 > > > > > > > > > > > > > > > > > > >=20 >=20 >=20 >=20