summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--include/sbi/sbi_visibility.h16
-rw-r--r--lib/utils/serial/semihosting.c2
3 files changed, 18 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 419ce66b..7de3fc96 100644
--- a/Makefile
+++ b/Makefile
@@ -350,6 +350,7 @@ ifeq ($(BUILD_INFO),y)
GENFLAGS += -DOPENSBI_BUILD_TIME_STAMP="\"$(OPENSBI_BUILD_TIME_STAMP)\""
GENFLAGS += -DOPENSBI_BUILD_COMPILER_VERSION="\"$(OPENSBI_BUILD_COMPILER_VERSION)\""
endif
+GENFLAGS += -include $(include_dir)/sbi/sbi_visibility.h
ifdef PLATFORM
GENFLAGS += -include $(KCONFIG_AUTOHEADER)
endif
diff --git a/include/sbi/sbi_visibility.h b/include/sbi/sbi_visibility.h
new file mode 100644
index 00000000..e9c401c5
--- /dev/null
+++ b/include/sbi/sbi_visibility.h
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2025 SiFive
+ */
+
+#ifndef __SBI_VISIBILITY_H__
+#define __SBI_VISIBILITY_H__
+
+/*
+ * Declare all global objects with hidden visibility so access is PC-relative
+ * instead of going through the GOT.
+ */
+#pragma GCC visibility push(hidden)
+
+#endif
diff --git a/lib/utils/serial/semihosting.c b/lib/utils/serial/semihosting.c
index 19ebaa07..3a42ba60 100644
--- a/lib/utils/serial/semihosting.c
+++ b/lib/utils/serial/semihosting.c
@@ -67,7 +67,7 @@ bool semihosting_enabled(void)
" mret\n"
"_semihost_test_vector_next:\n"
- " la %[tmp], _semihost_test_vector\n"
+ " lla %[tmp], _semihost_test_vector\n"
" csrrw %[tmp], mtvec, %[tmp]\n"
" .align 4\n"
" slli zero, zero, 0x1f\n"