Linux DTrace development list
 help / color / mirror / Atom feed
* [PATCH 1/2] tests: do not pass -flto to the compiler or linker
@ 2025-01-16 21:54 Nick Alcock
  2025-01-16 21:54 ` [PATCH 2/2] drti: do not compile with LTO Nick Alcock
  2025-01-16 22:22 ` [PATCH 1/2] tests: do not pass -flto to the compiler or linker Kris Van Hees
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Alcock @ 2025-01-16 21:54 UTC (permalink / raw)
  To: dtrace, dtrace-devel

We don't want to compile tests with -flto by default: if the distro
compiler automatically activates it, turn it off by explicitly passing
-fno-lto to all compiler and linker invocations in the testsuite.

(This is a bit fiddly because this is the first CPPFLAG which is
not also a valid flag to dtrace(1) itself, so we have to split
a variable up a bit.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
 runtest.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/runtest.sh b/runtest.sh
index 94634f80c2ebf..1cb5be8213396 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -589,8 +589,9 @@ else
         exit 1
     fi
 fi
-export test_cppflags
-export test_ldflags
+core_raw_dt_flags="$test_cppflags"
+export test_cppflags="$test_cppflags -fno-lto"
+export test_ldflags="$test_ldflags -fno-lto"
 export test_libdir
 
 # Figure out if the preprocessor supports -fno-diagnostics-show-option: if it
@@ -1085,7 +1086,7 @@ for dt in $dtrace; do
         # Default and substitute in flags.  The raw_dt_flags apply even to a
         # sh invocation.
 
-        raw_dt_flags="$test_cppflags"
+        raw_dt_flags="$core_raw_dt_flags"
 
         expected_tag=
         if [[ $testonly =~ ^err\.D_ ]]; then
-- 
2.47.1.279.g84c5f4e78e


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

* [PATCH 2/2] drti: do not compile with LTO
  2025-01-16 21:54 [PATCH 1/2] tests: do not pass -flto to the compiler or linker Nick Alcock
@ 2025-01-16 21:54 ` Nick Alcock
  2025-01-16 22:24   ` Kris Van Hees
  2025-01-16 22:22 ` [PATCH 1/2] tests: do not pass -flto to the compiler or linker Kris Van Hees
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Alcock @ 2025-01-16 21:54 UTC (permalink / raw)
  To: dtrace, dtrace-devel

drti.o is shipped as object code and can be reused by many compiler
versions: we must not put LTO IR into it.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
 libdtrace/Build | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libdtrace/Build b/libdtrace/Build
index 722351591aaea..307d7e8bf6434 100644
--- a/libdtrace/Build
+++ b/libdtrace/Build
@@ -122,6 +122,10 @@ dt_prov_uprobe.c_CFLAGS := -Wno-pedantic
 dt_debug.c_CFLAGS := -Wno-prio-ctor-dtor
 drti.c_CFLAGS := -Wno-prio-ctor-dtor
 
+# drti is shipped as an object file, so do not ever generate
+# LTO for it, since that is compiler-version-specific.
+drti.c_CFLAGS += -fno-lto
+
 SHORTKERNELS := $(foreach kernel,$(KERNELS),$(shell printf %s $(kernel) | sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$$/\1.\2.\3/'))
 
 -include libdtrace/$(ARCHINC)/Build
-- 
2.47.1.279.g84c5f4e78e


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

* Re: [PATCH 1/2] tests: do not pass -flto to the compiler or linker
  2025-01-16 21:54 [PATCH 1/2] tests: do not pass -flto to the compiler or linker Nick Alcock
  2025-01-16 21:54 ` [PATCH 2/2] drti: do not compile with LTO Nick Alcock
@ 2025-01-16 22:22 ` Kris Van Hees
  1 sibling, 0 replies; 4+ messages in thread
From: Kris Van Hees @ 2025-01-16 22:22 UTC (permalink / raw)
  To: Nick Alcock; +Cc: dtrace, dtrace-devel

On Thu, Jan 16, 2025 at 09:54:17PM +0000, Nick Alcock wrote:
> We don't want to compile tests with -flto by default: if the distro
> compiler automatically activates it, turn it off by explicitly passing
> -fno-lto to all compiler and linker invocations in the testsuite.
> 
> (This is a bit fiddly because this is the first CPPFLAG which is
> not also a valid flag to dtrace(1) itself, so we have to split
> a variable up a bit.)
> 
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>

> ---
>  runtest.sh | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/runtest.sh b/runtest.sh
> index 94634f80c2ebf..1cb5be8213396 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -589,8 +589,9 @@ else
>          exit 1
>      fi
>  fi
> -export test_cppflags
> -export test_ldflags
> +core_raw_dt_flags="$test_cppflags"
> +export test_cppflags="$test_cppflags -fno-lto"
> +export test_ldflags="$test_ldflags -fno-lto"
>  export test_libdir
>  
>  # Figure out if the preprocessor supports -fno-diagnostics-show-option: if it
> @@ -1085,7 +1086,7 @@ for dt in $dtrace; do
>          # Default and substitute in flags.  The raw_dt_flags apply even to a
>          # sh invocation.
>  
> -        raw_dt_flags="$test_cppflags"
> +        raw_dt_flags="$core_raw_dt_flags"
>  
>          expected_tag=
>          if [[ $testonly =~ ^err\.D_ ]]; then
> -- 
> 2.47.1.279.g84c5f4e78e
> 

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

* Re: [PATCH 2/2] drti: do not compile with LTO
  2025-01-16 21:54 ` [PATCH 2/2] drti: do not compile with LTO Nick Alcock
@ 2025-01-16 22:24   ` Kris Van Hees
  0 siblings, 0 replies; 4+ messages in thread
From: Kris Van Hees @ 2025-01-16 22:24 UTC (permalink / raw)
  To: Nick Alcock; +Cc: dtrace, dtrace-devel

On Thu, Jan 16, 2025 at 09:54:18PM +0000, Nick Alcock wrote:
> drti.o is shipped as object code and can be reused by many compiler
> versions: we must not put LTO IR into it.
> 
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>

> ---
>  libdtrace/Build | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libdtrace/Build b/libdtrace/Build
> index 722351591aaea..307d7e8bf6434 100644
> --- a/libdtrace/Build
> +++ b/libdtrace/Build
> @@ -122,6 +122,10 @@ dt_prov_uprobe.c_CFLAGS := -Wno-pedantic
>  dt_debug.c_CFLAGS := -Wno-prio-ctor-dtor
>  drti.c_CFLAGS := -Wno-prio-ctor-dtor
>  
> +# drti is shipped as an object file, so do not ever generate
> +# LTO for it, since that is compiler-version-specific.
> +drti.c_CFLAGS += -fno-lto
> +
>  SHORTKERNELS := $(foreach kernel,$(KERNELS),$(shell printf %s $(kernel) | sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$$/\1.\2.\3/'))
>  
>  -include libdtrace/$(ARCHINC)/Build
> -- 
> 2.47.1.279.g84c5f4e78e
> 

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

end of thread, other threads:[~2025-01-16 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 21:54 [PATCH 1/2] tests: do not pass -flto to the compiler or linker Nick Alcock
2025-01-16 21:54 ` [PATCH 2/2] drti: do not compile with LTO Nick Alcock
2025-01-16 22:24   ` Kris Van Hees
2025-01-16 22:22 ` [PATCH 1/2] tests: do not pass -flto to the compiler or linker Kris Van Hees

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