summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C
diff options
context:
space:
mode:
authorLiming Gao <gaoliming@byosoft.com.cn>2021-06-02 16:11:41 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-06-04 09:20:06 +0000
commitc6b872c6ab26407a8abc8dd294375f7fdf731f60 (patch)
treed4a8172a26104ca31d73ed39cfd657b1449b8039 /BaseTools/Source/C
parentc1aa3bab1259a54cd392831bc1dc1fd263436349 (diff)
downloadedk2-c6b872c6ab26407a8abc8dd294375f7fdf731f60.zip
edk2-c6b872c6ab26407a8abc8dd294375f7fdf731f60.tar.gz
edk2-c6b872c6ab26407a8abc8dd294375f7fdf731f60.tar.bz2
BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image
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@byosoft.com.cn> Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/C')
-rw-r--r--BaseTools/Source/C/GenFw/Elf32Convert.c12
-rw-r--r--BaseTools/Source/C/GenFw/Elf64Convert.c5
2 files changed, 6 insertions, 11 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 2485b2c..7c8a065 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 d097db8..8fe672e 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);