📄 900-nios2.patch
字号:
--- gcc-3.4.3/gcc/Makefile.in+++ gcc-3.4.3-nios2/gcc/Makefile.in@@ -3085,7 +3085,7 @@ install-mkheaders: stmp-int-hdrs $(STMP_ $(INSTALL_DATA) $(srcdir)/README-fixinc \ $(DESTDIR)$(itoolsdatadir)/include/README ; \ $(INSTALL_SCRIPT) fixinc.sh $(DESTDIR)$(itoolsdir)/fixinc.sh ; \- $(INSTALL_PROGRAM) fixinc/fixincl $(DESTDIR)$(itoolsdir)/fixincl ; \+ $(INSTALL_PROGRAM) fixinc/fixincl$(build_exeext) $(DESTDIR)$(itoolsdir)/fixincl$(build_exeext) ; \ $(INSTALL_DATA) $(srcdir)/gsyslimits.h \ $(DESTDIR)$(itoolsdatadir)/gsyslimits.h ; \ else :; fi--- gcc-3.4.3/gcc/combine.c+++ gcc-3.4.3-nios2/gcc/combine.c@@ -4380,6 +4380,14 @@ combine_simplify_rtx (rtx x, enum machin mode); } +#ifndef __nios2__+/* This screws up Nios II in this test case:++if (x & 1)+ return 2;+else+ return 3;+*/ else if (STORE_FLAG_VALUE == 1 && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT && op1 == const0_rtx@@ -4391,6 +4399,7 @@ combine_simplify_rtx (rtx x, enum machin gen_lowpart_for_combine (mode, op0), const1_rtx); }+#endif else if (STORE_FLAG_VALUE == 1 && new_code == EQ && GET_MODE_CLASS (mode) == MODE_INT--- gcc-3.4.3/gcc/config/nios2/crti.asm+++ gcc-3.4.3-nios2/gcc/config/nios2/crti.asm@@ -0,0 +1,88 @@+/*+ Copyright (C) 2003 + by Jonah Graham (jgraham@altera.com)++This file is free software; you can redistribute it and/or modify it+under the terms of the GNU General Public License as published by the+Free Software Foundation; either version 2, or (at your option) any+later version.++In addition to the permissions in the GNU General Public License, the+Free Software Foundation gives you unlimited permission to link the+compiled version of this file with other programs, and to distribute+those programs without any restriction coming from the use of this+file. (The General Public License restrictions do apply in other+respects; for example, they cover modification of the file, and+distribution when not linked into another program.)++This file is distributed in the hope that it will be useful, but+WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; see the file COPYING. If not, write to+the Free Software Foundation, 59 Temple Place - Suite 330,+Boston, MA 02111-1307, USA.++ As a special exception, if you link this library with files+ compiled with GCC to produce an executable, this does not cause+ the resulting executable to be covered by the GNU General Public License.+ This exception does not however invalidate any other reasons why+ the executable file might be covered by the GNU General Public License.+++This file just make a stack frame for the contents of the .fini and+.init sections. Users may put any desired instructions in those+sections.+++While technically any code can be put in the init and fini sections+most stuff will not work other than stuff which obeys the call frame+and ABI. All the call-preserved registers are saved, the call clobbered+registers should have been saved by the code calling init and fini.++See crtstuff.c for an example of code that inserts itself in the +init and fini sections. ++See crt0.s for the code that calls init and fini.+*/++ .file "crti.asm"++ .section ".init"+ .align 2+ .global _init+_init:+ addi sp, sp, -48+ stw ra, 44(sp)+ stw r23, 40(sp)+ stw r22, 36(sp)+ stw r21, 32(sp)+ stw r20, 28(sp)+ stw r19, 24(sp)+ stw r18, 20(sp)+ stw r17, 16(sp)+ stw r16, 12(sp)+ stw fp, 8(sp)+ mov fp, sp+ + + .section ".fini"+ .align 2+ .global _fini+_fini:+ addi sp, sp, -48+ stw ra, 44(sp)+ stw r23, 40(sp)+ stw r22, 36(sp)+ stw r21, 32(sp)+ stw r20, 28(sp)+ stw r19, 24(sp)+ stw r18, 20(sp)+ stw r17, 16(sp)+ stw r16, 12(sp)+ stw fp, 8(sp)+ mov fp, sp+ +--- gcc-3.4.3/gcc/config/nios2/crtn.asm+++ gcc-3.4.3-nios2/gcc/config/nios2/crtn.asm@@ -0,0 +1,70 @@+/*+ Copyright (C) 2003 + by Jonah Graham (jgraham@altera.com)++This file is free software; you can redistribute it and/or modify it+under the terms of the GNU General Public License as published by the+Free Software Foundation; either version 2, or (at your option) any+later version.++In addition to the permissions in the GNU General Public License, the+Free Software Foundation gives you unlimited permission to link the+compiled version of this file with other programs, and to distribute+those programs without any restriction coming from the use of this+file. (The General Public License restrictions do apply in other+respects; for example, they cover modification of the file, and+distribution when not linked into another program.)++This file is distributed in the hope that it will be useful, but+WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; see the file COPYING. If not, write to+the Free Software Foundation, 59 Temple Place - Suite 330,+Boston, MA 02111-1307, USA.++ As a special exception, if you link this library with files+ compiled with GCC to produce an executable, this does not cause+ the resulting executable to be covered by the GNU General Public License.+ This exception does not however invalidate any other reasons why+ the executable file might be covered by the GNU General Public License.+++This file just makes sure that the .fini and .init sections do in+fact return. Users may put any desired instructions in those sections.+This file is the last thing linked into any executable.+*/ + .file "crtn.asm"++++ .section ".init"+ ldw ra, 44(sp)+ ldw r23, 40(sp)+ ldw r22, 36(sp)+ ldw r21, 32(sp)+ ldw r20, 28(sp)+ ldw r19, 24(sp)+ ldw r18, 20(sp)+ ldw r17, 16(sp)+ ldw r16, 12(sp)+ ldw fp, 8(sp)+ addi sp, sp, -48+ ret+ + .section ".fini"+ ldw ra, 44(sp)+ ldw r23, 40(sp)+ ldw r22, 36(sp)+ ldw r21, 32(sp)+ ldw r20, 28(sp)+ ldw r19, 24(sp)+ ldw r18, 20(sp)+ ldw r17, 16(sp)+ ldw r16, 12(sp)+ ldw fp, 8(sp)+ addi sp, sp, -48+ ret+ --- gcc-3.4.3/gcc/config/nios2/lib2-divmod-hi.c+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divmod-hi.c@@ -0,0 +1,123 @@++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is+ supposedly valid even though this is a "target" file. */+#include "auto-host.h"+++#include "tconfig.h"+#include "tsystem.h"+#include "coretypes.h"+#include "tm.h"+++/* Don't use `fancy_abort' here even if config.h says to use it. */+#ifdef abort+#undef abort+#endif+++#ifdef HAVE_GAS_HIDDEN+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))+#else+#define ATTRIBUTE_HIDDEN+#endif++#include "libgcc2.h"++extern HItype __modhi3 (HItype, HItype);+extern HItype __divhi3 (HItype, HItype);+extern HItype __umodhi3 (HItype, HItype);+extern HItype __udivhi3 (HItype, HItype);++static UHItype udivmodhi4(UHItype, UHItype, word_type);++static UHItype+udivmodhi4(UHItype num, UHItype den, word_type modwanted)+{+ UHItype bit = 1;+ UHItype res = 0;++ while (den < num && bit && !(den & (1L<<15)))+ {+ den <<=1;+ bit <<=1;+ }+ while (bit)+ {+ if (num >= den)+ {+ num -= den;+ res |= bit;+ }+ bit >>=1;+ den >>=1;+ }+ if (modwanted) return num;+ return res;+}+++HItype+__divhi3 (HItype a, HItype b)+{+ word_type neg = 0;+ HItype res;++ if (a < 0)+ {+ a = -a;+ neg = !neg;+ }++ if (b < 0)+ {+ b = -b;+ neg = !neg;+ }++ res = udivmodhi4 (a, b, 0);++ if (neg)+ res = -res;++ return res;+}+++HItype+__modhi3 (HItype a, HItype b)+{+ word_type neg = 0;+ HItype res;++ if (a < 0)+ {+ a = -a;+ neg = 1;+ }++ if (b < 0)+ b = -b;++ res = udivmodhi4 (a, b, 1);++ if (neg)+ res = -res;++ return res;+}+++HItype+__udivhi3 (HItype a, HItype b)+{+ return udivmodhi4 (a, b, 0);+}+++HItype+__umodhi3 (HItype a, HItype b)+{+ return udivmodhi4 (a, b, 1);+}+--- gcc-3.4.3/gcc/config/nios2/lib2-divmod.c+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divmod.c@@ -0,0 +1,126 @@++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is+ supposedly valid even though this is a "target" file. */+#include "auto-host.h"+++#include "tconfig.h"+#include "tsystem.h"+#include "coretypes.h"+#include "tm.h"+++/* Don't use `fancy_abort' here even if config.h says to use it. */+#ifdef abort+#undef abort+#endif+++#ifdef HAVE_GAS_HIDDEN+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))+#else+#define ATTRIBUTE_HIDDEN+#endif++#include "libgcc2.h"++extern SItype __modsi3 (SItype, SItype);+extern SItype __divsi3 (SItype, SItype);+extern SItype __umodsi3 (SItype, SItype);+extern SItype __udivsi3 (SItype, SItype);++static USItype udivmodsi4(USItype, USItype, word_type);++/* 16-bit SI divide and modulo as used in NIOS */+++static USItype+udivmodsi4(USItype num, USItype den, word_type modwanted)+{+ USItype bit = 1;+ USItype res = 0;++ while (den < num && bit && !(den & (1L<<31)))+ {+ den <<=1;+ bit <<=1;+ }+ while (bit)+ {+ if (num >= den)+ {+ num -= den;+ res |= bit;+ }+ bit >>=1;+ den >>=1;+ }+ if (modwanted) return num;+ return res;+}+++SItype+__divsi3 (SItype a, SItype b)+{+ word_type neg = 0;+ SItype res;++ if (a < 0)+ {+ a = -a;+ neg = !neg;+ }++ if (b < 0)+ {+ b = -b;+ neg = !neg;+ }++ res = udivmodsi4 (a, b, 0);++ if (neg)+ res = -res;++ return res;+}+++SItype+__modsi3 (SItype a, SItype b)+{+ word_type neg = 0;+ SItype res;++ if (a < 0)+ {+ a = -a;+ neg = 1;+ }++ if (b < 0)+ b = -b;++ res = udivmodsi4 (a, b, 1);++ if (neg)+ res = -res;++ return res;+}+++SItype+__udivsi3 (SItype a, SItype b)+{+ return udivmodsi4 (a, b, 0);+}+++SItype+__umodsi3 (SItype a, SItype b)+{+ return udivmodsi4 (a, b, 1);+}+--- gcc-3.4.3/gcc/config/nios2/lib2-divtable.c+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-divtable.c@@ -0,0 +1,46 @@++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is+ supposedly valid even though this is a "target" file. */+#include "auto-host.h"+++#include "tconfig.h"+#include "tsystem.h"+#include "coretypes.h"+#include "tm.h"+++/* Don't use `fancy_abort' here even if config.h says to use it. */+#ifdef abort+#undef abort+#endif+++#ifdef HAVE_GAS_HIDDEN+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))+#else+#define ATTRIBUTE_HIDDEN+#endif++#include "libgcc2.h"++UQItype __divsi3_table[] =+{+ 0, 0/1, 0/2, 0/3, 0/4, 0/5, 0/6, 0/7, 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14, 0/15,+ 0, 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, 1/13, 1/14, 1/15,+ 0, 2/1, 2/2, 2/3, 2/4, 2/5, 2/6, 2/7, 2/8, 2/9, 2/10, 2/11, 2/12, 2/13, 2/14, 2/15,+ 0, 3/1, 3/2, 3/3, 3/4, 3/5, 3/6, 3/7, 3/8, 3/9, 3/10, 3/11, 3/12, 3/13, 3/14, 3/15,+ 0, 4/1, 4/2, 4/3, 4/4, 4/5, 4/6, 4/7, 4/8, 4/9, 4/10, 4/11, 4/12, 4/13, 4/14, 4/15,+ 0, 5/1, 5/2, 5/3, 5/4, 5/5, 5/6, 5/7, 5/8, 5/9, 5/10, 5/11, 5/12, 5/13, 5/14, 5/15,+ 0, 6/1, 6/2, 6/3, 6/4, 6/5, 6/6, 6/7, 6/8, 6/9, 6/10, 6/11, 6/12, 6/13, 6/14, 6/15,+ 0, 7/1, 7/2, 7/3, 7/4, 7/5, 7/6, 7/7, 7/8, 7/9, 7/10, 7/11, 7/12, 7/13, 7/14, 7/15,+ 0, 8/1, 8/2, 8/3, 8/4, 8/5, 8/6, 8/7, 8/8, 8/9, 8/10, 8/11, 8/12, 8/13, 8/14, 8/15,+ 0, 9/1, 9/2, 9/3, 9/4, 9/5, 9/6, 9/7, 9/8, 9/9, 9/10, 9/11, 9/12, 9/13, 9/14, 9/15,+ 0, 10/1, 10/2, 10/3, 10/4, 10/5, 10/6, 10/7, 10/8, 10/9, 10/10, 10/11, 10/12, 10/13, 10/14, 10/15,+ 0, 11/1, 11/2, 11/3, 11/4, 11/5, 11/6, 11/7, 11/8, 11/9, 11/10, 11/11, 11/12, 11/13, 11/14, 11/15,+ 0, 12/1, 12/2, 12/3, 12/4, 12/5, 12/6, 12/7, 12/8, 12/9, 12/10, 12/11, 12/12, 12/13, 12/14, 12/15,+ 0, 13/1, 13/2, 13/3, 13/4, 13/5, 13/6, 13/7, 13/8, 13/9, 13/10, 13/11, 13/12, 13/13, 13/14, 13/15,+ 0, 14/1, 14/2, 14/3, 14/4, 14/5, 14/6, 14/7, 14/8, 14/9, 14/10, 14/11, 14/12, 14/13, 14/14, 14/15,+ 0, 15/1, 15/2, 15/3, 15/4, 15/5, 15/6, 15/7, 15/8, 15/9, 15/10, 15/11, 15/12, 15/13, 15/14, 15/15,+};+--- gcc-3.4.3/gcc/config/nios2/lib2-mul.c+++ gcc-3.4.3-nios2/gcc/config/nios2/lib2-mul.c@@ -0,0 +1,103 @@+/* while we are debugging (ie compile outside of gcc build) + disable gcc specific headers */+#ifndef DEBUG_MULSI3+++/* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is+ supposedly valid even though this is a "target" file. */+#include "auto-host.h"+++#include "tconfig.h"+#include "tsystem.h"+#include "coretypes.h"+#include "tm.h"+++/* Don't use `fancy_abort' here even if config.h says to use it. */+#ifdef abort+#undef abort+#endif+++#ifdef HAVE_GAS_HIDDEN+#define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -