* [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF
@ 2021-06-09 10:06 gaoliming
2021-06-15 6:48 ` Bob Feng
[not found] ` <1688AEB31359F37C.24110@groups.io>
0 siblings, 2 replies; 3+ messages in thread
From: gaoliming @ 2021-06-09 10:06 UTC (permalink / raw)
To: devel; +Cc: Bob Feng, Ray Ni
This is the fix of the regression issue at c6b872c6.
Based on ELF spec, readonly alloc section is .rodata section. It is requried.
This fix is to add back original check logic for ELF section. Now,
the readonly alloc section and execute alloc section are regarded as .text section.
Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
---
With this fix, previous fix commit ec1cffd9 is not required. But, the checker added
by commit ec1cffd9 is correct for ACPI data conversion. So, I don't plan to revert it.
BaseTools/Source/C/GenFw/Elf32Convert.c | 3 ++-
BaseTools/Source/C/GenFw/Elf64Convert.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 314f8233234d..d917a444c82d 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -238,7 +238,8 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
+ return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)) ||
+ ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC));
}
STATIC
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 8b09db7b690b..33031ec8f6e7 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -246,7 +246,8 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
+ return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)) ||
+ ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC));
}
STATIC
--
2.27.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF
2021-06-09 10:06 [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF gaoliming
@ 2021-06-15 6:48 ` Bob Feng
[not found] ` <1688AEB31359F37C.24110@groups.io>
1 sibling, 0 replies; 3+ messages in thread
From: Bob Feng @ 2021-06-15 6:48 UTC (permalink / raw)
To: Liming Gao, devel@edk2.groups.io; +Cc: Ni, Ray
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Liming Gao <gaoliming@byosoft.com.cn>
Sent: Wednesday, June 9, 2021 6:06 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF
This is the fix of the regression issue at c6b872c6.
Based on ELF spec, readonly alloc section is .rodata section. It is requried.
This fix is to add back original check logic for ELF section. Now, the readonly alloc section and execute alloc section are regarded as .text section.
Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
---
With this fix, previous fix commit ec1cffd9 is not required. But, the checker added by commit ec1cffd9 is correct for ACPI data conversion. So, I don't plan to revert it.
BaseTools/Source/C/GenFw/Elf32Convert.c | 3 ++- BaseTools/Source/C/GenFw/Elf64Convert.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 314f8233234d..d917a444c82d 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -238,7 +238,8 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
+ return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)) ||
+ ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
+ SHF_ALLOC));
}
STATIC
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 8b09db7b690b..33031ec8f6e7 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -246,7 +246,8 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
+ return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)) ||
+ ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
+ SHF_ALLOC));
}
STATIC
--
2.27.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF
[not found] ` <1688AEB31359F37C.24110@groups.io>
@ 2021-06-16 6:36 ` Bob Feng
0 siblings, 0 replies; 3+ messages in thread
From: Bob Feng @ 2021-06-16 6:36 UTC (permalink / raw)
To: devel@edk2.groups.io, Feng, Bob C, Liming Gao; +Cc: Ni, Ray
Hi Liming,
There are some warning reported from PatchCheck.py, would you update the commit message?
Thanks,
Bob
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng
Sent: Tuesday, June 15, 2021 2:49 PM
To: Liming Gao <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Liming Gao <gaoliming@byosoft.com.cn>
Sent: Wednesday, June 9, 2021 6:06 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF
This is the fix of the regression issue at c6b872c6.
Based on ELF spec, readonly alloc section is .rodata section. It is requried.
This fix is to add back original check logic for ELF section. Now, the readonly alloc section and execute alloc section are regarded as .text section.
Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
---
With this fix, previous fix commit ec1cffd9 is not required. But, the checker added by commit ec1cffd9 is correct for ACPI data conversion. So, I don't plan to revert it.
BaseTools/Source/C/GenFw/Elf32Convert.c | 3 ++- BaseTools/Source/C/GenFw/Elf64Convert.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 314f8233234d..d917a444c82d 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -238,7 +238,8 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
+ return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)) ||
+ ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
+ SHF_ALLOC));
}
STATIC
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 8b09db7b690b..33031ec8f6e7 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -246,7 +246,8 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
+ return (BOOLEAN) (((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC)) ||
+ ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
+ SHF_ALLOC));
}
STATIC
--
2.27.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-16 6:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-09 10:06 [PATCH 1/1] BaseTools GenFw: Keep read only alloc section as text section when convert ELF gaoliming
2021-06-15 6:48 ` Bob Feng
[not found] ` <1688AEB31359F37C.24110@groups.io>
2021-06-16 6:36 ` [edk2-devel] " Bob Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox