* [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
@ 2023-03-17 14:06 Patrick Rudolph
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
` (2 more replies)
0 siblings, 3 replies; 24+ messages in thread
From: Patrick Rudolph @ 2023-03-17 14:06 UTC (permalink / raw)
Cc: devel, guo.dong, gua.guo, james.lu, ray.ni, mhaeuser, ardb
The clang toolchain might default to fPIE/fPIC, which prevents
lld from linking the objects into a binary.
Specify -fno-pie -fno-pic as done on GCC to fix linking.
Test:
Building the Universal Payload using the command
'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
works.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
---
BaseTools/Conf/tools_def.template | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 471eb67c0c..9b59bd75c3 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
*_CLANGDWARF_IA32_RC_PATH = DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
*_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
-*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
+*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld -no-pie
*_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
*_CLANGDWARF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_CLANGDWARF_IA32_OBJCOPY_FLAGS =
@@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
*_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
*_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
-DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
+DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
DEBUG_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
-DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
+DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
-RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
+RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
RELEASE_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
-RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
+RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
-NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
+NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
NOOPT_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
-NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
+NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
##########################
# CLANGDWARF X64 definitions
--
2.39.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-17 14:06 [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
@ 2023-03-17 14:06 ` Patrick Rudolph
2023-03-26 19:39 ` [edk2-devel] " Sheng Lean Tan
` (3 more replies)
2023-03-17 17:30 ` [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Rebecca Cran
2023-03-28 5:42 ` 回复: " gaoliming
2 siblings, 4 replies; 24+ messages in thread
From: Patrick Rudolph @ 2023-03-17 14:06 UTC (permalink / raw)
Cc: devel, guo.dong, gua.guo, james.lu, ray.ni, mhaeuser, ardb
Drop the "-z max-page-size=0x40" option as it causes the ELF
header to overflow into the .text section, causing undefined
behaviour.
With high optimization level it corrupts essential code and
the binary would crash. It might work with low optimization
level though. As the default is to use Oz and LTO, it always
crashes.
Test:
The ELF generated by
'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
---
BaseTools/Conf/tools_def.template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 9b59bd75c3..0c584ab390 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_BIN)
# LLVM/CLANG doesn't support -n link option. So, it can't share the same IA32_X64_DLINK_COMMON flag.
# LLVM/CLANG doesn't support common page size. So, it can't share the same GccBase.lds script.
-DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections -z max-page-size=0x40
+DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections
DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
--
2.39.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-17 14:06 [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
@ 2023-03-17 17:30 ` Rebecca Cran
2023-03-17 17:44 ` Marvin Häuser
2023-03-28 5:42 ` 回复: " gaoliming
2 siblings, 1 reply; 24+ messages in thread
From: Rebecca Cran @ 2023-03-17 17:30 UTC (permalink / raw)
To: devel, patrick.rudolph
Cc: guo.dong, gua.guo, james.lu, ray.ni, mhaeuser, ardb
I've also seen that error building X64 firmware.
Could you update those flags too, please?
--
Rebecca Cran
On 3/17/23 8:06 AM, Patrick Rudolph wrote:
> The clang toolchain might default to fPIE/fPIC, which prevents
> lld from linking the objects into a binary.
>
> Specify -fno-pie -fno-pic as done on GCC to fix linking.
>
> Test:
> Building the Universal Payload using the command
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
> works.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
> ---
> BaseTools/Conf/tools_def.template | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
> index 471eb67c0c..9b59bd75c3 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> *_CLANGDWARF_IA32_RC_PATH = DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>
> *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
> -*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
> +*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld -no-pie
> *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
> *_CLANGDWARF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
> *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
> @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
> *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
>
> -DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
> +DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
> DEBUG_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
> -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
> +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>
> -RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
> +RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
> RELEASE_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
> -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
> +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>
> -NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
> +NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
> NOOPT_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
> -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
> +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>
> ##########################
> # CLANGDWARF X64 definitions
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-17 17:30 ` [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Rebecca Cran
@ 2023-03-17 17:44 ` Marvin Häuser
2023-03-17 20:35 ` Rebecca Cran
[not found] ` <174D4F37D4EEDF26.23349@groups.io>
0 siblings, 2 replies; 24+ messages in thread
From: Marvin Häuser @ 2023-03-17 17:44 UTC (permalink / raw)
To: Rebecca Cran
Cc: devel, patrick.rudolph, guo.dong, gua.guo, james.lu, ray.ni, ardb
Which error precisely?
X64 PIE *must not* be disabled, as it’s used to enforce RIP-relative addressing where possible and has been for many years. Meanwhile the issues with IA32 is PIE was disabled by default for most toolchains, but some enable it nowadays (and thus it must be disabled explicitly).
Best regards,
Marvin
> On 17. Mar 2023, at 18:30, Rebecca Cran <rebecca@bsdio.com> wrote:
>
> I've also seen that error building X64 firmware.
>
> Could you update those flags too, please?
>
>
> --
>
> Rebecca Cran
>
>
>> On 3/17/23 8:06 AM, Patrick Rudolph wrote:
>> The clang toolchain might default to fPIE/fPIC, which prevents
>> lld from linking the objects into a binary.
>>
>> Specify -fno-pie -fno-pic as done on GCC to fix linking.
>>
>> Test:
>> Building the Universal Payload using the command
>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
>> works.
>>
>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
>> ---
>> BaseTools/Conf/tools_def.template | 14 +++++++-------
>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
>> index 471eb67c0c..9b59bd75c3 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>> *_CLANGDWARF_IA32_RC_PATH = DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>> *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
>> -*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>> +*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld -no-pie
>> *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
>> *_CLANGDWARF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
>> *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>> @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>> *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
>> *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
>> -DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>> +DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>> DEBUG_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
>> -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>> +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>> -RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
>> +RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
>> RELEASE_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
>> -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>> +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>> -NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>> +NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>> NOOPT_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
>> -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
>> +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>> ##########################
>> # CLANGDWARF X64 definitions
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-17 17:44 ` Marvin Häuser
@ 2023-03-17 20:35 ` Rebecca Cran
[not found] ` <174D4F37D4EEDF26.23349@groups.io>
1 sibling, 0 replies; 24+ messages in thread
From: Rebecca Cran @ 2023-03-17 20:35 UTC (permalink / raw)
To: Marvin Häuser
Cc: devel, patrick.rudolph, guo.dong, gua.guo, james.lu, ray.ni, ardb
Building with "build -p OvmfPkg/OvmfPkgX64.dsc -a X64 -t CLANGDWARF -b
RELEASE" on FreeBSD causes the following errors:
ld.lld: error: relocation R_X86_64_64 cannot be used against local
symbol; recompile with -fPIC
>>> defined in
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
>>> referenced by
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
>>> ExceptionHandlerAsm.obj:(.text+0x5) in archive
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
ld.lld: error: relocation R_X86_64_64 cannot be used against local
symbol; recompile with -fPIC
>>> defined in
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
>>> referenced by
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
>>> ExceptionHandlerAsm.obj:(.text+0x14) in archive
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
ld.lld: error: relocation R_X86_64_64 cannot be used against local
symbol; recompile with -fPIC
>>> defined in
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
>>> referenced by
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
>>> ExceptionHandlerAsm.obj:(.text+0x23) in archive
/home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
Thinking about it, it might actually be a problem with the FreeBSD
system toolchain. On Linux, I get a different set of errors about
redefining uint64_t etc.
--
Rebecca Cran
On 3/17/23 11:44 AM, Marvin Häuser wrote:
> Which error precisely?
>
> X64 PIE *must not* be disabled, as it’s used to enforce RIP-relative addressing where possible and has been for many years. Meanwhile the issues with IA32 is PIE was disabled by default for most toolchains, but some enable it nowadays (and thus it must be disabled explicitly).
>
> Best regards,
> Marvin
>
>> On 17. Mar 2023, at 18:30, Rebecca Cran <rebecca@bsdio.com> wrote:
>>
>> I've also seen that error building X64 firmware.
>>
>> Could you update those flags too, please?
>>
>>
>> --
>>
>> Rebecca Cran
>>
>>
>>> On 3/17/23 8:06 AM, Patrick Rudolph wrote:
>>> The clang toolchain might default to fPIE/fPIC, which prevents
>>> lld from linking the objects into a binary.
>>>
>>> Specify -fno-pie -fno-pic as done on GCC to fix linking.
>>>
>>> Test:
>>> Building the Universal Payload using the command
>>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
>>> works.
>>>
>>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
>>> ---
>>> BaseTools/Conf/tools_def.template | 14 +++++++-------
>>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
>>> index 471eb67c0c..9b59bd75c3 100755
>>> --- a/BaseTools/Conf/tools_def.template
>>> +++ b/BaseTools/Conf/tools_def.template
>>> @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>>> *_CLANGDWARF_IA32_RC_PATH = DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>>> *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
>>> -*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>>> +*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld -no-pie
>>> *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
>>> *_CLANGDWARF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
>>> *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>>> @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>>> *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
>>> *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
>>> -DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> +DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> DEBUG_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
>>> -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>>> +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>>> -RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
>>> +RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -malign-double
>>> RELEASE_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
>>> -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>>> +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>>> -NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> +NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> NOOPT_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
>>> -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
>>> +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>>> ##########################
>>> # CLANGDWARF X64 definitions
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
[not found] ` <174D4F37D4EEDF26.23349@groups.io>
@ 2023-03-23 14:43 ` Rebecca Cran
2023-03-23 14:51 ` Sheng Lean Tan
0 siblings, 1 reply; 24+ messages in thread
From: Rebecca Cran @ 2023-03-23 14:43 UTC (permalink / raw)
To: Marvin Häuser
Cc: devel, patrick.rudolph, guo.dong, gua.guo, james.lu, ray.ni, ardb
The linker problems I was seeing were unrelated to those Patrick's patch
fixed.
I just applied Patrick's changes on top of my CLANGDWARF patches and
OvmfPkgIa32.dsc builds fine.
--
Rebecca Cran
On 3/17/23 2:35 PM, Rebecca Cran wrote:
> Building with "build -p OvmfPkg/OvmfPkgX64.dsc -a X64 -t CLANGDWARF -b
> RELEASE" on FreeBSD causes the following errors:
>
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local
> symbol; recompile with -fPIC
> >>> defined in
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>> ExceptionHandlerAsm.obj:(.text+0x5) in archive
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local
> symbol; recompile with -fPIC
> >>> defined in
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>> ExceptionHandlerAsm.obj:(.text+0x14) in archive
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
> ld.lld: error: relocation R_X86_64_64 cannot be used against local
> symbol; recompile with -fPIC
> >>> defined in
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj)
> >>> referenced by
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/X64/ExceptionHandlerAsm.iii
> >>> ExceptionHandlerAsm.obj:(.text+0x23) in archive
> /home/bcran/src/uefi/edk2/Build/OvmfX64/RELEASE_CLANGDWARF/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib
>
>
> Thinking about it, it might actually be a problem with the FreeBSD
> system toolchain. On Linux, I get a different set of errors about
> redefining uint64_t etc.
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-23 14:43 ` Rebecca Cran
@ 2023-03-23 14:51 ` Sheng Lean Tan
2023-03-26 19:35 ` Sheng Lean Tan
0 siblings, 1 reply; 24+ messages in thread
From: Sheng Lean Tan @ 2023-03-23 14:51 UTC (permalink / raw)
To: devel, rebecca, Feng, Bob C, Gao, Liming, yuwei.chen
Cc: Marvin Häuser, patrick.rudolph, guo.dong, gua.guo, james.lu,
ray.ni, ardb
[-- Attachment #1: Type: text/plain, Size: 148 bytes --]
Added the right reviewers @Gao, Liming <gaoliming@byosoft.com.cn> @Feng,
Bob C <bob.c.feng@intel.com> @yuwei.chen@intel.com <yuwei.chen@intel.com>
[-- Attachment #2: Type: text/html, Size: 421 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-23 14:51 ` Sheng Lean Tan
@ 2023-03-26 19:35 ` Sheng Lean Tan
0 siblings, 0 replies; 24+ messages in thread
From: Sheng Lean Tan @ 2023-03-26 19:35 UTC (permalink / raw)
To: devel, rebecca, Feng, Bob C, Gao, Liming, yuwei.chen
Cc: Marvin Häuser, patrick.rudolph, ardb
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
Would anyone mind to spare some time to review this patch?
Thanks.
[-- Attachment #2: Type: text/html, Size: 168 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
@ 2023-03-26 19:39 ` Sheng Lean Tan
[not found] ` <17500F66A352AD33.14179@groups.io>
` (2 subsequent siblings)
3 siblings, 0 replies; 24+ messages in thread
From: Sheng Lean Tan @ 2023-03-26 19:39 UTC (permalink / raw)
To: devel, patrick.rudolph, Feng, Bob C, Gao, Liming
Cc: mhaeuser, ardb, yuwei.chen
[-- Attachment #1: Type: text/plain, Size: 2381 bytes --]
Can someone also help to review this please?
Thanks.
On Fri, 17 Mar 2023 at 15:06, Patrick Rudolph <patrick.rudolph@9elements.com>
wrote:
> Drop the "-z max-page-size=0x40" option as it causes the ELF
> header to overflow into the .text section, causing undefined
> behaviour.
>
> With high optimization level it corrupts essential code and
> the binary would crash. It might work with low optimization
> level though. As the default is to use Oz and LTO, it always
> crashes.
>
> Test:
> The ELF generated by
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> ---
> BaseTools/Conf/tools_def.template | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9b59bd75c3..0c584ab390 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_BIN)
>
> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
> IA32_X64_DLINK_COMMON flag.
> # LLVM/CLANG doesn't support common page size. So, it can't share the
> same GccBase.lds script.
> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> -Wl,-q,--gc-sections -z max-page-size=0x40
> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections
> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0
> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u
> ReferenceAcpiTable
> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u
> $(IMAGE_ENTRY_POINT)
> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
> --
> 2.39.1
>
>
>
> ------------
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#101341): https://edk2.groups.io/g/devel/message/101341
> Mute This Topic: https://groups.io/mt/97673649/6757431
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [sheng.tan@9elements.com
> ]
> ------------
>
>
>
[-- Attachment #2: Type: text/html, Size: 3697 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
[not found] ` <17500F66A352AD33.14179@groups.io>
@ 2023-03-26 19:42 ` Sheng Lean Tan
0 siblings, 0 replies; 24+ messages in thread
From: Sheng Lean Tan @ 2023-03-26 19:42 UTC (permalink / raw)
To: devel, sheng.tan, rebecca
Cc: patrick.rudolph, Feng, Bob C, Gao, Liming, mhaeuser, ardb,
yuwei.chen
[-- Attachment #1: Type: text/plain, Size: 2623 bytes --]
Added @rebecca@bsdio.com <rebecca@bsdio.com> as well.
On Sun, 26 Mar 2023 at 21:39, Sheng Lean Tan via groups.io <sheng.tan=
9elements.com@groups.io> wrote:
> Can someone also help to review this please?
> Thanks.
>
>
> On Fri, 17 Mar 2023 at 15:06, Patrick Rudolph <
> patrick.rudolph@9elements.com> wrote:
>
>> Drop the "-z max-page-size=0x40" option as it causes the ELF
>> header to overflow into the .text section, causing undefined
>> behaviour.
>>
>> With high optimization level it corrupts essential code and
>> the binary would crash. It might work with low optimization
>> level though. As the default is to use Oz and LTO, it always
>> crashes.
>>
>> Test:
>> The ELF generated by
>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>>
>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
>> ---
>> BaseTools/Conf/tools_def.template | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template
>> b/BaseTools/Conf/tools_def.template
>> index 9b59bd75c3..0c584ab390 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_BIN)
>>
>> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
>> IA32_X64_DLINK_COMMON flag.
>> # LLVM/CLANG doesn't support common page size. So, it can't share the
>> same GccBase.lds script.
>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
>> -Wl,-q,--gc-sections -z max-page-size=0x40
>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
>> -Wl,-q,--gc-sections
>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0
>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u
>> ReferenceAcpiTable
>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u
>> $(IMAGE_ENTRY_POINT)
>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>> --
>> 2.39.1
>>
>>
>>
>> ------------
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#101341):
>> https://edk2.groups.io/g/devel/message/101341
>> Mute This Topic: https://groups.io/mt/97673649/6757431
>> Group Owner: devel+owner@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub [
>> sheng.tan@9elements.com]
>> ------------
>>
>>
>>
>
>
[-- Attachment #2: Type: text/html, Size: 4404 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* 回复: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
2023-03-26 19:39 ` [edk2-devel] " Sheng Lean Tan
[not found] ` <17500F66A352AD33.14179@groups.io>
@ 2023-03-28 5:38 ` gaoliming
2023-03-28 11:25 ` Marvin Häuser
2023-03-31 14:41 ` Ni, Ray
3 siblings, 1 reply; 24+ messages in thread
From: gaoliming @ 2023-03-28 5:38 UTC (permalink / raw)
To: devel, patrick.rudolph
Cc: guo.dong, gua.guo, james.lu, ray.ni, mhaeuser, ardb
Patrick:
I prefer to override this option in DSC instead of the change in
tools_def.txt. Normal EFI image needs to set its page size for the smaller
image size.
You can see GCC DLINK option. It also sets page-size as 0x40.
DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z
common-page-size=0x40
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
> Rudolph
> 发送时间: 2023年3月17日 22:06
> 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
> ardb@kernel.org
> 主题: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> CLANGDWARF_IA32_X64
>
> Drop the "-z max-page-size=0x40" option as it causes the ELF
> header to overflow into the .text section, causing undefined
> behaviour.
>
> With high optimization level it corrupts essential code and
> the binary would crash. It might work with low optimization
> level though. As the default is to use Oz and LTO, it always
> crashes.
>
> Test:
> The ELF generated by
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> ---
> BaseTools/Conf/tools_def.template | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9b59bd75c3..0c584ab390 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =
> ENV(CLANG_BIN)
>
>
> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
> IA32_X64_DLINK_COMMON flag.
>
> # LLVM/CLANG doesn't support common page size. So, it can't share the
> same GccBase.lds script.
>
> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> -Wl,-q,--gc-sections -z max-page-size=0x40
>
> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> -Wl,-q,--gc-sections
>
> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>
> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> -Wl,--defsym=PECOFF_HEADER_SIZE=0
> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
>
> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>
> --
> 2.39.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#101341):
> https://edk2.groups.io/g/devel/message/101341
> Mute This Topic: https://groups.io/mt/97673649/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* 回复: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-17 14:06 [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
2023-03-17 17:30 ` [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Rebecca Cran
@ 2023-03-28 5:42 ` gaoliming
2023-03-30 7:30 ` Sheng Lean Tan
2 siblings, 1 reply; 24+ messages in thread
From: gaoliming @ 2023-03-28 5:42 UTC (permalink / raw)
To: devel, patrick.rudolph
Cc: guo.dong, gua.guo, james.lu, ray.ni, mhaeuser, ardb
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
> Rudolph
> 发送时间: 2023年3月17日 22:06
> 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
> ardb@kernel.org
> 主题: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using
> CLANGDWARF_IA32
>
> The clang toolchain might default to fPIE/fPIC, which prevents
> lld from linking the objects into a binary.
>
> Specify -fno-pie -fno-pic as done on GCC to fix linking.
>
> Test:
> Building the Universal Payload using the command
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
> works.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
> ---
> BaseTools/Conf/tools_def.template | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 471eb67c0c..9b59bd75c3 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
> = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> *_CLANGDWARF_IA32_RC_PATH =
> DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>
>
>
> *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
> -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
>
> -*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>
> +*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
> -no-pie
>
> *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS)
> -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
>
> *_CLANGDWARF_IA32_RC_FLAGS =
> DEF(GCC_IA32_RC_FLAGS)
>
> *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>
> @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
> = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
> DEF(CLANG38_IA32_TARGET)
>
> *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
> DEF(CLANG38_IA32_TARGET)
>
>
>
> -DEBUG_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
> DEF(CLANG38_IA32_TARGET) -g -malign-double
>
> +DEBUG_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
> DEF(CLANG38_IA32_TARGET) -g -malign-double
>
> DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
> -Wl,--oformat,elf32-i386
>
> -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
> DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>
> +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
> DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>
>
>
> -RELEASE_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
> DEF(CLANG38_IA32_TARGET) -malign-double
>
> +RELEASE_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
> DEF(CLANG38_IA32_TARGET) -malign-double
>
> RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
> -Wl,--oformat,elf32-i386
>
> -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
> DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>
> +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
> DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>
>
>
> -NOOPT_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586
> DEF(CLANG38_IA32_TARGET) -g -malign-double
>
> +NOOPT_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586
> DEF(CLANG38_IA32_TARGET) -g -malign-double
>
> NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386
> -Wl,--oformat,elf32-i386
>
> -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
> DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
>
> +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
> DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>
>
>
> ##########################
>
> # CLANGDWARF X64 definitions
>
> --
> 2.39.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#101340):
> https://edk2.groups.io/g/devel/message/101340
> Mute This Topic: https://groups.io/mt/97673648/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-28 5:38 ` 回复: " gaoliming
@ 2023-03-28 11:25 ` Marvin Häuser
2023-03-31 4:53 ` 回复: " gaoliming
0 siblings, 1 reply; 24+ messages in thread
From: Marvin Häuser @ 2023-03-28 11:25 UTC (permalink / raw)
To: gaoliming
Cc: devel, patrick.rudolph, guo.dong, gua.guo, james.lu, ray.ni, ardb
Hi all,
> On 28. Mar 2023, at 07:38, gaoliming <gaoliming@byosoft.com.cn> wrote:
> Patrick:
> I prefer to override this option in DSC instead of the change in
> tools_def.txt.
A DSC override to fix *binary corruption* of an unknown cause? It is ridiculous this can even happen silently, even though it’s unclear which component is at fault.
> Normal EFI image needs to set its page size for the smaller
> image size.
>
> You can see GCC DLINK option. It also sets page-size as 0x40.
>
> DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z
> common-page-size=0x40
Side note, the correct way to do this is setting max-page-size, not common-page-size.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
>> Rudolph
>> 发送时间: 2023年3月17日 22:06
>> 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
>> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
>> ardb@kernel.org
>> 主题: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
>> CLANGDWARF_IA32_X64
>>
>> Drop the "-z max-page-size=0x40" option as it causes the ELF
>> header to overflow into the .text section, causing undefined
>> behaviour.
That *definitely* is not a fix. Not only does this regress binary size for platforms that have tight SPI space constraints, it also only masks the issue. In the (frankly near-impossible) case the ELF header dramatically grows in size, who knows whether it can overflow again?
Sorry, but the overall description is pretty vague. Which OS / compiler version are you using? Do you have any trivial way to detect the corruption? I never really touched UefiPayloadPkg and have nothing set up to boot it to reproduce the issue.
Best regards,
Marvin
>>
>> With high optimization level it corrupts essential code and
>> the binary would crash. It might work with low optimization
>> level though. As the default is to use Oz and LTO, it always
>> crashes.
>>
>> Test:
>> The ELF generated by
>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>>
>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
>> ---
>> BaseTools/Conf/tools_def.template | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template
>> b/BaseTools/Conf/tools_def.template
>> index 9b59bd75c3..0c584ab390 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =
>> ENV(CLANG_BIN)
>>
>>
>> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
>> IA32_X64_DLINK_COMMON flag.
>>
>> # LLVM/CLANG doesn't support common page size. So, it can't share the
>> same GccBase.lds script.
>>
>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
>> -Wl,-q,--gc-sections -z max-page-size=0x40
>>
>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
>> -Wl,-q,--gc-sections
>>
>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>>
>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
>> -Wl,--defsym=PECOFF_HEADER_SIZE=0
>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
>> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
>>
>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
>> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>>
>> --
>> 2.39.1
>>
>>
>>
>> -=-=-=-=-=-=
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#101341):
>> https://edk2.groups.io/g/devel/message/101341
>> Mute This Topic: https://groups.io/mt/97673649/4905953
>> Group Owner: devel+owner@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub
>> [gaoliming@byosoft.com.cn]
>> -=-=-=-=-=-=
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-28 5:42 ` 回复: " gaoliming
@ 2023-03-30 7:30 ` Sheng Lean Tan
2023-03-30 8:04 ` Marvin Häuser
0 siblings, 1 reply; 24+ messages in thread
From: Sheng Lean Tan @ 2023-03-30 7:30 UTC (permalink / raw)
To: devel, gaoliming, rebecca, Feng, Bob C, yuwei.chen
Cc: patrick.rudolph, gua.guo, james.lu, mhaeuser, ardb
[-- Attachment #1: Type: text/plain, Size: 5368 bytes --]
HI Liming,
If no further concern, would you mind to help get this patch merged?
Thanks!
Best Regards,
*Lean Sheng Tan*
On Tue, 28 Mar 2023 at 07:42, gaoliming via groups.io <gaoliming=
byosoft.com.cn@groups.io> wrote:
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
> > Rudolph
> > 发送时间: 2023年3月17日 22:06
> > 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
> > james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
> > ardb@kernel.org
> > 主题: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using
> > CLANGDWARF_IA32
> >
> > The clang toolchain might default to fPIE/fPIC, which prevents
> > lld from linking the objects into a binary.
> >
> > Specify -fno-pie -fno-pic as done on GCC to fix linking.
> >
> > Test:
> > Building the Universal Payload using the command
> > 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
> > works.
> >
> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
> > ---
> > BaseTools/Conf/tools_def.template | 14 +++++++-------
> > 1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/BaseTools/Conf/tools_def.template
> > b/BaseTools/Conf/tools_def.template
> > index 471eb67c0c..9b59bd75c3 100755
> > --- a/BaseTools/Conf/tools_def.template
> > +++ b/BaseTools/Conf/tools_def.template
> > @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> > *_CLANGDWARF_IA32_RC_PATH =
> > DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
> >
> >
> >
> > *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
> > -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
> >
> > -*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
> >
> > +*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
> > -no-pie
> >
> > *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS)
> > -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
> >
> > *_CLANGDWARF_IA32_RC_FLAGS =
> > DEF(GCC_IA32_RC_FLAGS)
> >
> > *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
> >
> > @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
> > *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
> > DEF(CLANG38_IA32_TARGET)
> >
> > *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
> > DEF(CLANG38_IA32_TARGET)
> >
> >
> >
> > -DEBUG_CLANGDWARF_IA32_CC_FLAGS =
> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
> > DEF(CLANG38_IA32_TARGET) -g -malign-double
> >
> > +DEBUG_CLANGDWARF_IA32_CC_FLAGS =
> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
> > DEF(CLANG38_IA32_TARGET) -g -malign-double
> >
> > DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =
> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
> > -Wl,--oformat,elf32-i386
> >
> > -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
> >
> > +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
> >
> >
> >
> > -RELEASE_CLANGDWARF_IA32_CC_FLAGS =
> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
> > DEF(CLANG38_IA32_TARGET) -malign-double
> >
> > +RELEASE_CLANGDWARF_IA32_CC_FLAGS =
> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
> > DEF(CLANG38_IA32_TARGET) -malign-double
> >
> > RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =
> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
> > -Wl,--oformat,elf32-i386
> >
> > -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
> >
> > +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
> >
> >
> >
> > -NOOPT_CLANGDWARF_IA32_CC_FLAGS =
> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586
> > DEF(CLANG38_IA32_TARGET) -g -malign-double
> >
> > +NOOPT_CLANGDWARF_IA32_CC_FLAGS =
> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586
> > DEF(CLANG38_IA32_TARGET) -g -malign-double
> >
> > NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =
> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386
> > -Wl,--oformat,elf32-i386
> >
> > -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
> >
> > +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
> >
> >
> >
> > ##########################
> >
> > # CLANGDWARF X64 definitions
> >
> > --
> > 2.39.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#101340):
> > https://edk2.groups.io/g/devel/message/101340
> > Mute This Topic: https://groups.io/mt/97673648/4905953
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [gaoliming@byosoft.com.cn]
> > -=-=-=-=-=-=
> >
>
>
>
>
>
>
>
>
>
[-- Attachment #2: Type: text/html, Size: 8198 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-30 7:30 ` Sheng Lean Tan
@ 2023-03-30 8:04 ` Marvin Häuser
2023-03-30 9:47 ` Patrick Rudolph
2023-04-04 12:46 ` Sheng Lean Tan
0 siblings, 2 replies; 24+ messages in thread
From: Marvin Häuser @ 2023-03-30 8:04 UTC (permalink / raw)
To: Lean Sheng Tan
Cc: devel, gaoliming, rebecca, Feng, Bob C, yuwei.chen,
patrick.rudolph, gua.guo, james.lu, ardb
[-- Attachment #1: Type: text/html, Size: 9372 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-30 8:04 ` Marvin Häuser
@ 2023-03-30 9:47 ` Patrick Rudolph
2023-04-04 12:46 ` Sheng Lean Tan
1 sibling, 0 replies; 24+ messages in thread
From: Patrick Rudolph @ 2023-03-30 9:47 UTC (permalink / raw)
To: Marvin Häuser
Cc: Lean Sheng Tan, devel, gaoliming, rebecca, Feng, Bob C,
yuwei.chen, gua.guo, james.lu, ardb
Hi Marvin,
will send out a new patch series.
Regards,
Patrick Rudolph
On Thu, Mar 30, 2023 at 10:05 AM Marvin Häuser <mhaeuser@posteo.de> wrote:
>
> Hi Lean,
>
> I don’t think individual patches from a series are merged generally. Your 2/3 has open concerns from both Liming and myself.
>
> Best regards,
> Marvin
>
> On 30. Mar 2023, at 09:31, Lean Sheng Tan <sheng.tan@9elements.com> wrote:
>
>
> HI Liming,
> If no further concern, would you mind to help get this patch merged?
> Thanks!
>
> Best Regards,
> Lean Sheng Tan
>
>
> On Tue, 28 Mar 2023 at 07:42, gaoliming via groups.io <gaoliming=byosoft.com.cn@groups.io> wrote:
>>
>> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>>
>> > -----邮件原件-----
>> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
>> > Rudolph
>> > 发送时间: 2023年3月17日 22:06
>> > 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
>> > james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
>> > ardb@kernel.org
>> > 主题: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using
>> > CLANGDWARF_IA32
>> >
>> > The clang toolchain might default to fPIE/fPIC, which prevents
>> > lld from linking the objects into a binary.
>> >
>> > Specify -fno-pie -fno-pic as done on GCC to fix linking.
>> >
>> > Test:
>> > Building the Universal Payload using the command
>> > 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
>> > works.
>> >
>> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
>> > ---
>> > BaseTools/Conf/tools_def.template | 14 +++++++-------
>> > 1 file changed, 7 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/BaseTools/Conf/tools_def.template
>> > b/BaseTools/Conf/tools_def.template
>> > index 471eb67c0c..9b59bd75c3 100755
>> > --- a/BaseTools/Conf/tools_def.template
>> > +++ b/BaseTools/Conf/tools_def.template
>> > @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
>> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>> > *_CLANGDWARF_IA32_RC_PATH =
>> > DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>> >
>> >
>> >
>> > *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
>> > -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
>> >
>> > -*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>> >
>> > +*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>> > -no-pie
>> >
>> > *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS)
>> > -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
>> >
>> > *_CLANGDWARF_IA32_RC_FLAGS =
>> > DEF(GCC_IA32_RC_FLAGS)
>> >
>> > *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>> >
>> > @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
>> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>> > *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
>> > DEF(CLANG38_IA32_TARGET)
>> >
>> > *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
>> > DEF(CLANG38_IA32_TARGET)
>> >
>> >
>> >
>> > -DEBUG_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > +DEBUG_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
>> > -Wl,--oformat,elf32-i386
>> >
>> > -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>> >
>> > +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>> >
>> >
>> >
>> > -RELEASE_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -malign-double
>> >
>> > +RELEASE_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -malign-double
>> >
>> > RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
>> > -Wl,--oformat,elf32-i386
>> >
>> > -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>> >
>> > +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>> >
>> >
>> >
>> > -NOOPT_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > +NOOPT_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386
>> > -Wl,--oformat,elf32-i386
>> >
>> > -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
>> >
>> > +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>> >
>> >
>> >
>> > ##########################
>> >
>> > # CLANGDWARF X64 definitions
>> >
>> > --
>> > 2.39.1
>> >
>> >
>> >
>> > -=-=-=-=-=-=
>> > Groups.io Links: You receive all messages sent to this group.
>> > View/Reply Online (#101340):
>> > https://edk2.groups.io/g/devel/message/101340
>> > Mute This Topic: https://groups.io/mt/97673648/4905953
>> > Group Owner: devel+owner@edk2.groups.io
>> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
>> > [gaoliming@byosoft.com.cn]
>> > -=-=-=-=-=-=
>> >
>>
>>
>>
>>
>>
>>
>>
>>
^ permalink raw reply [flat|nested] 24+ messages in thread
* 回复: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-28 11:25 ` Marvin Häuser
@ 2023-03-31 4:53 ` gaoliming
2023-03-31 10:57 ` Marvin Häuser
0 siblings, 1 reply; 24+ messages in thread
From: gaoliming @ 2023-03-31 4:53 UTC (permalink / raw)
To: devel, mhaeuser
Cc: patrick.rudolph, guo.dong, gua.guo, james.lu, ray.ni, ardb
Marvin:
Platform developer can decide how to configure this option in their DSC file to resolve their problem. This is one option for the platform developer.
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Marvin
> H?user
> 发送时间: 2023年3月28日 19:26
> 收件人: gaoliming <gaoliming@byosoft.com.cn>
> 抄送: devel@edk2.groups.io; patrick.rudolph@9elements.com;
> guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com;
> ray.ni@intel.com; ardb@kernel.org
> 主题: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> CLANGDWARF_IA32_X64
>
> Hi all,
>
> > On 28. Mar 2023, at 07:38, gaoliming <gaoliming@byosoft.com.cn> wrote:
> > Patrick:
> > I prefer to override this option in DSC instead of the change in
> > tools_def.txt.
>
> A DSC override to fix *binary corruption* of an unknown cause? It is ridiculous
> this can even happen silently, even though it’s unclear which component is at
> fault.
>
> > Normal EFI image needs to set its page size for the smaller
> > image size.
> >
> > You can see GCC DLINK option. It also sets page-size as 0x40.
> >
> > DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib
> -Wl,-n,-q,--gc-sections -z
> > common-page-size=0x40
>
> Side note, the correct way to do this is setting max-page-size, not
> common-page-size.
>
> >
> > Thanks
> > Liming
> >> -----邮件原件-----
> >> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
> >> Rudolph
> >> 发送时间: 2023年3月17日 22:06
> >> 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
> >> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
> >> ardb@kernel.org
> >> 主题: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> >> CLANGDWARF_IA32_X64
> >>
> >> Drop the "-z max-page-size=0x40" option as it causes the ELF
> >> header to overflow into the .text section, causing undefined
> >> behaviour.
>
> That *definitely* is not a fix. Not only does this regress binary size for
> platforms that have tight SPI space constraints, it also only masks the issue. In
> the (frankly near-impossible) case the ELF header dramatically grows in size,
> who knows whether it can overflow again?
>
> Sorry, but the overall description is pretty vague. Which OS / compiler version
> are you using? Do you have any trivial way to detect the corruption? I never
> really touched UefiPayloadPkg and have nothing set up to boot it to reproduce
> the issue.
>
> Best regards,
> Marvin
>
> >>
> >> With high optimization level it corrupts essential code and
> >> the binary would crash. It might work with low optimization
> >> level though. As the default is to use Oz and LTO, it always
> >> crashes.
> >>
> >> Test:
> >> The ELF generated by
> >> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
> >>
> >> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> >> ---
> >> BaseTools/Conf/tools_def.template | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/BaseTools/Conf/tools_def.template
> >> b/BaseTools/Conf/tools_def.template
> >> index 9b59bd75c3..0c584ab390 100755
> >> --- a/BaseTools/Conf/tools_def.template
> >> +++ b/BaseTools/Conf/tools_def.template
> >> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =
> >> ENV(CLANG_BIN)
> >>
> >>
> >> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
> >> IA32_X64_DLINK_COMMON flag.
> >>
> >> # LLVM/CLANG doesn't support common page size. So, it can't share the
> >> same GccBase.lds script.
> >>
> >> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> >> -Wl,-q,--gc-sections -z max-page-size=0x40
> >>
> >> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> >> -Wl,-q,--gc-sections
> >>
> >> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> >> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
> >>
> >> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> >> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> >> -Wl,--defsym=PECOFF_HEADER_SIZE=0
> >> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
> >> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
> >>
> >> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
> >> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> >> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
> >> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
> >>
> >> --
> >> 2.39.1
> >>
> >>
> >>
> >> -=-=-=-=-=-=
> >> Groups.io Links: You receive all messages sent to this group.
> >> View/Reply Online (#101341):
> >> https://edk2.groups.io/g/devel/message/101341
> >> Mute This Topic: https://groups.io/mt/97673649/4905953
> >> Group Owner: devel+owner@edk2.groups.io
> >> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> >> [gaoliming@byosoft.com.cn]
> >> -=-=-=-=-=-=
>
>
>
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-31 4:53 ` 回复: " gaoliming
@ 2023-03-31 10:57 ` Marvin Häuser
2023-04-03 0:52 ` 回复: " gaoliming
0 siblings, 1 reply; 24+ messages in thread
From: Marvin Häuser @ 2023-03-31 10:57 UTC (permalink / raw)
To: gaoliming
Cc: devel, patrick.rudolph, guo.dong, gua.guo, james.lu, ray.ni, ardb
Liming,
Platform maintainers can decide whether or not they want to combat *binary corruption*? Excuse me, but what the bloody hell? This needs a root cause analysis for which part of the stack silently borks us and not an “oh, if something fails, well, copy and paste this workaround… maybe”. If you give me an efficient way to reproduce it, I’ll do it.
Best regards,
Marvin
> On 31. Mar 2023, at 06:54, gaoliming <gaoliming@byosoft.com.cn> wrote:
>
> Marvin:
> Platform developer can decide how to configure this option in their DSC file to resolve their problem. This is one option for the platform developer.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Marvin
>> H?user
>> 发送时间: 2023年3月28日 19:26
>> 收件人: gaoliming <gaoliming@byosoft.com.cn>
>> 抄送: devel@edk2.groups.io; patrick.rudolph@9elements.com;
>> guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com;
>> ray.ni@intel.com; ardb@kernel.org
>> 主题: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
>> CLANGDWARF_IA32_X64
>>
>> Hi all,
>>
>>>> On 28. Mar 2023, at 07:38, gaoliming <gaoliming@byosoft.com.cn> wrote:
>>> Patrick:
>>> I prefer to override this option in DSC instead of the change in
>>> tools_def.txt.
>>
>> A DSC override to fix *binary corruption* of an unknown cause? It is ridiculous
>> this can even happen silently, even though it’s unclear which component is at
>> fault.
>>
>>> Normal EFI image needs to set its page size for the smaller
>>> image size.
>>>
>>> You can see GCC DLINK option. It also sets page-size as 0x40.
>>>
>>> DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib
>> -Wl,-n,-q,--gc-sections -z
>>> common-page-size=0x40
>>
>> Side note, the correct way to do this is setting max-page-size, not
>> common-page-size.
>>
>>>
>>> Thanks
>>> Liming
>>>> -----邮件原件-----
>>>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
>>>> Rudolph
>>>> 发送时间: 2023年3月17日 22:06
>>>> 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
>>>> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
>>>> ardb@kernel.org
>>>> 主题: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
>>>> CLANGDWARF_IA32_X64
>>>>
>>>> Drop the "-z max-page-size=0x40" option as it causes the ELF
>>>> header to overflow into the .text section, causing undefined
>>>> behaviour.
>>
>> That *definitely* is not a fix. Not only does this regress binary size for
>> platforms that have tight SPI space constraints, it also only masks the issue. In
>> the (frankly near-impossible) case the ELF header dramatically grows in size,
>> who knows whether it can overflow again?
>>
>> Sorry, but the overall description is pretty vague. Which OS / compiler version
>> are you using? Do you have any trivial way to detect the corruption? I never
>> really touched UefiPayloadPkg and have nothing set up to boot it to reproduce
>> the issue.
>>
>> Best regards,
>> Marvin
>>
>>>>
>>>> With high optimization level it corrupts essential code and
>>>> the binary would crash. It might work with low optimization
>>>> level though. As the default is to use Oz and LTO, it always
>>>> crashes.
>>>>
>>>> Test:
>>>> The ELF generated by
>>>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>>>>
>>>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>>>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
>>>> ---
>>>> BaseTools/Conf/tools_def.template | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/BaseTools/Conf/tools_def.template
>>>> b/BaseTools/Conf/tools_def.template
>>>> index 9b59bd75c3..0c584ab390 100755
>>>> --- a/BaseTools/Conf/tools_def.template
>>>> +++ b/BaseTools/Conf/tools_def.template
>>>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =
>>>> ENV(CLANG_BIN)
>>>>
>>>>
>>>> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
>>>> IA32_X64_DLINK_COMMON flag.
>>>>
>>>> # LLVM/CLANG doesn't support common page size. So, it can't share the
>>>> same GccBase.lds script.
>>>>
>>>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
>>>> -Wl,-q,--gc-sections -z max-page-size=0x40
>>>>
>>>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
>>>> -Wl,-q,--gc-sections
>>>>
>>>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
>>>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>>>>
>>>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
>>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
>>>> -Wl,--defsym=PECOFF_HEADER_SIZE=0
>>>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
>>>> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
>>>>
>>>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
>>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
>>>> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
>>>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>>>>
>>>> --
>>>> 2.39.1
>>>>
>>>>
>>>>
>>>> -=-=-=-=-=-=
>>>> Groups.io Links: You receive all messages sent to this group.
>>>> View/Reply Online (#101341):
>>>> https://edk2.groups.io/g/devel/message/101341
>>>> Mute This Topic: https://groups.io/mt/97673649/4905953
>>>> Group Owner: devel+owner@edk2.groups.io
>>>> Unsubscribe: https://edk2.groups.io/g/devel/unsub
>>>> [gaoliming@byosoft.com.cn]
>>>> -=-=-=-=-=-=
>>
>>
>>
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
` (2 preceding siblings ...)
2023-03-28 5:38 ` 回复: " gaoliming
@ 2023-03-31 14:41 ` Ni, Ray
2023-03-31 14:58 ` Marvin Häuser
3 siblings, 1 reply; 24+ messages in thread
From: Ni, Ray @ 2023-03-31 14:41 UTC (permalink / raw)
To: Rudolph, Patrick
Cc: devel@edk2.groups.io, Dong, Guo, Guo, Gua, Lu, James,
mhaeuser@posteo.de, ardb@kernel.org
Why ELF header overflows into .text section?
> -----Original Message-----
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
> Sent: Friday, March 17, 2023 10:06 PM
> Cc: devel@edk2.groups.io; Dong, Guo <guo.dong@intel.com>; Guo, Gua
> <gua.guo@intel.com>; Lu, James <james.lu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; mhaeuser@posteo.de; ardb@kernel.org
> Subject: [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> CLANGDWARF_IA32_X64
>
> Drop the "-z max-page-size=0x40" option as it causes the ELF
> header to overflow into the .text section, causing undefined
> behaviour.
>
> With high optimization level it corrupts essential code and
> the binary would crash. It might work with low optimization
> level though. As the default is to use Oz and LTO, it always
> crashes.
>
> Test:
> The ELF generated by
> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> ---
> BaseTools/Conf/tools_def.template | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9b59bd75c3..0c584ab390 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =
> ENV(CLANG_BIN)
>
>
> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
> IA32_X64_DLINK_COMMON flag.
>
> # LLVM/CLANG doesn't support common page size. So, it can't share the
> same GccBase.lds script.
>
> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-
> sections -z max-page-size=0x40
>
> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--
> gc-sections
>
> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--
> script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>
> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--
> defsym=PECOFF_HEADER_SIZE=0
> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--
> entry,ReferenceAcpiTable -u ReferenceAcpiTable
>
> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--
> entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-
> Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>
> --
> 2.39.1
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-31 14:41 ` Ni, Ray
@ 2023-03-31 14:58 ` Marvin Häuser
0 siblings, 0 replies; 24+ messages in thread
From: Marvin Häuser @ 2023-03-31 14:58 UTC (permalink / raw)
To: Ni, Ray
Cc: Rudolph, Patrick, devel@edk2.groups.io, Dong, Guo, Guo, Gua,
Lu, James, ardb@kernel.org
[-- Attachment #1: Type: text/plain, Size: 4217 bytes --]
> On 31. Mar 2023, at 16:41, Ni, Ray <ray.ni@intel.com> wrote:
>
> Why ELF header overflows into .text section?
That's a good question, isn't it? :)
From what I can see, these binaries don't pass post-processing like GenFw or such. GCC (and I think thus CLANGDWARF?) gets an extra objcopy step as part of linking [2], but the arguments are empty [3] and thus should be no-op (I hope?).
I suppose potential candidates are:
1) A bug in the LLD linker used by CLANGDWARF for IA32 and X64. That would be very surprising to me, especially as no other platform reported issues and LLD is well-established. But who knows, generally ELFs will have large alignment values compared to the 64 Bytes used by edk2.
2) A bug in llvm-objcopy used by UniversalPayloadBuild.py [1]. I'm honestly unfamiliar with objcopy variants and their quality/reliability.
3) A bug in the llvm-objcopy or CLANGDWARF tools_def commands on the edk2 side of things.
Some may disagree, but I would reduce 3) to either 1) or 2). I think even if the commands malformed and this causes the overflow, I believe LLD or objcopy should issue a warning regardless.
As I have no way to reproduce the issue, I cannot really help further, sorry.
Best regards,
Marvin
[1]
https://github.com/tianocore/edk2/blob/b08a19eae28e76fb5a296a604c27d06fab29b08a/UefiPayloadPkg/UniversalPayloadBuild.py#L163-L183
[2]
https://github.com/tianocore/edk2/blob/b08a19eae28e76fb5a296a604c27d06fab29b08a/BaseTools/Conf/build_rule.template#L298
[3]
https://github.com/tianocore/edk2/blob/b08a19eae28e76fb5a296a604c27d06fab29b08a/BaseTools/Conf/tools_def.template#L2895
https://github.com/tianocore/edk2/blob/b08a19eae28e76fb5a296a604c27d06fab29b08a/BaseTools/Conf/tools_def.template#L2931
>
>> -----Original Message-----
>> From: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Sent: Friday, March 17, 2023 10:06 PM
>> Cc: devel@edk2.groups.io; Dong, Guo <guo.dong@intel.com>; Guo, Gua
>> <gua.guo@intel.com>; Lu, James <james.lu@intel.com>; Ni, Ray
>> <ray.ni@intel.com>; mhaeuser@posteo.de; ardb@kernel.org
>> Subject: [PATCH 2/3] BaseTools/Conf/tools_def: Fix
>> CLANGDWARF_IA32_X64
>>
>> Drop the "-z max-page-size=0x40" option as it causes the ELF
>> header to overflow into the .text section, causing undefined
>> behaviour.
>>
>> With high optimization level it corrupts essential code and
>> the binary would crash. It might work with low optimization
>> level though. As the default is to use Oz and LTO, it always
>> crashes.
>>
>> Test:
>> The ELF generated by
>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
>>
>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
>> ---
>> BaseTools/Conf/tools_def.template | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template
>> b/BaseTools/Conf/tools_def.template
>> index 9b59bd75c3..0c584ab390 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX =
>> ENV(CLANG_BIN)
>>
>>
>> # LLVM/CLANG doesn't support -n link option. So, it can't share the same
>> IA32_X64_DLINK_COMMON flag.
>>
>> # LLVM/CLANG doesn't support common page size. So, it can't share the
>> same GccBase.lds script.
>>
>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-
>> sections -z max-page-size=0x40
>>
>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--
>> gc-sections
>>
>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--
>> script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
>>
>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--
>> defsym=PECOFF_HEADER_SIZE=0
>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--
>> entry,ReferenceAcpiTable -u ReferenceAcpiTable
>>
>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--
>> entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-
>> Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
>>
>> --
>> 2.39.1
>
[-- Attachment #2: Type: text/html, Size: 5560 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* 回复: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-03-31 10:57 ` Marvin Häuser
@ 2023-04-03 0:52 ` gaoliming
2023-04-03 5:53 ` Patrick Rudolph
0 siblings, 1 reply; 24+ messages in thread
From: gaoliming @ 2023-04-03 0:52 UTC (permalink / raw)
To: devel, mhaeuser, patrick.rudolph
Cc: guo.dong, gua.guo, james.lu, ray.ni, ardb
Patrick:
Can you give the reproduce step to generate ELF image that doesn't work with the option max-page-size?
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Marvin
> H?user
> 发送时间: 2023年3月31日 18:58
> 收件人: gaoliming <gaoliming@byosoft.com.cn>
> 抄送: devel@edk2.groups.io; patrick.rudolph@9elements.com;
> guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com;
> ray.ni@intel.com; ardb@kernel.org
> 主题: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> CLANGDWARF_IA32_X64
>
> Liming,
>
> Platform maintainers can decide whether or not they want to combat *binary
> corruption*? Excuse me, but what the bloody hell? This needs a root cause
> analysis for which part of the stack silently borks us and not an “oh, if
> something fails, well, copy and paste this workaround… maybe”. If you give
> me an efficient way to reproduce it, I’ll do it.
>
> Best regards,
> Marvin
>
> > On 31. Mar 2023, at 06:54, gaoliming <gaoliming@byosoft.com.cn> wrote:
> >
> > Marvin:
> > Platform developer can decide how to configure this option in their DSC file
> to resolve their problem. This is one option for the platform developer.
> >
> > Thanks
> > Liming
> >> -----邮件原件-----
> >> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Marvin
> >> H?user
> >> 发送时间: 2023年3月28日 19:26
> >> 收件人: gaoliming <gaoliming@byosoft.com.cn>
> >> 抄送: devel@edk2.groups.io; patrick.rudolph@9elements.com;
> >> guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com;
> >> ray.ni@intel.com; ardb@kernel.org
> >> 主题: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> >> CLANGDWARF_IA32_X64
> >>
> >> Hi all,
> >>
> >>>> On 28. Mar 2023, at 07:38, gaoliming <gaoliming@byosoft.com.cn>
> wrote:
> >>> Patrick:
> >>> I prefer to override this option in DSC instead of the change in
> >>> tools_def.txt.
> >>
> >> A DSC override to fix *binary corruption* of an unknown cause? It is
> ridiculous
> >> this can even happen silently, even though it’s unclear which component
> is at
> >> fault.
> >>
> >>> Normal EFI image needs to set its page size for the smaller
> >>> image size.
> >>>
> >>> You can see GCC DLINK option. It also sets page-size as 0x40.
> >>>
> >>> DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib
> >> -Wl,-n,-q,--gc-sections -z
> >>> common-page-size=0x40
> >>
> >> Side note, the correct way to do this is setting max-page-size, not
> >> common-page-size.
> >>
> >>>
> >>> Thanks
> >>> Liming
> >>>> -----邮件原件-----
> >>>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
> >>>> Rudolph
> >>>> 发送时间: 2023年3月17日 22:06
> >>>> 抄送: devel@edk2.groups.io; guo.dong@intel.com;
> gua.guo@intel.com;
> >>>> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
> >>>> ardb@kernel.org
> >>>> 主题: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> >>>> CLANGDWARF_IA32_X64
> >>>>
> >>>> Drop the "-z max-page-size=0x40" option as it causes the ELF
> >>>> header to overflow into the .text section, causing undefined
> >>>> behaviour.
> >>
> >> That *definitely* is not a fix. Not only does this regress binary size for
> >> platforms that have tight SPI space constraints, it also only masks the issue.
> In
> >> the (frankly near-impossible) case the ELF header dramatically grows in
> size,
> >> who knows whether it can overflow again?
> >>
> >> Sorry, but the overall description is pretty vague. Which OS / compiler
> version
> >> are you using? Do you have any trivial way to detect the corruption? I
> never
> >> really touched UefiPayloadPkg and have nothing set up to boot it to
> reproduce
> >> the issue.
> >>
> >> Best regards,
> >> Marvin
> >>
> >>>>
> >>>> With high optimization level it corrupts essential code and
> >>>> the binary would crash. It might work with low optimization
> >>>> level though. As the default is to use Oz and LTO, it always
> >>>> crashes.
> >>>>
> >>>> Test:
> >>>> The ELF generated by
> >>>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
> >>>>
> >>>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> >>>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> >>>> ---
> >>>> BaseTools/Conf/tools_def.template | 2 +-
> >>>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/BaseTools/Conf/tools_def.template
> >>>> b/BaseTools/Conf/tools_def.template
> >>>> index 9b59bd75c3..0c584ab390 100755
> >>>> --- a/BaseTools/Conf/tools_def.template
> >>>> +++ b/BaseTools/Conf/tools_def.template
> >>>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX
> =
> >>>> ENV(CLANG_BIN)
> >>>>
> >>>>
> >>>> # LLVM/CLANG doesn't support -n link option. So, it can't share the
> same
> >>>> IA32_X64_DLINK_COMMON flag.
> >>>>
> >>>> # LLVM/CLANG doesn't support common page size. So, it can't share the
> >>>> same GccBase.lds script.
> >>>>
> >>>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> >>>> -Wl,-q,--gc-sections -z max-page-size=0x40
> >>>>
> >>>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> >>>> -Wl,-q,--gc-sections
> >>>>
> >>>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> >>>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
> >>>>
> >>>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> >>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> >>>> -Wl,--defsym=PECOFF_HEADER_SIZE=0
> >>>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
> >>>> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
> >>>>
> >>>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
> >>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> >>>> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
> >>>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
> >>>>
> >>>> --
> >>>> 2.39.1
> >>>>
> >>>>
> >>>>
> >>>> -=-=-=-=-=-=
> >>>> Groups.io Links: You receive all messages sent to this group.
> >>>> View/Reply Online (#101341):
> >>>> https://edk2.groups.io/g/devel/message/101341
> >>>> Mute This Topic: https://groups.io/mt/97673649/4905953
> >>>> Group Owner: devel+owner@edk2.groups.io
> >>>> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> >>>> [gaoliming@byosoft.com.cn]
> >>>> -=-=-=-=-=-=
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
>
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64
2023-04-03 0:52 ` 回复: " gaoliming
@ 2023-04-03 5:53 ` Patrick Rudolph
0 siblings, 0 replies; 24+ messages in thread
From: Patrick Rudolph @ 2023-04-03 5:53 UTC (permalink / raw)
To: devel, gaoliming; +Cc: mhaeuser, guo.dong, gua.guo, james.lu, ray.ni, ardb
Hi,
I cannot reproduce the issue on my setup. Please ignore it for now.
Regards,
Patrick Rudolph
On Mon, Apr 3, 2023 at 2:52 AM gaoliming via groups.io
<gaoliming=byosoft.com.cn@groups.io> wrote:
>
> Patrick:
> Can you give the reproduce step to generate ELF image that doesn't work with the option max-page-size?
>
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Marvin
> > H?user
> > 发送时间: 2023年3月31日 18:58
> > 收件人: gaoliming <gaoliming@byosoft.com.cn>
> > 抄送: devel@edk2.groups.io; patrick.rudolph@9elements.com;
> > guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com;
> > ray.ni@intel.com; ardb@kernel.org
> > 主题: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> > CLANGDWARF_IA32_X64
> >
> > Liming,
> >
> > Platform maintainers can decide whether or not they want to combat *binary
> > corruption*? Excuse me, but what the bloody hell? This needs a root cause
> > analysis for which part of the stack silently borks us and not an “oh, if
> > something fails, well, copy and paste this workaround… maybe”. If you give
> > me an efficient way to reproduce it, I’ll do it.
> >
> > Best regards,
> > Marvin
> >
> > > On 31. Mar 2023, at 06:54, gaoliming <gaoliming@byosoft.com.cn> wrote:
> > >
> > > Marvin:
> > > Platform developer can decide how to configure this option in their DSC file
> > to resolve their problem. This is one option for the platform developer.
> > >
> > > Thanks
> > > Liming
> > >> -----邮件原件-----
> > >> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Marvin
> > >> H?user
> > >> 发送时间: 2023年3月28日 19:26
> > >> 收件人: gaoliming <gaoliming@byosoft.com.cn>
> > >> 抄送: devel@edk2.groups.io; patrick.rudolph@9elements.com;
> > >> guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com;
> > >> ray.ni@intel.com; ardb@kernel.org
> > >> 主题: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> > >> CLANGDWARF_IA32_X64
> > >>
> > >> Hi all,
> > >>
> > >>>> On 28. Mar 2023, at 07:38, gaoliming <gaoliming@byosoft.com.cn>
> > wrote:
> > >>> Patrick:
> > >>> I prefer to override this option in DSC instead of the change in
> > >>> tools_def.txt.
> > >>
> > >> A DSC override to fix *binary corruption* of an unknown cause? It is
> > ridiculous
> > >> this can even happen silently, even though it’s unclear which component
> > is at
> > >> fault.
> > >>
> > >>> Normal EFI image needs to set its page size for the smaller
> > >>> image size.
> > >>>
> > >>> You can see GCC DLINK option. It also sets page-size as 0x40.
> > >>>
> > >>> DEFINE GCC49_IA32_X64_DLINK_COMMON = -nostdlib
> > >> -Wl,-n,-q,--gc-sections -z
> > >>> common-page-size=0x40
> > >>
> > >> Side note, the correct way to do this is setting max-page-size, not
> > >> common-page-size.
> > >>
> > >>>
> > >>> Thanks
> > >>> Liming
> > >>>> -----邮件原件-----
> > >>>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
> > >>>> Rudolph
> > >>>> 发送时间: 2023年3月17日 22:06
> > >>>> 抄送: devel@edk2.groups.io; guo.dong@intel.com;
> > gua.guo@intel.com;
> > >>>> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
> > >>>> ardb@kernel.org
> > >>>> 主题: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def: Fix
> > >>>> CLANGDWARF_IA32_X64
> > >>>>
> > >>>> Drop the "-z max-page-size=0x40" option as it causes the ELF
> > >>>> header to overflow into the .text section, causing undefined
> > >>>> behaviour.
> > >>
> > >> That *definitely* is not a fix. Not only does this regress binary size for
> > >> platforms that have tight SPI space constraints, it also only masks the issue.
> > In
> > >> the (frankly near-impossible) case the ELF header dramatically grows in
> > size,
> > >> who knows whether it can overflow again?
> > >>
> > >> Sorry, but the overall description is pretty vague. Which OS / compiler
> > version
> > >> are you using? Do you have any trivial way to detect the corruption? I
> > never
> > >> really touched UefiPayloadPkg and have nothing set up to boot it to
> > reproduce
> > >> the issue.
> > >>
> > >> Best regards,
> > >> Marvin
> > >>
> > >>>>
> > >>>> With high optimization level it corrupts essential code and
> > >>>> the binary would crash. It might work with low optimization
> > >>>> level though. As the default is to use Oz and LTO, it always
> > >>>> crashes.
> > >>>>
> > >>>> Test:
> > >>>> The ELF generated by
> > >>>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots.
> > >>>>
> > >>>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> > >>>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4357
> > >>>> ---
> > >>>> BaseTools/Conf/tools_def.template | 2 +-
> > >>>> 1 file changed, 1 insertion(+), 1 deletion(-)
> > >>>>
> > >>>> diff --git a/BaseTools/Conf/tools_def.template
> > >>>> b/BaseTools/Conf/tools_def.template
> > >>>> index 9b59bd75c3..0c584ab390 100755
> > >>>> --- a/BaseTools/Conf/tools_def.template
> > >>>> +++ b/BaseTools/Conf/tools_def.template
> > >>>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX
> > =
> > >>>> ENV(CLANG_BIN)
> > >>>>
> > >>>>
> > >>>> # LLVM/CLANG doesn't support -n link option. So, it can't share the
> > same
> > >>>> IA32_X64_DLINK_COMMON flag.
> > >>>>
> > >>>> # LLVM/CLANG doesn't support common page size. So, it can't share the
> > >>>> same GccBase.lds script.
> > >>>>
> > >>>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> > >>>> -Wl,-q,--gc-sections -z max-page-size=0x40
> > >>>>
> > >>>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib
> > >>>> -Wl,-q,--gc-sections
> > >>>>
> > >>>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =
> > >>>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
> > >>>>
> > >>>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =
> > >>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> > >>>> -Wl,--defsym=PECOFF_HEADER_SIZE=0
> > >>>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
> > >>>> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
> > >>>>
> > >>>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =
> > >>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON)
> > >>>> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT)
> > >>>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
> > >>>>
> > >>>> --
> > >>>> 2.39.1
> > >>>>
> > >>>>
> > >>>>
> > >>>> -=-=-=-=-=-=
> > >>>> Groups.io Links: You receive all messages sent to this group.
> > >>>> View/Reply Online (#101341):
> > >>>> https://edk2.groups.io/g/devel/message/101341
> > >>>> Mute This Topic: https://groups.io/mt/97673649/4905953
> > >>>> Group Owner: devel+owner@edk2.groups.io
> > >>>> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > >>>> [gaoliming@byosoft.com.cn]
> > >>>> -=-=-=-=-=-=
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> >
> >
> >
> >
>
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-03-30 8:04 ` Marvin Häuser
2023-03-30 9:47 ` Patrick Rudolph
@ 2023-04-04 12:46 ` Sheng Lean Tan
2023-04-05 8:27 ` Sheng Lean Tan
1 sibling, 1 reply; 24+ messages in thread
From: Sheng Lean Tan @ 2023-04-04 12:46 UTC (permalink / raw)
To: Marvin Häuser
Cc: devel, gaoliming, rebecca, Feng, Bob C, yuwei.chen,
patrick.rudolph, james.lu, ardb
[-- Attachment #1: Type: text/plain, Size: 6249 bytes --]
Hi Rebecca/ Marvin,
Patrick has filed it as a separate patch email here
https://edk2.groups.io/g/devel/message/102168
However the email still group them together.
It is because he could not reproduce any issue anymore that was seen on 2nd
patch (could be that Rebecca already fixed it).
Could you help to review and get this merged?
Thanks,
Sheng
On Thu, 30 Mar 2023 at 10:05, Marvin Häuser <mhaeuser@posteo.de> wrote:
> Hi Lean,
>
> I don’t think individual patches from a series are merged generally. Your
> 2/3 has open concerns from both Liming and myself.
>
> Best regards,
> Marvin
>
> On 30. Mar 2023, at 09:31, Lean Sheng Tan <sheng.tan@9elements.com> wrote:
>
>
> HI Liming,
> If no further concern, would you mind to help get this patch merged?
> Thanks!
>
> Best Regards,
> *Lean Sheng Tan*
>
>
> On Tue, 28 Mar 2023 at 07:42, gaoliming via groups.io <gaoliming=
> byosoft.com.cn@groups.io> wrote:
>
>> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>>
>> > -----邮件原件-----
>> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
>> > Rudolph
>> > 发送时间: 2023年3月17日 22:06
>> > 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
>> > james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
>> > ardb@kernel.org
>> > 主题: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using
>> > CLANGDWARF_IA32
>> >
>> > The clang toolchain might default to fPIE/fPIC, which prevents
>> > lld from linking the objects into a binary.
>> >
>> > Specify -fno-pie -fno-pic as done on GCC to fix linking.
>> >
>> > Test:
>> > Building the Universal Payload using the command
>> > 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
>> > works.
>> >
>> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
>> > ---
>> > BaseTools/Conf/tools_def.template | 14 +++++++-------
>> > 1 file changed, 7 insertions(+), 7 deletions(-)
>> >
>> > diff --git a/BaseTools/Conf/tools_def.template
>> > b/BaseTools/Conf/tools_def.template
>> > index 471eb67c0c..9b59bd75c3 100755
>> > --- a/BaseTools/Conf/tools_def.template
>> > +++ b/BaseTools/Conf/tools_def.template
>> > @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
>> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>> > *_CLANGDWARF_IA32_RC_PATH =
>> > DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>> >
>> >
>> >
>> > *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
>> > -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
>> >
>> > -*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>> >
>> > +*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>> > -no-pie
>> >
>> > *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS)
>> > -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
>> >
>> > *_CLANGDWARF_IA32_RC_FLAGS =
>> > DEF(GCC_IA32_RC_FLAGS)
>> >
>> > *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>> >
>> > @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
>> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>> > *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
>> > DEF(CLANG38_IA32_TARGET)
>> >
>> > *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
>> > DEF(CLANG38_IA32_TARGET)
>> >
>> >
>> >
>> > -DEBUG_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > +DEBUG_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
>> > -Wl,--oformat,elf32-i386
>> >
>> > -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>> >
>> > +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>> >
>> >
>> >
>> > -RELEASE_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -malign-double
>> >
>> > +RELEASE_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
>> > DEF(CLANG38_IA32_TARGET) -malign-double
>> >
>> > RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
>> > -Wl,--oformat,elf32-i386
>> >
>> > -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>> >
>> > +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>> >
>> >
>> >
>> > -NOOPT_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > +NOOPT_CLANGDWARF_IA32_CC_FLAGS =
>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586
>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>> >
>> > NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =
>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386
>> > -Wl,--oformat,elf32-i386
>> >
>> > -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
>> >
>> > +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>> >
>> >
>> >
>> > ##########################
>> >
>> > # CLANGDWARF X64 definitions
>> >
>> > --
>> > 2.39.1
>> >
>> >
>> >
>> > -=-=-=-=-=-=
>> > Groups.io Links: You receive all messages sent to this group.
>> > View/Reply Online (#101340):
>> > https://edk2.groups.io/g/devel/message/101340
>> > Mute This Topic: https://groups.io/mt/97673648/4905953
>> > Group Owner: devel+owner@edk2.groups.io
>> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
>> > [gaoliming@byosoft.com.cn]
>> > -=-=-=-=-=-=
>> >
>>
>>
>>
>>
>>
>>
>>
>>
>>
[-- Attachment #2: Type: text/html, Size: 9869 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
2023-04-04 12:46 ` Sheng Lean Tan
@ 2023-04-05 8:27 ` Sheng Lean Tan
0 siblings, 0 replies; 24+ messages in thread
From: Sheng Lean Tan @ 2023-04-05 8:27 UTC (permalink / raw)
To: Marvin Häuser
Cc: devel, gaoliming, rebecca, Feng, Bob C, yuwei.chen,
patrick.rudolph, james.lu, ardb
[-- Attachment #1: Type: text/plain, Size: 6597 bytes --]
Hi,
Can anyone help to look into this?
Thanks.
On Tue, 4 Apr 2023 at 14:46, Lean Sheng Tan <sheng.tan@9elements.com> wrote:
>
> Hi Rebecca/ Marvin,
> Patrick has filed it as a separate patch email here
> https://edk2.groups.io/g/devel/message/102168
> However the email still group them together.
> It is because he could not reproduce any issue anymore that was seen on
> 2nd patch (could be that Rebecca already fixed it).
> Could you help to review and get this merged?
>
> Thanks,
> Sheng
>
>
> On Thu, 30 Mar 2023 at 10:05, Marvin Häuser <mhaeuser@posteo.de> wrote:
>
>> Hi Lean,
>>
>> I don’t think individual patches from a series are merged generally. Your
>> 2/3 has open concerns from both Liming and myself.
>>
>> Best regards,
>> Marvin
>>
>> On 30. Mar 2023, at 09:31, Lean Sheng Tan <sheng.tan@9elements.com>
>> wrote:
>>
>>
>> HI Liming,
>> If no further concern, would you mind to help get this patch merged?
>> Thanks!
>>
>> Best Regards,
>> *Lean Sheng Tan*
>>
>>
>> On Tue, 28 Mar 2023 at 07:42, gaoliming via groups.io <gaoliming=
>> byosoft.com.cn@groups.io> wrote:
>>
>>> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>>>
>>> > -----邮件原件-----
>>> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Patrick
>>> > Rudolph
>>> > 发送时间: 2023年3月17日 22:06
>>> > 抄送: devel@edk2.groups.io; guo.dong@intel.com; gua.guo@intel.com;
>>> > james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de;
>>> > ardb@kernel.org
>>> > 主题: [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking
>>> using
>>> > CLANGDWARF_IA32
>>> >
>>> > The clang toolchain might default to fPIE/fPIC, which prevents
>>> > lld from linking the objects into a binary.
>>> >
>>> > Specify -fno-pie -fno-pic as done on GCC to fix linking.
>>> >
>>> > Test:
>>> > Building the Universal Payload using the command
>>> > 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' actually
>>> > works.
>>> >
>>> > Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>>> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4356
>>> > ---
>>> > BaseTools/Conf/tools_def.template | 14 +++++++-------
>>> > 1 file changed, 7 insertions(+), 7 deletions(-)
>>> >
>>> > diff --git a/BaseTools/Conf/tools_def.template
>>> > b/BaseTools/Conf/tools_def.template
>>> > index 471eb67c0c..9b59bd75c3 100755
>>> > --- a/BaseTools/Conf/tools_def.template
>>> > +++ b/BaseTools/Conf/tools_def.template
>>> > @@ -2888,7 +2888,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
>>> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>>> > *_CLANGDWARF_IA32_RC_PATH =
>>> > DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
>>> >
>>> >
>>> >
>>> > *_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
>>> > -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
>>> >
>>> > -*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
>>> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>>> >
>>> > +*_CLANGDWARF_IA32_ASLDLINK_FLAGS =
>>> > DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
>>> > -no-pie
>>> >
>>> > *_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS)
>>> > -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
>>> >
>>> > *_CLANGDWARF_IA32_RC_FLAGS =
>>> > DEF(GCC_IA32_RC_FLAGS)
>>> >
>>> > *_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>>> >
>>> > @@ -2897,17 +2897,17 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS
>>> > = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
>>> > *_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
>>> > DEF(CLANG38_IA32_TARGET)
>>> >
>>> > *_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
>>> > DEF(CLANG38_IA32_TARGET)
>>> >
>>> >
>>> >
>>> > -DEBUG_CLANGDWARF_IA32_CC_FLAGS =
>>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
>>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> >
>>> > +DEBUG_CLANGDWARF_IA32_CC_FLAGS =
>>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
>>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> >
>>> > DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =
>>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
>>> > -Wl,--oformat,elf32-i386
>>> >
>>> > -DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>>> >
>>> > +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>>> >
>>> >
>>> >
>>> > -RELEASE_CLANGDWARF_IA32_CC_FLAGS =
>>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
>>> > DEF(CLANG38_IA32_TARGET) -malign-double
>>> >
>>> > +RELEASE_CLANGDWARF_IA32_CC_FLAGS =
>>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -Oz -flto -march=i586
>>> > DEF(CLANG38_IA32_TARGET) -malign-double
>>> >
>>> > RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =
>>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386
>>> > -Wl,--oformat,elf32-i386
>>> >
>>> > -RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
>>> >
>>> > +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld -no-pie
>>> >
>>> >
>>> >
>>> > -NOOPT_CLANGDWARF_IA32_CC_FLAGS =
>>> > DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586
>>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> >
>>> > +NOOPT_CLANGDWARF_IA32_CC_FLAGS =
>>> > DEF(CLANG38_ALL_CC_FLAGS) -fno-pic -fno-pie -m32 -O0 -march=i586
>>> > DEF(CLANG38_IA32_TARGET) -g -malign-double
>>> >
>>> > NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =
>>> > DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386
>>> > -Wl,--oformat,elf32-i386
>>> >
>>> > -NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
>>> >
>>> > +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>>> > DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld -no-pie
>>> >
>>> >
>>> >
>>> > ##########################
>>> >
>>> > # CLANGDWARF X64 definitions
>>> >
>>> > --
>>> > 2.39.1
>>> >
>>> >
>>> >
>>> > -=-=-=-=-=-=
>>> > Groups.io Links: You receive all messages sent to this group.
>>> > View/Reply Online (#101340):
>>> > https://edk2.groups.io/g/devel/message/101340
>>> > Mute This Topic: https://groups.io/mt/97673648/4905953
>>> > Group Owner: devel+owner@edk2.groups.io
>>> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
>>> > [gaoliming@byosoft.com.cn]
>>> > -=-=-=-=-=-=
>>> >
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
[-- Attachment #2: Type: text/html, Size: 10281 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2023-04-05 8:28 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-17 14:06 [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
2023-03-17 14:06 ` [PATCH 2/3] BaseTools/Conf/tools_def: Fix CLANGDWARF_IA32_X64 Patrick Rudolph
2023-03-26 19:39 ` [edk2-devel] " Sheng Lean Tan
[not found] ` <17500F66A352AD33.14179@groups.io>
2023-03-26 19:42 ` Sheng Lean Tan
2023-03-28 5:38 ` 回复: " gaoliming
2023-03-28 11:25 ` Marvin Häuser
2023-03-31 4:53 ` 回复: " gaoliming
2023-03-31 10:57 ` Marvin Häuser
2023-04-03 0:52 ` 回复: " gaoliming
2023-04-03 5:53 ` Patrick Rudolph
2023-03-31 14:41 ` Ni, Ray
2023-03-31 14:58 ` Marvin Häuser
2023-03-17 17:30 ` [edk2-devel] [PATCH 1/3] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Rebecca Cran
2023-03-17 17:44 ` Marvin Häuser
2023-03-17 20:35 ` Rebecca Cran
[not found] ` <174D4F37D4EEDF26.23349@groups.io>
2023-03-23 14:43 ` Rebecca Cran
2023-03-23 14:51 ` Sheng Lean Tan
2023-03-26 19:35 ` Sheng Lean Tan
2023-03-28 5:42 ` 回复: " gaoliming
2023-03-30 7:30 ` Sheng Lean Tan
2023-03-30 8:04 ` Marvin Häuser
2023-03-30 9:47 ` Patrick Rudolph
2023-04-04 12:46 ` Sheng Lean Tan
2023-04-05 8:27 ` Sheng Lean Tan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox