Fixes shared library linking (XCC)
If you try to make a hello-world c++ library:
$ x86_64-ucb-akaros-gcc -fPIC -o lib.o -c lib.cc
$ x86_64-ucb-akaros-gcc -shared -o lib.so lib.o
You'll get the error:
... 4.9.2/crtendS.o(.eh_frame); no .eh_frame_hdr table will be created.
Some sites suggested a problem with config.gcc, such as
http://forum.osdev.org/viewtopic.php?t=25489 , though the problem was
n't crtstuff. Or at least that didn't help me. Though it did make me
look at the config.gcc, and I attempted to make ours more like Linux's.
The main change was tmake_file="t-slibgcc" , which is needed to make
a shared version of libgcc_s.so. That in turn needed some fixups in
config.host, the most important being the softfloat business where we
didn't include x86_64 akaros.
Rebuild your toolchain.
diff --git a/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/gcc/config.gcc b/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/gcc/config.gcc
index 7939108..7b8dd4a 100644
--- a/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/gcc/config.gcc
+++ b/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/gcc/config.gcc
@@ -879,6 +879,17 @@
use_gcc_stdint=wrap
;;
*-*-akaros*)
+ # brho 2015-04-17
+ # We need this for the shared libgcc_s.so
+ tmake_file="t-slibgcc"
+ # Linux has these options (among others that I removed). I think it's saying
+ # to use the glibc targetcm, which needs glibc-c.o to be built, which needs
+ # the t-glibc makefrag
+ c_target_objs="${c_target_objs} glibc-c.o"
+ cxx_target_objs="${cxx_target_objs} glibc-c.o"
+ tmake_file="${tmake_file} t-glibc"
+ target_has_targetcm=yes
+ # We've had these options for a while, linux also has them (and tgmath=no)
default_use_cxa_atexit=yes
use_gcc_stdint=wrap
gas=yes
@@ -1363,13 +1374,21 @@
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
tmake_file="i386/t-i386elf t-svr4"
;;
+# hasn't been compiled in a long time (2015-04-17)
i[34567]86-*-akaros*)
+ # i386 linux, plus akaros/h i386/akaros.h
+ # consider adding i386/gnu-user-common.h i386/gnu-user.h etc
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h glibc-stdint.h gnu-user.h akaros.h i386/akaros.h"
+ # linux doesn't use the tmake_file here, but a subset of these is still
+ # needed (probably the FP stuff)
tmake_file="${tmake_file} t-slibgcc-elf-ver t-linux i386/t-fprules-softfp soft-fp/t-softfp i386/t-linux"
;;
x86_64-*-akaros*)
- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h akaros.h glibc-stdint.h i386/x86-64.h i386/akaros64.h"
+ # similar to linux, but minus some gnu bits. gnu-user64 wants an x32 ld
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h i386/x86-64.h akaros.h i386/akaros64.h"
tmake_file="${tmake_file} i386/t-linux64"
+ # linux does not need these tmake files, but we need at least some of them.
+ # without these, compilation failed.
tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp i386/t-linux"
;;
riscv*-*-akaros*)
diff --git a/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libgcc/config.host b/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libgcc/config.host
index 2595977..a19fc4a 100644
--- a/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libgcc/config.host
+++ b/tools/compilers/gcc-glibc/gcc-4.9.2-akaros/libgcc/config.host
@@ -226,7 +226,7 @@
;;
esac
;;
-*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-akaros*)
tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
if test x$enable_vtable_verify = xyes; then
@@ -237,9 +237,6 @@
tmake_file="$tmake_file t-lynx $cpu_type/t-crtstuff t-crtstuff-pic t-libgcc-pic"
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
;;
-*-*-akaros*)
- extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
- ;;
*-*-netbsd*)
tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
# NetBSD 1.7 and later are set up to use GCC's crtstuff for
@@ -567,21 +564,21 @@
;;
riscv*-*-akaros*)
;;
-i[34567]86-*-akaros* | i[34567]86-*-linux*)
+i[34567]86-*-linux*)
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
md_unwind_header=i386/linux-unwind.h
;;
-i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+i[34567]86-*-akaros* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
;;
-x86_64-*-akaros* | x86_64-*-linux*)
+x86_64-*-linux*)
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
md_unwind_header=i386/linux-unwind.h
;;
-x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
+x86_64-*-akaros* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm i386/t-crtstuff t-dfprules"
;;
@@ -1264,7 +1261,7 @@
i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \
i[34567]86-*-linux* | x86_64-*-linux* | \
i[34567]86-*-gnu* | \
- i[34567]86-*-akaros* | \
+ i[34567]86-*-akaros* | x86_64-*-akaros* | \
i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
i[34567]86-*-cygwin* | x86_64-*-cygwin* | \
i[34567]86-*-mingw* | x86_64-*-mingw* | \