On Tue, 9 Apr 2019 at 11:53, David Abdurachmanov
<david.abdurachma...@gmail.com> wrote:
>
> diff --git a/libphobos/libdruntime/rt/sections_elf_shared.d 
> b/libphobos/libdruntime/rt/sections_elf_shared.d
> index d4e1ff07699..45c1dcbc7f3 100644
> --- a/libphobos/libdruntime/rt/sections_elf_shared.d
> +++ b/libphobos/libdruntime/rt/sections_elf_shared.d
> @@ -10,6 +10,9 @@
>
>  module rt.sections_elf_shared;
>
> +version (RISCV32) version = RISCV_Any;
> +version (RISCV64) version = RISCV_Any;
> +
>  version (CRuntime_Glibc) enum SharedELF = true;
>  else version (FreeBSD) enum SharedELF = true;
>  else version (NetBSD) enum SharedELF = true;
> @@ -671,7 +674,16 @@ version (Shared)
>              if (dyn.d_tag == DT_STRTAB)
>              {
>                  version (linux)
> -                    strtab = cast(const(char)*)dyn.d_un.d_ptr;
> +                {
> +                    // This might change in future glibc releases (after 
> 2.29) as dynamic sections
> +                    // are not required to be read-only on RISC-V. This was 
> copy & pasted from MIPS while
> +                    // upstreaming RISC-V support. Otherwise MIPS is the 
> only arch which sets in glibc:
> +                    // #define DL_RO_DYN_SECTION 1
> +                    version (RISCV_Any)
> +                        strtab = cast(const(char)*)(info.dlpi_addr + 
> dyn.d_un.d_ptr); // relocate
> +                    else
> +                        strtab = cast(const(char)*)dyn.d_un.d_ptr;
> +                }
>                  else version (FreeBSD)
>                      strtab = cast(const(char)*)(info.dlpi_addr + 
> dyn.d_un.d_ptr); // relocate
>                  else version (NetBSD)

This needs to be rebased to patch gcc/sections/elf_shared.d

> diff --git 
> a/libphobos/src/std/experimental/allocator/building_blocks/region.d 
> b/libphobos/src/std/experimental/allocator/building_blocks/region.d
> index dfcecce72bd..cafe059a61f 100644
> --- a/libphobos/src/std/experimental/allocator/building_blocks/region.d
> +++ b/libphobos/src/std/experimental/allocator/building_blocks/region.d
> @@ -391,7 +391,8 @@ struct InSituRegion(size_t size, size_t minAlign = 
> platformAlignment)
>      else version (PPC) enum growDownwards = Yes.growDownwards;
>      else version (PPC64) enum growDownwards = Yes.growDownwards;
>      else version (MIPS32) enum growDownwards = Yes.growDownwards;
> -    else version (MIPS64) enum growDownwards = Yes.growDownwards;
> +    else version (RISCV32) enum growDownwards = Yes.growDownwards;
> +    else version (RISCV64) enum growDownwards = Yes.growDownwards;
>      else version (SPARC) enum growDownwards = Yes.growDownwards;
>      else version (SystemZ) enum growDownwards = Yes.growDownwards;
>      else static assert(0, "Dunno how the stack grows on this architecture.");

This has been upstreamed and committed in r270296.

> diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d
> index e98e746a856..9fe746501a4 100644
> --- a/libphobos/src/std/math.d
> +++ b/libphobos/src/std/math.d
> @@ -162,6 +162,8 @@ version (AArch64)   version = ARM_Any;
>  version (ARM)       version = ARM_Any;
>  version (SPARC)     version = SPARC_Any;
>  version (SPARC64)   version = SPARC_Any;
> +version (RISCV32)   version = RISCV_Any;
> +version (RISCV64)   version = RISCV_Any;
>
>  version (D_InlineAsm_X86)
>  {

Apart from the asm { } code, same with this as well.

Everything else is OK.

-- 
Iain

Reply via email to