回复: [edk2-devel] [PATCH v2 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image

gaoliming gaoliming at byosoft.com.cn
Sat Jun 5 01:35:30 UTC 2021


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. 
  I just send the patch to update GenFw tool.

  This issue happens on GCC49 tool chain. So, it is not detected in open CI
with GCC5 tool chain. 

  Below is the attributes for the generated aslc elf image with GCC49. Its .
text section has no CODE attribute. 

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
> -----邮件原件-----
> 发件人: devel at edk2.groups.io <devel at edk2.groups.io> 代表 Ni, Ray
> 发送时间: 2021年6月5日 8:07
> 收件人: Leif Lindholm <leif at nuviainc.com>; devel at edk2.groups.io
> 抄送: Liming Gao <gaoliming at byosoft.com.cn>; Feng, Bob C
> <bob.c.feng at intel.com>
> 主题: Re: [edk2-devel] [PATCH v2 2/6] BaseTools GenFw: Support CLANG8ELF
> with conversion ELF to PE/COFF image
> 
> 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.
> 
> I am trying to build the OVMF Bhyve because I saw it contains an
AcpiTables
> module that has .aslc file.
> 
> Thanks,
> Ray
> 
> 
> > -----Original Message-----
> > From: Leif Lindholm <leif at nuviainc.com>
> > Sent: Friday, June 4, 2021 9:31 PM
> > To: devel at edk2.groups.io; Ni, Ray <ray.ni at intel.com>
> > Cc: Liming Gao <gaoliming at byosoft.com.cn>; Feng, Bob C
> <bob.c.feng at intel.com>
> > 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 <gaoliming at byosoft.com.cn>
> > >
> > > 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 <gaoliming at byosoft.com.cn>
> > > Reviewed-by: Feng Bob C <bob.c.feng at intel.com>
> >
> > 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 *)"<unknown>";
> > >            }
> > > -
> > > -          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
> > >
> > >
> > >
> > >
> > >
> > >
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#76100): https://edk2.groups.io/g/devel/message/76100
Mute This Topic: https://groups.io/mt/83323100/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list