build/cross-tools: explicitly set ISA for riscv64

* Enable TLS for riscv64. For now select a dummy
  implementation.
* RISC-V has a register (tp) dedicated to TLS
* All the "desktop-like" RV64 chipsets implement GC
* Same ISA we currently build for... but calls it out
  in-case defaults change.

Change-Id: I623b6e5c309b6a6e80ec378e456b2335c561269d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3632
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Alexander von Gluck IV
2021-01-20 19:38:01 +00:00
committed by Alex von Gluck IV
parent 5ec64c5cdd
commit d123849688
3 changed files with 32 additions and 22 deletions
+1
View File
@@ -41,6 +41,7 @@ rule ArchitectureSetup architecture
case ppc : archFlags += -mcpu=440fp ; case ppc : archFlags += -mcpu=440fp ;
case arm : archFlags += -march=armv7-a -mfloat-abi=hard ; case arm : archFlags += -march=armv7-a -mfloat-abi=hard ;
case x86 : archFlags += -march=pentium ; case x86 : archFlags += -march=pentium ;
case riscv64 : archFlags += -march=rv64gc ;
} }
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 { if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
# TODO: These should be included in Clang's compiler specs. # TODO: These should be included in Clang's compiler specs.
+6 -6
View File
@@ -62,13 +62,13 @@ arm-*)
gdbTarget="arm-unknown-elf" gdbTarget="arm-unknown-elf"
;; ;;
riscv*-*) riscv*-*)
binutilsConfigureArgs="--disable-multilib" binutilsConfigureArgs=" --with-arch=rv64gc"
gccConfigureArgs="--disable-multilib" gccConfigureArgs=" --with-arch=rv64gc"
gdbConfigureArgs="--disable-multilib" gdbConfigureArgs=""
# TODO: Disable building with TLS support for riscv until implemented. binutilsConfigureArgs="$binutilsConfigureArgs --disable-multilib"
binutilsConfigureArgs="$binutilsConfigureArgs --disable-tls" gccConfigureArgs="$gccConfigureArgs --disable-multilib"
gccConfigureArgs="$gccConfigureArgs --disable-tls" gdbConfigureArgs="$gdbConfigureArgs --disable-multilib"
;; ;;
powerpc-*) powerpc-*)
binutilsConfigureArgs="--disable-multilib" binutilsConfigureArgs="--disable-multilib"
+25 -16
View File
@@ -1,24 +1,25 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2019 Haiku, Inc. All Rights Reserved.
** Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
// ToDo: this is a dummy implementation - I've not yet gained enough knowledge #include <runtime_loader/runtime_loader.h>
// to decide how this should be done, so it's just broken now (okay for single
// threaded apps, though).
// we don't want to have the inline assembly included here
#ifndef _NO_INLINE_ASM
# define _NO_INLINE_ASM 1
#endif
#include "support/TLS.h" #include "support/TLS.h"
#include "tls.h" #include "tls.h"
static int32 gNextSlot = TLS_FIRST_FREE_SLOT; struct tls_index {
static void *gSlots[TLS_MAX_KEYS]; unsigned long ti_module;
unsigned long ti_offset;
};
void* __tls_get_addr(struct tls_index* ti);
static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
// TODO: RISCV64 has a dedicated (TP) register for TLS
int32 int32
tls_allocate(void) tls_allocate(void)
@@ -34,20 +35,28 @@ tls_allocate(void)
void * void *
tls_get(int32 index) tls_get(int32 index)
{ {
return gSlots[index]; debugger("Implement TLS support before SMP");
return NULL;
} }
void ** void **
tls_address(int32 index) tls_address(int32 index)
{ {
return &gSlots[index]; debugger("Implement TLS support before SMP");
return NULL;
} }
void void
tls_set(int32 index, void *value) tls_set(int32 index, void *value)
{ {
gSlots[index] = value; debugger("Implement TLS support before SMP");
} }
void*
__tls_get_addr(struct tls_index* ti)
{
return __gRuntimeLoader->get_tls_address(ti->ti_module, ti->ti_offset);
}