forked from rust-lang/libc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rust-lang#3 from ids1024/build
Use patches for modifying binutils/gcc/newlib
- Loading branch information
Showing
24 changed files
with
1,996 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
diff -rupN binutils/bfd/config.bfd binutils-redox/bfd/config.bfd | ||
--- binutils/bfd/config.bfd 2014-10-14 00:32:02.000000000 -0700 | ||
+++ binutils-redox/bfd/config.bfd 2016-07-26 08:45:31.210878318 -0700 | ||
@@ -633,6 +633,11 @@ case "${targ}" in | ||
targ_selvecs="i386_aout_linux_vec i386_pei_vec" | ||
targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" | ||
;; | ||
+ i[3-7]86-*-redox*) | ||
+ targ_defvec=i386_elf32_vec | ||
+ targ_selvecs= | ||
+ targ64_selvecs=x86_64_elf64_vec | ||
+ ;; | ||
i[3-7]86-*-nacl*) | ||
targ_defvec=i386_elf32_nacl_vec | ||
targ_selvecs="arm_elf32_nacl_be_vec arm_elf32_nacl_le_vec" | ||
@@ -676,6 +681,11 @@ case "${targ}" in | ||
targ_selvecs="i386_elf32_vec x86_64_elf32_vec i386_aout_linux_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec" | ||
want64=true | ||
;; | ||
+ x86_64-*-redox*) | ||
+ targ_defvec=x86_64_elf64_vec | ||
+ targ_selvecs=i386_elf32_vec | ||
+ want64=true | ||
+ ;; | ||
x86_64-*-nacl*) | ||
targ_defvec=x86_64_elf32_nacl_vec | ||
targ_selvecs="i386_elf32_nacl_vec x86_64_elf64_nacl_vec arm_elf32_nacl_be_vec arm_elf32_nacl_le_vec" | ||
diff -rupN binutils/config.sub binutils-redox/config.sub | ||
--- binutils/config.sub 2014-10-14 00:32:02.000000000 -0700 | ||
+++ binutils-redox/config.sub 2016-07-26 08:45:31.210878318 -0700 | ||
@@ -1376,7 +1376,7 @@ case $os in | ||
| -chorusos* | -chorusrdb* | -cegcc* \ | ||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | ||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | ||
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | ||
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* | -redox* \ | ||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | ||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | ||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | ||
diff -rupN binutils/gas/configure.tgt binutils-redox/gas/configure.tgt | ||
--- binutils/gas/configure.tgt 2014-10-14 00:32:03.000000000 -0700 | ||
+++ binutils-redox/gas/configure.tgt 2016-07-26 08:45:31.210878318 -0700 | ||
@@ -238,6 +238,7 @@ case ${generic_target} in | ||
case ${cpu}-${os} in | ||
x86_64*-linux-gnux32) arch=x86_64:32 ;; | ||
esac ;; | ||
+ i386-*-redox*) fmt=elf ;; | ||
i386-*-lynxos*) fmt=elf em=lynx ;; | ||
i386-*-sysv[45]*) fmt=elf ;; | ||
i386-*-solaris*) fmt=elf em=solaris ;; | ||
diff -rupN binutils/ld/configure.tgt binutils-redox/ld/configure.tgt | ||
--- binutils/ld/configure.tgt 2014-10-14 00:32:04.000000000 -0700 | ||
+++ binutils-redox/ld/configure.tgt 2016-07-26 08:45:31.210878318 -0700 | ||
@@ -249,6 +249,9 @@ x86_64-*-linux-*) targ_emul=elf_x86_64 | ||
targ_extra_libpath="elf_i386 elf32_x86_64 elf_l1om elf_k1om" | ||
tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'` | ||
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;; | ||
+i[3-7]86-*-redox*) targ_emul=elf_i386 ;; | ||
+x86_64-*-redox*) targ_emul=elf_x86_64 | ||
+ targ_extra_emuls=elf_i386 ;; | ||
i[3-7]86-*-sysv[45]*) targ_emul=elf_i386 ;; | ||
i[3-7]86-*-solaris2*) targ_emul=elf_i386_sol2 | ||
targ_extra_emuls="elf_i386_ldso elf_i386 elf_x86_64_sol2 elf_x86_64 elf_l1om elf_k1om" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
diff -rupN gcc/config.sub gcc-redox/config.sub | ||
--- gcc/config.sub 2010-05-25 06:22:07.000000000 -0700 | ||
+++ gcc-redox/config.sub 2016-07-27 10:20:38.442230579 -0700 | ||
@@ -1309,7 +1309,7 @@ case $os in | ||
| -chorusos* | -chorusrdb* | -cegcc* \ | ||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | ||
| -mingw32* | -linux-gnu* | -linux-android* \ | ||
- | -linux-newlib* | -linux-uclibc* \ | ||
+ | -linux-newlib* | -linux-uclibc* | -redox* \ | ||
| -uxpv* | -beos* | -mpeix* | -udk* \ | ||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | ||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | ||
diff -rupN gcc/fixincludes/mkfixinc.sh gcc-redox/fixincludes/mkfixinc.sh | ||
--- gcc/fixincludes/mkfixinc.sh 2010-03-28 09:40:50.000000000 -0700 | ||
+++ gcc-redox/fixincludes/mkfixinc.sh 2016-07-27 10:20:38.445563930 -0700 | ||
@@ -15,6 +15,8 @@ case $machine in | ||
i?86-moss-msdos* | \ | ||
i?86-*-pe | \ | ||
i?86-*-cygwin* | \ | ||
+ i?86-*-redox* | \ | ||
+ x86_64-*-redox* | \ | ||
i?86-*-mingw32* | \ | ||
x86_64-*-mingw32* | \ | ||
i?86-*-interix* | \ | ||
diff -rupN gcc/gcc/config/redox.h gcc-redox/gcc/config/redox.h | ||
--- gcc/gcc/config/redox.h 1969-12-31 16:00:00.000000000 -0800 | ||
+++ gcc-redox/gcc/config/redox.h 2016-07-27 10:20:38.445563930 -0700 | ||
@@ -0,0 +1,17 @@ | ||
+#undef TARGET_REDOX | ||
+#define TARGET_REDOX 1 | ||
+ | ||
+#define LIB_SPEC "-lc -lg -lm" | ||
+ | ||
+#undef NO_IMPLICIT_EXTERN_C | ||
+#define NO_IMPLICIT_EXTERN_C 1 | ||
+ | ||
+#undef TARGET_OS_CPP_BUILTINS | ||
+#define TARGET_OS_CPP_BUILTINS() \ | ||
+ do { \ | ||
+ builtin_define ("__redox__"); \ | ||
+ builtin_define ("__unix__"); \ | ||
+ builtin_assert ("system=redox"); \ | ||
+ builtin_assert ("system=unix"); \ | ||
+ builtin_assert ("system=posix"); \ | ||
+ } while(0); | ||
diff -rupN gcc/gcc/config.gcc gcc-redox/gcc/config.gcc | ||
--- gcc/gcc/config.gcc 2013-03-06 09:40:07.000000000 -0800 | ||
+++ gcc-redox/gcc/config.gcc 2016-07-27 10:20:38.445563930 -0700 | ||
@@ -617,6 +617,11 @@ case ${target} in | ||
;; | ||
esac | ||
;; | ||
+*-*-redox*) | ||
+ gas=yes | ||
+ gnu_ld=yes | ||
+ default_use_cxa_atexit=yes | ||
+ ;; | ||
*-*-netbsd*) | ||
tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic" | ||
gas=yes | ||
@@ -1316,6 +1321,12 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | ||
esac | ||
tmake_file="${tmake_file} i386/t-linux64 i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules" | ||
;; | ||
+i[34567]86-*-redox*) | ||
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h redox.h" | ||
+ ;; | ||
+x86_64-*-redox*) | ||
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h redox.h" | ||
+ ;; | ||
i[34567]86-pc-msdosdjgpp*) | ||
xm_file=i386/xm-djgpp.h | ||
tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h i386/djgpp-stdint.h" | ||
diff -rupN gcc/gcc/cp/cfns.h gcc-redox/gcc/cp/cfns.h | ||
--- gcc/gcc/cp/cfns.h 2009-04-21 12:03:23.000000000 -0700 | ||
+++ gcc-redox/gcc/cp/cfns.h 2016-07-27 10:20:38.445563930 -0700 | ||
@@ -53,6 +53,9 @@ __inline | ||
static unsigned int hash (const char *, unsigned int); | ||
#ifdef __GNUC__ | ||
__inline | ||
+#ifdef __GNUC_STDC_INLINE__ | ||
+__attribute__ ((__gnu_inline__)) | ||
+#endif | ||
#endif | ||
const char * libc_name_p (const char *, unsigned int); | ||
/* maximum key range = 391, duplicates = 0 */ | ||
@@ -96,7 +99,7 @@ hash (register const char *str, register | ||
400, 400, 400, 400, 400, 400, 400, 400, 400, 400, | ||
400, 400, 400, 400, 400, 400, 400 | ||
}; | ||
- register int hval = len; | ||
+ register int hval = (int)len; | ||
|
||
switch (hval) | ||
{ | ||
diff -rupN gcc/libgcc/config.host gcc-redox/libgcc/config.host | ||
--- gcc/libgcc/config.host 2011-11-23 14:15:54.000000000 -0800 | ||
+++ gcc-redox/libgcc/config.host 2016-07-27 10:20:38.445563930 -0700 | ||
@@ -296,6 +296,14 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | ||
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" | ||
tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm" | ||
;; | ||
+i[34567]86-*-redox*) | ||
+ extra_parts="$extra_parts crtbegin.o crtend.o" | ||
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" | ||
+ ;; | ||
+x86_64-*-redox*) | ||
+ extra_parts="$extra_parts crtbegin.o crtend.o" | ||
+ tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" | ||
+ ;; | ||
i[34567]86-pc-msdosdjgpp*) | ||
;; | ||
i[34567]86-*-lynxos*) | ||
diff -rupN gcc/libstdc++-v3/crossconfig.m4 gcc-redox/libstdc++-v3/crossconfig.m4 | ||
--- gcc/libstdc++-v3/crossconfig.m4 2011-02-03 23:26:57.000000000 -0800 | ||
+++ gcc-redox/libstdc++-v3/crossconfig.m4 2016-07-27 10:20:38.445563930 -0700 | ||
@@ -150,6 +150,12 @@ case "${host}" in | ||
GCC_CHECK_TLS | ||
AM_ICONV | ||
;; | ||
+ *-redox*) | ||
+ GLIBCXX_CHECK_COMPILER_FEATURES | ||
+ GLIBCXX_CHECK_LINKER_FEATURES | ||
+ GLIBCXX_CHECK_MATH_SUPPORT | ||
+ GLIBCXX_CHECK_STDLIB_SUPPORT | ||
+ ;; | ||
*-mingw32*) | ||
GLIBCXX_CHECK_LINKER_FEATURES | ||
GLIBCXX_CHECK_MATH_SUPPORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
AUTOMAKE_OPTIONS = cygnus | ||
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) | ||
AM_CCASFLAGS = $(INCLUDES) | ||
|
||
noinst_LIBRARIES = lib.a | ||
|
||
if MAY_SUPPLY_SYSCALLS | ||
extra_objs = \ | ||
common.o \ | ||
file.o \ | ||
folder.o \ | ||
process.o \ | ||
time.o \ | ||
unimpl.o | ||
else | ||
extra_objs = | ||
endif | ||
|
||
lib_a_SOURCES = | ||
lib_a_LIBADD = $(extra_objs) | ||
EXTRA_lib_a_SOURCES = \ | ||
common.c \ | ||
file.c \ | ||
folder.c \ | ||
process.c \ | ||
time.c \ | ||
unimpl.c \ | ||
crt0.c | ||
lib_a_DEPENDENCIES = $(extra_objs) | ||
lib_a_CCASFLAGS = $(AM_CCASFLAGS) | ||
lib_a_CFLAGS = $(AM_CFLAGS) | ||
|
||
if MAY_SUPPLY_SYSCALLS | ||
all: crt0.o | ||
endif | ||
|
||
ACLOCAL_AMFLAGS = -I ../../.. | ||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host | ||
|
||
include $(srcdir)/../../../Makefile.shared | ||
|
||
install-data-local: | ||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \ | ||
for i in $(srcdir)/include/arpa/*.h; do \ | ||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \ | ||
done; \ | ||
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \ | ||
for i in $(srcdir)/include/netinet/*.h; do \ | ||
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \ | ||
done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "common.h" | ||
|
||
extern int errno; | ||
|
||
#define demux(a) { \ | ||
if(a >= (uint)(-4096)){ \ | ||
errno = -(int)a; \ | ||
a = (uint)-1; \ | ||
} \ | ||
return (int)a; \ | ||
} | ||
|
||
int syscall0(uint a){ | ||
asm volatile("int $0x80" | ||
: "=a"(a) | ||
: "a"(a) | ||
: "memory"); | ||
|
||
demux(a) | ||
} | ||
|
||
int syscall1(uint a, uint b){ | ||
asm volatile("int $0x80" | ||
: "=a"(a) | ||
: "a"(a), "b"(b) | ||
: "memory"); | ||
|
||
demux(a) | ||
} | ||
|
||
int syscall2(uint a, uint b, uint c){ | ||
asm volatile("int $0x80" | ||
: "=a"(a) | ||
: "a"(a), "b"(b), "c"(c) | ||
: "memory"); | ||
|
||
demux(a) | ||
} | ||
|
||
int syscall3(uint a, uint b, uint c, uint d){ | ||
asm volatile("int $0x80" | ||
: "=a"(a) | ||
: "a"(a), "b"(b), "c"(c), "d"(d) | ||
: "memory"); | ||
|
||
demux(a) | ||
} | ||
|
||
int syscall4(uint a, uint b, uint c, uint d, uint e){ | ||
asm volatile("int $0x80" | ||
: "=a"(a) | ||
: "a"(a), "b"(b), "c"(c), "d"(d), "S"(e) | ||
: "memory"); | ||
|
||
demux(a) | ||
} | ||
|
||
int syscall5(uint a, uint b, uint c, uint d, uint e, uint f){ | ||
asm volatile("int $0x80" | ||
: "=a"(a) | ||
: "a"(a), "b"(b), "c"(c), "d"(d), "S"(e), "D"(f) | ||
: "memory"); | ||
|
||
demux(a) | ||
} |
Oops, something went wrong.