public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][committed] RISC-V: Add multiarch support on riscv-linux-gnu
@ 2023-08-22 17:39 Jeff Law
  2023-08-22 18:03 ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-08-22 17:39 UTC (permalink / raw)
  To: gcc-patches

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


This adds multiarch support to the RISC-V port so that bootstraps work 
with Debian out-of-the-box.  Without this patch the stage1 compiler is 
unable to find headers/libraries when building the stage1 runtime.

This is functionally (and possibly textually) equivalent to Debian's fix 
for the same problem.

gcc/
	* config/riscv/t-linux: Add MULTIARCH_DIRNAME.

Pushed to the trunk on Raphael's behalf.

Jeff

[-- Attachment #2: P --]
[-- Type: text/plain, Size: 1114 bytes --]

commit 47f95bc4be4eb14730ab3eaaaf8f6e71fda47690
Author: Raphael Moreira Zinsly <rzinsly@ventanamicro.com>
Date:   Tue Aug 22 11:37:04 2023 -0600

    RISC-V: Add multiarch support on riscv-linux-gnu
    
    This adds multiarch support to the RISC-V port so that bootstraps work with
    Debian out-of-the-box.  Without this patch the stage1 compiler is unable to
    find headers/libraries when building the stage1 runtime.
    
    This is functionally (and possibly textually) equivalent to Debian's fix for
    the same problem.
    
    gcc/
            * config/riscv/t-linux: Add MULTIARCH_DIRNAME.

diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
index 216d2776a18..a6f64f88d25 100644
--- a/gcc/config/riscv/t-linux
+++ b/gcc/config/riscv/t-linux
@@ -1,3 +1,5 @@
 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
 MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
 MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
+
+MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)

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

* Re: [PATCH][committed] RISC-V: Add multiarch support on riscv-linux-gnu
  2023-08-22 17:39 [PATCH][committed] RISC-V: Add multiarch support on riscv-linux-gnu Jeff Law
@ 2023-08-22 18:03 ` Palmer Dabbelt
  2023-08-22 18:57   ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2023-08-22 18:03 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

On Tue, 22 Aug 2023 10:39:38 PDT (-0700), Jeff Law wrote:
>
> This adds multiarch support to the RISC-V port so that bootstraps work
> with Debian out-of-the-box.  Without this patch the stage1 compiler is
> unable to find headers/libraries when building the stage1 runtime.
>
> This is functionally (and possibly textually) equivalent to Debian's fix
> for the same problem.
>
> gcc/
> 	* config/riscv/t-linux: Add MULTIARCH_DIRNAME.
>
> Pushed to the trunk on Raphael's behalf.
>
> Jeff
> commit 47f95bc4be4eb14730ab3eaaaf8f6e71fda47690
> Author: Raphael Moreira Zinsly <rzinsly@ventanamicro.com>
> Date:   Tue Aug 22 11:37:04 2023 -0600
>
>     RISC-V: Add multiarch support on riscv-linux-gnu
>
>     This adds multiarch support to the RISC-V port so that bootstraps work with
>     Debian out-of-the-box.  Without this patch the stage1 compiler is unable to
>     find headers/libraries when building the stage1 runtime.
>
>     This is functionally (and possibly textually) equivalent to Debian's fix for
>     the same problem.
>
>     gcc/
>             * config/riscv/t-linux: Add MULTIARCH_DIRNAME.
>
> diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
> index 216d2776a18..a6f64f88d25 100644
> --- a/gcc/config/riscv/t-linux
> +++ b/gcc/config/riscv/t-linux
> @@ -1,3 +1,5 @@
>  # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
>  MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
>  MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
> +
> +MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)

The docs seem to suggest that we should have a multarch-compatible 
MULTILIB_OSDIRNAMES as we support both multilib and multiarch:

    @code{MULTIARCH_DIRNAME} is not used for configurations that support
    both multilib and multiarch.  In that case, multiarch names are encoded
    in @code{MULTILIB_OSDIRNAMES} instead.

It's not clear if "supports" there actually means "enabled", as IIUC none of
the distros actually ship multilib.  So maybe this can't manifest and we should
fix the docs?

Or maybe something like this just does it?

    diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
    index a6f64f88d25..00e382db0f8 100644
    --- a/gcc/config/riscv/t-linux
    +++ b/gcc/config/riscv/t-linux
    @@ -1,5 +1,5 @@
     # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
     MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
    -MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
    +MULTILIB_OSDIRNAMES := $(patsubst lib64%:rv64%-linux-gnu,$(patsubst lib32%:rv32%-linux-gnu,../lib32,$(MULTILIB_DIRNAMES)))
     
     MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)

I have no idea how to test multiarch+multilib, though.  Is there a way to just
autoconf error that out as unsupported until someone wants it?

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

* Re: [PATCH][committed] RISC-V: Add multiarch support on riscv-linux-gnu
  2023-08-22 18:03 ` Palmer Dabbelt
@ 2023-08-22 18:57   ` Jeff Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2023-08-22 18:57 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: gcc-patches



On 8/22/23 12:03, Palmer Dabbelt wrote:
> On Tue, 22 Aug 2023 10:39:38 PDT (-0700), Jeff Law wrote:

> 
> The docs seem to suggest that we should have a multarch-compatible 
> MULTILIB_OSDIRNAMES as we support both multilib and multiarch:
> 
>     @code{MULTIARCH_DIRNAME} is not used for configurations that support
>     both multilib and multiarch.  In that case, multiarch names are encoded
>     in @code{MULTILIB_OSDIRNAMES} instead.
> 
> It's not clear if "supports" there actually means "enabled", as IIUC 
> none of the distros actually ship multilib.  So maybe this can't manifest and we 
> should fix the docs?
Debian explicitly disables multilibs for RISC-V, Ubuntu almost certainly 
just follows that.   Fedora and its relatives don't use multiarch.


> 
> Or maybe something like this just does it?
Maybe, but we'd really want/need to test it :-)

> 
>     diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
>     index a6f64f88d25..00e382db0f8 100644
>     --- a/gcc/config/riscv/t-linux
>     +++ b/gcc/config/riscv/t-linux
>     @@ -1,5 +1,5 @@
>      # Only XLEN and ABI affect Linux multilib dir names, e.g. 
> /lib32/ilp32d/
>      MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst 
> rv64%,lib64,$(MULTILIB_DIRNAMES)))
>     -MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
>     +MULTILIB_OSDIRNAMES := $(patsubst lib64%:rv64%-linux-gnu,$(patsubst 
> lib32%:rv32%-linux-gnu,../lib32,$(MULTILIB_DIRNAMES)))
>      MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, 
> ,$(target)))-linux-gnu)
> 
> I have no idea how to test multiarch+multilib, though.  Is there a way 
> to just autoconf error that out as unsupported until someone wants it?
I'm not sure either.  It might be as simple as bootstrapping on a Debian 
native with a small set of rv64 multilibs.
Jeff

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

end of thread, other threads:[~2023-08-22 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-22 17:39 [PATCH][committed] RISC-V: Add multiarch support on riscv-linux-gnu Jeff Law
2023-08-22 18:03 ` Palmer Dabbelt
2023-08-22 18:57   ` Jeff Law

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).