public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
@ 2023-03-30  9:48 Patrick Rudolph
  2023-04-04 12:42 ` [edk2-devel] " Sheng Lean Tan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Patrick Rudolph @ 2023-03-30  9:48 UTC (permalink / raw)
  Cc: devel, gaoliming, rebecca, bob.c.feng, yuwei.chen,
	patrick.rudolph, gua.guo, james.lu, 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] 4+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
  2023-03-30  9:48 [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
@ 2023-04-04 12:42 ` Sheng Lean Tan
  2023-04-05 17:15 ` Rebecca Cran
       [not found] ` <1753195A0E9C6D3F.3578@groups.io>
  2 siblings, 0 replies; 4+ messages in thread
From: Sheng Lean Tan @ 2023-04-04 12:42 UTC (permalink / raw)
  To: Patrick Rudolph, devel

[-- Attachment #1: Type: text/plain, Size: 33 bytes --]

Can anyone help to review this?

[-- Attachment #2: Type: text/html, Size: 33 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
  2023-03-30  9:48 [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
  2023-04-04 12:42 ` [edk2-devel] " Sheng Lean Tan
@ 2023-04-05 17:15 ` Rebecca Cran
       [not found] ` <1753195A0E9C6D3F.3578@groups.io>
  2 siblings, 0 replies; 4+ messages in thread
From: Rebecca Cran @ 2023-04-05 17:15 UTC (permalink / raw)
  To: devel, patrick.rudolph
  Cc: gaoliming, bob.c.feng, yuwei.chen, gua.guo, james.lu, ardb

Reviewed-by: Rebecca Cran <rebecca@bsdio.com>


On 3/30/23 3:48 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] 4+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32
       [not found] ` <1753195A0E9C6D3F.3578@groups.io>
@ 2023-04-05 20:41   ` Rebecca Cran
  0 siblings, 0 replies; 4+ messages in thread
From: Rebecca Cran @ 2023-04-05 20:41 UTC (permalink / raw)
  To: devel, patrick.rudolph
  Cc: gaoliming, bob.c.feng, yuwei.chen, gua.guo, james.lu, ardb

Pushed as 
https://github.com/tianocore/edk2/commit/2bb693894920e634153275bea60278a9f192a8ef


-- 
Rebecca Cran


On 4/5/23 11:15 AM, Rebecca Cran wrote:
> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
>
>
> On 3/30/23 3:48 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] 4+ messages in thread

end of thread, other threads:[~2023-04-05 20:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30  9:48 [PATCH 1/1] BaseTools/Conf/tools_def: Fix linking using CLANGDWARF_IA32 Patrick Rudolph
2023-04-04 12:42 ` [edk2-devel] " Sheng Lean Tan
2023-04-05 17:15 ` Rebecca Cran
     [not found] ` <1753195A0E9C6D3F.3578@groups.io>
2023-04-05 20:41   ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox