build: use uname -m to detect processor

Ubuntu patches uname -p to return the processor type:

    https://git.launchpad.net/ubuntu/+source/coreutils/tree/debian/patches/80_fedora_sysinfo.patch?h=ubuntu/oracular

and Fedora also did before Fedora 38:

    cd953e11dd

but in general, uname -p returns "unknown".  Use uname -m instead.

Fixes build error:

    /usr/bin/ld: /tmp/ccgv9E4e.o: in function `_start':
    freestanding.c:(.text+0x6255a): multiple definition of `_start'; /usr/lib/gcc/x86_64-redhat-linux/14/../../../../lib64/crt1.o:(.text+0x0): first defined here
    collect2: error: ld returned 1 exit status
This commit is contained in:
Benjamin Gilbert 2024-10-06 03:43:53 -07:00
parent c470f4dae6
commit bc8003bc64

View File

@ -367,7 +367,7 @@ test-decompress-partial : decompress-partial decompress-partial-usingDict
# freestanding test only for Linux x86_64
#-----------------------------------------------------------------------------
UNAME_S ?= $(if $(filter Windows_NT,$(OS)),Windows,$(shell uname -s))
UNAME_P ?= $(if $(filter Windows_NT,$(OS)),Unknown,$(shell uname -p))
UNAME_M ?= $(if $(filter Windows_NT,$(OS)),Unknown,$(shell uname -m))
FREESTANDING_CFLAGS := -ffreestanding -nostdlib
@ -375,7 +375,7 @@ ifneq ($(UNAME_S), Linux)
FREESTANDING_CFLAGS :=
endif
ifneq ($(UNAME_P), x86_64)
ifneq ($(UNAME_M), x86_64)
FREESTANDING_CFLAGS :=
endif