public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Overriding of linker in ed2 build system
@ 2020-10-20 18:44 Prabin CA
  2020-10-21 14:05 ` [edk2-devel] " Andrew Fish
  0 siblings, 1 reply; 6+ messages in thread
From: Prabin CA @ 2020-10-20 18:44 UTC (permalink / raw)
  To: devel

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

Hi All,
I'm trying to build edk2 source code using clang, I see that linker used by edk2 build system is dependent on "-target <triplet>" defined in "BaseTools/Conf/tools_def.template".
I wish to use llvm provided linker, I had tried appending  "-fuse-ld=lld" option to  "_CLANG38_AARCH64_DLINK_FLAGS" . But I still see the target specific linker being used by edk2 build system.
Any advice what could be the right way of overriding with llvm based ld.

Thanks and Best Regards
Prabin CA

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

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

* Re: [edk2-devel] Overriding of linker in ed2 build system
  2020-10-20 18:44 Overriding of linker in ed2 build system Prabin CA
@ 2020-10-21 14:05 ` Andrew Fish
  2020-10-21 14:39   ` Prabin CA
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Fish @ 2020-10-21 14:05 UTC (permalink / raw)
  To: edk2-devel-groups-io, prabin.ca

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



> On Oct 20, 2020, at 11:44 AM, Prabin CA <prabin.ca@arm.com> wrote:
> 
> Hi All,
> I'm trying to build edk2 source code using clang, I see that linker used by edk2 build system is dependent on "-target <triplet>" defined in "BaseTools/Conf/tools_def.template". 
> I wish to use llvm provided linker, I had tried appending  "-fuse-ld=lld" option to  "_CLANG38_AARCH64_DLINK_FLAGS" . But I still see the target specific linker being used by edk2 build system.
> Any advice what could be the right way of overriding with llvm based ld.
> 

Prabin,

When you run edksetup.sh that copies  BaseTools/Conf/tools_def.template to Conf/tools_def.txt. So you need to edit the Conf/tools_def.txt file. 

Thanks,

Andrew Fish

> Thanks and Best Regards
> Prabin CA
> 


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

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

* Re: [edk2-devel] Overriding of linker in ed2 build system
  2020-10-21 14:05 ` [edk2-devel] " Andrew Fish
@ 2020-10-21 14:39   ` Prabin CA
  2020-10-21 15:39     ` Andrew Fish
  0 siblings, 1 reply; 6+ messages in thread
From: Prabin CA @ 2020-10-21 14:39 UTC (permalink / raw)
  To: Andrew Fish, devel

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

Hi Andrew,

Yes, it copy from  BaseTools/Conf/tools_def.template to Conf/tools_def.txt, so if we make any changes in Conf/tools_def.txt will be over write by BaseTools/Conf/tools_def.template, then why we have to edit txt file instead template. Please confirm we have to edit template file or txt file. and we are made changes such as setting target and appending LDFLAGS on template file.

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

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

* Re: [edk2-devel] Overriding of linker in ed2 build system
  2020-10-21 14:39   ` Prabin CA
@ 2020-10-21 15:39     ` Andrew Fish
  2020-10-28  9:35       ` Prabin CA
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Fish @ 2020-10-21 15:39 UTC (permalink / raw)
  To: edk2-devel-groups-io, prabin.ca

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

Prabin,

Conf/tools_def.txt is the local untracked by git copy of the file that the build actually uses. The Conf/tools_def.txt does NOT get overwritten by the BaseTools/Conf/tools_def.template if it exists. So you can edit Conf/tools_def.txt  locally for an experiment. If you change  BaseTools/Conf/tools_def.template then people need to force the update via `. edksetup.sh —reconfig`, if they have a local copy. 

Thanks,

Andrew Fish

> On Oct 21, 2020, at 7:39 AM, Prabin CA <prabin.ca@arm.com> wrote:
> 
> Hi Andrew,
> 
> Yes, it copy from  BaseTools/Conf/tools_def.template to Conf/tools_def.txt, so if we make any changes in Conf/tools_def.txt will be over write by BaseTools/Conf/tools_def.template, then why we have to edit txt file instead template. Please confirm we have to edit template file or txt file. and we are made changes such as setting target and appending LDFLAGS on template file.
> 


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

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

* Re: [edk2-devel] Overriding of linker in ed2 build system
  2020-10-21 15:39     ` Andrew Fish
