mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 16:31:06 +00:00
8cddd86a4c
issue #1880
155 lines
5.5 KiB
Diff
155 lines
5.5 KiB
Diff
diff --git a/gcc/config.gcc b/gcc/config.gcc
|
|
index b7ebc07..5acf469 100644
|
|
--- a/gcc/config.gcc
|
|
+++ b/gcc/config.gcc
|
|
@@ -1060,7 +1060,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
|
|
case ${target} in
|
|
arm*-*-eabi*)
|
|
tm_file="$tm_file newlib-stdint.h"
|
|
- tmake_file="${tmake_file} arm/t-bpabi"
|
|
+ tmake_file="${tmake_file} arm/t-bpabi t-slibgcc"
|
|
use_gcc_stdint=wrap
|
|
;;
|
|
arm*-*-rtems*)
|
|
@@ -1969,7 +1969,7 @@ riscv*-*-linux*) # Linux RISC-V
|
|
;;
|
|
riscv*-*-elf*) # Linux RISC-V
|
|
tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
|
|
- tmake_file="${tmake_file} riscv/t-elf"
|
|
+ tmake_file="${tmake_file} riscv/t-elf t-slibgcc"
|
|
gnu_ld=yes
|
|
gas=yes
|
|
gcc_cv_initfini_array=yes
|
|
@@ -2915,7 +2915,7 @@ i[34567]86-*-linux* | x86_64-*-linux*)
|
|
tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386"
|
|
;;
|
|
i[34567]86-*-* | x86_64-*-*)
|
|
- tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
|
|
+ tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386 t-slibgcc"
|
|
;;
|
|
powerpc*-*-* | rs6000-*-*)
|
|
tm_file="${tm_file} rs6000/option-defaults.h"
|
|
diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h
|
|
index ec6f9a4..579172d 100644
|
|
--- a/gcc/config/arm/unknown-elf.h
|
|
+++ b/gcc/config/arm/unknown-elf.h
|
|
@@ -94,3 +94,19 @@
|
|
which will depend on abort, which is defined in libc. */
|
|
#undef LINK_GCC_C_SEQUENCE_SPEC
|
|
#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %L --end-group"
|
|
+
|
|
+/* genode.h */
|
|
+
|
|
+/*
|
|
+ * The 'LINK_SPEC' define comprises the rules of how the GCC frontend invokes
|
|
+ * the linker.
|
|
+ */
|
|
+
|
|
+#undef LINK_SPEC
|
|
+#define LINK_SPEC \
|
|
+ "%(shared:-shared) \
|
|
+ %{!static:--eh-frame-hdr}"
|
|
+
|
|
+/* Don't assume anything about the header files. */
|
|
+/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699 */
|
|
+#define NO_IMPLICIT_EXTERN_C
|
|
diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
|
|
index 16fc685..85b07bb 100644
|
|
--- a/gcc/config/i386/x86-64.h
|
|
+++ b/gcc/config/i386/x86-64.h
|
|
@@ -106,3 +106,22 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
#undef TARGET_SECTION_TYPE_FLAGS
|
|
#define TARGET_SECTION_TYPE_FLAGS x86_64_elf_section_type_flags
|
|
+
|
|
+/* genode64.h */
|
|
+
|
|
+/*
|
|
+ * The 'LINK_SPEC' macro expresses the policy of how the GCC
|
|
+ * frontend invokes 'ld' on multiarch platforms. I.e., on x86, we need to pass
|
|
+ * '-melf_i386' to 'ld' when building in '-m32' mode.
|
|
+ */
|
|
+
|
|
+#undef LINK_SPEC
|
|
+#define LINK_SPEC \
|
|
+ "%{!m32:-m elf_x86_64} \
|
|
+ %{m32:-m elf_i386} \
|
|
+ %{shared:-shared} \
|
|
+ %{!static:--eh-frame-hdr}"
|
|
+
|
|
+/* Don't assume anything about the header files. */
|
|
+/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699 */
|
|
+#define NO_IMPLICIT_EXTERN_C
|
|
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
|
|
index 4533cff..1f78497 100644
|
|
--- a/gcc/config/riscv/riscv.h
|
|
+++ b/gcc/config/riscv/riscv.h
|
|
@@ -171,14 +171,11 @@ along with GCC; see the file COPYING3. If not see
|
|
%(subtarget_asm_spec)"
|
|
|
|
/* Extra switches sometimes passed to the linker. */
|
|
-
|
|
-#ifndef LINK_SPEC
|
|
+#undef LINK_SPEC
|
|
#define LINK_SPEC "\
|
|
-%{!T:-dT riscv.ld} \
|
|
-%{m64:-melf64lriscv} \
|
|
-%{m32:-melf32lriscv} \
|
|
-%{shared}"
|
|
-#endif /* LINK_SPEC defined */
|
|
+-melf64lriscv \
|
|
+%{shared:-shared} \
|
|
+%{!static:--eh-frame-hdr}"
|
|
|
|
/* This macro defines names of additional specifications to put in the specs
|
|
that can be used in various specifications like CC1_SPEC. Its definition
|
|
diff --git a/libgcc/config.host b/libgcc/config.host
|
|
index 8a30368..83b5dba 100644
|
|
--- a/libgcc/config.host
|
|
+++ b/libgcc/config.host
|
|
@@ -300,7 +300,7 @@ case ${host} in
|
|
tmake_file=t-vxworks
|
|
;;
|
|
*-*-elf)
|
|
- extra_parts="crtbegin.o crtend.o"
|
|
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
|
|
;;
|
|
esac
|
|
|
|
@@ -387,8 +387,12 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
|
|
tm_file="$tm_file arm/bpabi-lib.h"
|
|
case ${host} in
|
|
arm*-*-eabi* | arm*-*-rtems*)
|
|
+ # The 't-slibgcc' tmake file is needed to have libgcc_eh.a built.
|
|
+ # The 't-eh-dw2-dip' tmake file is needed to let the tool chain use 'unwind-dw2-fde-dip.c',
|
|
+ # needed for the exception handling on Genode in the presence of shared libraries.
|
|
+ tmake_file="${tmake_file} t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
|
|
tmake_file="${tmake_file} arm/t-bpabi"
|
|
- extra_parts="crtbegin.o crtend.o crti.o crtn.o"
|
|
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
|
|
;;
|
|
arm*-*-symbianelf*)
|
|
tmake_file="${tmake_file} arm/t-symbian t-slibgcc-nolc-override"
|
|
@@ -546,6 +550,10 @@ i[34567]86-*-elf*)
|
|
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
|
|
;;
|
|
x86_64-*-elf*)
|
|
+ # The 't-slibgcc' tmake file is needed to have libgcc_eh.a built.
|
|
+ # The 't-eh-dw2-dip' tmake file is needed to let the tool chain use 'unwind-dw2-fde-dip.c',
|
|
+ # needed for the exception handling on Genode in the presence of shared libraries.
|
|
+ tmake_file="$tmake_file t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
|
|
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
|
|
;;
|
|
i[34567]86-*-freebsd*)
|
|
@@ -1014,8 +1022,8 @@ riscv*-*-linux*)
|
|
extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
|
|
;;
|
|
riscv*-*-*)
|
|
- tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf"
|
|
- extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
|
|
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
|
|
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
|
|
;;
|
|
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
|
|
md_unwind_header=rs6000/aix-unwind.h
|