[DTrace-devel] [PATCH 2/5] build: get the architecture from gcc -dumpmachine, not uname -m

Eugene Loh eugene.loh at oracle.com
Tue Dec 12 23:50:52 UTC 2023


A hesitant
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

I'm unclear what's going on here.  What will the strategy be for cross 
compilation?

On 11/29/23 11:08, Nick Alcock via DTrace-devel wrote:
> This makes it at least*possible*  to support cross-compilation.
> It doesn't mean we do support it, but it's the first necessary
> prerequisite for such support.

How about,
"This step starts to lay the groundwork for cross-compilation."

> diff --git a/GNUmakefile b/GNUmakefile
> @@ -18,12 +18,13 @@ VERSION := 2.0.0
>   
>   # Verify supported hardware.
>   
> -ARCH := $(shell uname -m)
> +ARCHOS := $(shell gcc -dumpmachine | sed 's,-redhat,,; s,-unknown,,; s,-pc,,; s,-gnu$$,,')
> +ARCH := $(subst -linux,,$(ARCHOS))
>   
> -$(if $(subst sparc64,,$(subst aarch64,,$(subst x86_64,,$(ARCH)))), \
> +$(if $(subst sparc64-linux,,$(subst aarch64-linux,,$(subst x86_64-linux,,$(ARCHOS)))), \

What's the motivation for this change?  Didn't the old code suffice?

>       $(error "Error: DTrace for Linux only supports x86_64, ARM64 and sparc64"),)
> -$(if $(subst Linux,,$(shell uname -s)), \
> -    $(error "Error: DTrace only supports Linux"),)
> +$(if $(filter %-linux,$(ARCHOS)),, \
> +    $(error "Error: DTrace only supports Linux"))
>   
>   CFLAGS ?= -O2 -Wall -pedantic -Wno-unknown-pragmas
>   LDFLAGS ?=
> -- 2.42.0.271.g85384428f1 _________________________________________



More information about the DTrace-devel mailing list