@ 2020-10-28  9:35       ` Prabin CA
  2020-10-30  2:04         ` 回复: " gaoliming
  0 siblings, 1 reply; 6+ messages in thread
From: Prabin CA @ 2020-10-28  9:35 UTC (permalink / raw)
  To: Andrew Fish, devel

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

Hi Andrew,

I had edited tools_def.txt file with following changes  (shown diff below)

##################

# CLANG38 AARCH64 definitions

##################

-DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu

+DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-poky-linux

DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES)

DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

@@ -2767,7 +2767,7 @@ DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH6

*_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS) -fno-lto

*_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)

*_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments

-*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

+*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -fuse-ld=lld

*_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

*_CLANG38_AARCH64_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228

*_CLANG38_AARCH64_PLATFORM_FLAGS =

Please validate the changes first, now its picking LD from aarch64-poky-linux-ld, But the changes made to DLINK_FLAGS to take LD (-fuse-ld=lld) from clang is not making any effects. Can you suggest if anything I had missed or done in wrong.

Thanks

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

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

* 回复: [edk2-devel] Overriding of linker in ed2 build system
  2020-10-28  9:35       ` Prabin CA
@ 2020-10-30  2:04         ` gaoliming
  0 siblings, 0 replies; 6+ messages in thread
From: gaoliming @ 2020-10-30  2:04 UTC (permalink / raw)
  To: devel, prabin.ca, 'Andrew Fish'

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

Another way to override the build option is in [BuildOptions] DSC file. 

 

In PlatformPkg.dsc, you can specify the build options as below.

 

[BuildOptions]

*_CLANG38_AARCH64_DLINK_FLAGS = -target aarch64-poky-linux -fuse-ld=lld

 

Thanks

Liming

发件人: bounce+27952+66692+4905953+8761045@groups.io <bounce+27952+66692+4905953+8761045@groups.io> 代表 Prabin CA
发送时间: 2020年10月28日 17:36
收件人: Andrew Fish <afish@apple.com>; devel@edk2.groups.io
主题: Re: [edk2-devel] Overriding of linker in ed2 build system

 

Hi Andrew,

I had edited tools_def.txt file with following changes  (shown diff below)

##################

 # CLANG38 AARCH64 definitions

 ##################

-DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-linux-gnu

+DEFINE CLANG38_AARCH64_TARGET    = -target aarch64-poky-linux

 DEFINE CLANG38_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES)

 DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

 

@@ -2767,7 +2767,7 @@ DEFINE CLANG38_AARCH64_DLINK_FLAGS  = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH6

 *_CLANG38_AARCH64_ASLCC_FLAGS    = DEF(GCC_ASLCC_FLAGS) -fno-lto

 *_CLANG38_AARCH64_ASLDLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_ASLDLINK_FLAGS)

 *_CLANG38_AARCH64_ASM_FLAGS      = DEF(GCC_ASM_FLAGS) DEF(CLANG38_AARCH64_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments

-*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000

+*_CLANG38_AARCH64_DLINK_FLAGS    = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 -fuse-ld=lld

 *_CLANG38_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20

 *_CLANG38_AARCH64_DLINK2_FLAGS   = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x228

 

 *_CLANG38_AARCH64_PLATFORM_FLAGS =

Please validate the changes first, now its picking LD from aarch64-poky-linux-ld, But the changes made to DLINK_FLAGS to take LD (-fuse-ld=lld) from clang is not making any effects. Can you suggest if anything I had missed or done in wrong.

Thanks 




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

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

end of thread, other threads:[~2020-10-30  2:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-20 18:44 Overriding of linker in ed2 build system Prabin CA
2020-10-21 14:05 ` [edk2-devel] " Andrew Fish
2020-10-21 14:39   ` Prabin CA
2020-10-21 15:39     ` Andrew Fish
2020-10-28  9:35       ` Prabin CA
2020-10-30  2:04         ` 回复: " gaoliming

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