public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* How do I enable -flto for Emacs nativecomp?
@ 2024-03-07 17:53 StrawberryTea
  2024-03-07 17:57 ` Antoni Boucher
  0 siblings, 1 reply; 3+ messages in thread
From: StrawberryTea @ 2024-03-07 17:53 UTC (permalink / raw)
  To: jit

Hello libgccjit people,

I'm trying to enable -flto for Emacs nativecomp. I have the following
Emacs patch I am applying through Gentoo

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index bb4552459dd..745612838cc 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -193,8 +193,8 @@ native-comp-async-query-on-exit
   :type 'boolean
   :version "28.1")

-(defcustom native-comp-compiler-options nil
+(defcustom native-comp-compiler-options '("-march=znver4" "-Ofast" "-g0" "-fno-finite-math-only" "-flto")
   "Command line options passed verbatim to GCC compiler.
 Note that not all options are meaningful and some options might even
 break your Emacs.  Use at your own risk.
 affecting the assembler and linker are likely to be useful.

However, Emacs fails to compile with the following error:
libgccjit.so: error: LTO support has not been enabled in this configuration
Assembler messages:
Error: can't open /var/tmp/portage/app-editors/emacs-30.0.9999/temp/libgccjit-1Escx1/fake.s for reading: No such file or directory
libgccjit.so: error: error invoking gcc driver

This is a link to the entire build log: https://0x0.st/H7h2.txt
And this is one for the build environment: https://0x0.st/H7hL.txt
And this is the output of gcc --version --verbose: https://0x0.st/H7hp.txt

I can pass options to the compiler and to the driver but I am not sure
what else to pass to enable LTO or if I need to recompile GCC, etc, etc.

Sincerely,
StrawberryTea

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

* Re: How do I enable -flto for Emacs nativecomp?
  2024-03-07 17:53 How do I enable -flto for Emacs nativecomp? StrawberryTea
@ 2024-03-07 17:57 ` Antoni Boucher
  2024-03-07 18:05   ` Sam James
  0 siblings, 1 reply; 3+ messages in thread
From: Antoni Boucher @ 2024-03-07 17:57 UTC (permalink / raw)
  To: jit

It seems to me that you forgot to enable the lto frontend.
Please add it to --enable-languages when configuring the gcc build.

Le 2024-03-07 à 12 h 53, StrawberryTea a écrit :
> Hello libgccjit people,
> 
> I'm trying to enable -flto for Emacs nativecomp. I have the following
> Emacs patch I am applying through Gentoo
> 
> diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
> index bb4552459dd..745612838cc 100644
> --- a/lisp/emacs-lisp/comp.el
> +++ b/lisp/emacs-lisp/comp.el
> @@ -193,8 +193,8 @@ native-comp-async-query-on-exit
>     :type 'boolean
>     :version "28.1")
> 
> -(defcustom native-comp-compiler-options nil
> +(defcustom native-comp-compiler-options '("-march=znver4" "-Ofast" "-g0" "-fno-finite-math-only" "-flto")
>     "Command line options passed verbatim to GCC compiler.
>   Note that not all options are meaningful and some options might even
>   break your Emacs.  Use at your own risk.
>   affecting the assembler and linker are likely to be useful.
> 
> However, Emacs fails to compile with the following error:
> libgccjit.so: error: LTO support has not been enabled in this configuration
> Assembler messages:
> Error: can't open /var/tmp/portage/app-editors/emacs-30.0.9999/temp/libgccjit-1Escx1/fake.s for reading: No such file or directory
> libgccjit.so: error: error invoking gcc driver
> 
> This is a link to the entire build log: https://0x0.st/H7h2.txt
> And this is one for the build environment: https://0x0.st/H7hL.txt
> And this is the output of gcc --version --verbose: https://0x0.st/H7hp.txt
> 
> I can pass options to the compiler and to the driver but I am not sure
> what else to pass to enable LTO or if I need to recompile GCC, etc, etc.
> 
> Sincerely,
> StrawberryTea

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

* Re: How do I enable -flto for Emacs nativecomp?
  2024-03-07 17:57 ` Antoni Boucher
@ 2024-03-07 18:05   ` Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2024-03-07 18:05 UTC (permalink / raw)
  To: bouanto, StrawberryTea; +Cc: jit

I think this is an omission in how we build libgccjit in Gentoo.

I've fixed it by pushing a change to toolchain.eclass to build libgccjit
with LTO support. Thanks.

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

end of thread, other threads:[~2024-03-07 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07 17:53 How do I enable -flto for Emacs nativecomp? StrawberryTea
2024-03-07 17:57 ` Antoni Boucher
2024-03-07 18:05   ` Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).