This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed, config/cris/cris.h config/cris/aout.h: match submittednewlib+libgloss port, fix bugs


These changes match the just-submitted newlib+libgloss port and also
fixes some old bugs.  The previous definitions were in most cases
wrong; for example the lack of crti.o and crtn.o in the ELF port
depended on an old version of the linker script that emitted "PUSH
SRP" and "JUMP [SP+]" sequences in .init and .fini, respectively.
(The aout script still does, but that's to support linking in ELF
files; aout has its ctor/dtor machinery invoked from __main.)  The
alignment definitions in cris.h tripped over the aout
MAX_OFILE_ALIGNMENT during compilation and more so in the test-suite,
and besides it was wrong (only true in prehistorical binutils; before
the CRIS port was submitted).  As a nice but certainly intended
effect, this paves the way for Standardized Simulator Testing for
cris-*-{aout,elf}.  Can't be bad.

	* config/cris/cris.h (LIB_SPEC) <sim*>: Use -lsyslinux, not
	-lsyssim.  Wrap -lc -lsyssim in --start-group --end-group instead
	of doubling.
	(STARTFILE_SPEC): Add crti.o, before crtbegin.o.
 	<sim*>: Always use crt1.o, regardless of N in simN.
	<!sim>: Drop support for -pg and -p variants; always use crt0.o.
	(ENDFILE_SPEC): Add crtn.o, after crtend.o.
	(CRT_CALL_STATIC_FUNCTION): Remove.
	* config/cris/aout.h (STARTFILE_SPEC): <!melinux && sim*>: Always
	use crt1.o, regardless of N in simN.
	<!sim>: Drop support for -pg and -p variants; always use crt0.o.
	(LIB_SPEC): Do not define; default to the one in config/cris/cris.h.
	(CRIS_CPP_SUBTARGET_SPEC) <melinux && !nostdinc>: Remove special
	case isystem setting.
	(MAX_OFILE_ALIGNMENT): Correct to 32, not 16.

Index: aout.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/aout.h,v
retrieving revision 1.14
diff -c -p -r1.14 aout.h
*** aout.h	17 Oct 2004 18:09:37 -0000	1.14
--- aout.h	26 Jan 2005 01:50:37 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 41,77 ****
  #undef STARTFILE_SPEC
  #define STARTFILE_SPEC \
   "%{melinux:crt0.o%s}\
!   %{!melinux:\
!    %{sim2:s2crt0.o%s}\
!    %{!sim2:\
!     %{sim:scrt0.o%s}\
!     %{!sim:%{pg:gcrt0.o%s}\
!      %{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}}"

  /* Override cris.h define.  */
  #undef ENDFILE_SPEC

- /* Which library to get.  The only difference from the default is to get
-    libsc.a if -sim is given to the driver.  Repeat -lc -lsysX
-    {X=sim,linux}, because libsysX needs (at least) errno from libc, and
-    then we want to resolve new unknowns in libc against libsysX, not
-    libnosys.  Assume everything is in libc for -mlinux.  */
- #undef LIB_SPEC
- #define LIB_SPEC \
-  "%{melinux:-lc -lsyslinux -lc -lsyslinux -lic}\
-   %{!melinux:\
-    %{sim*:-lc -lsyssim -lc -lsyssim}\
-    %{!sim*:%{g*:-lg}\
-      %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\
-    -lnosys}"
-
  #undef CRIS_CPP_SUBTARGET_SPEC
  #define CRIS_CPP_SUBTARGET_SPEC \
   "%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
-     %{!nostdinc:\
-       %{!mbest-lib-options:%{isystem*}}\
-       -isystem elinux/include%s\
-       %{mbest-lib-options:%{isystem*}}}\
      %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
    %{mbest-lib-options:\
     %{!moverride-best-lib-options:\
--- 41,54 ----
  #undef STARTFILE_SPEC
  #define STARTFILE_SPEC \
   "%{melinux:crt0.o%s}\
!   %{!melinux:%{sim*:crt1.o%s}%{!sim*:crt0.o%s}}"

  /* Override cris.h define.  */
  #undef ENDFILE_SPEC

  #undef CRIS_CPP_SUBTARGET_SPEC
  #define CRIS_CPP_SUBTARGET_SPEC \
   "%{melinux:-D__gnu_linux__ -D__linux__ -D__unix__ -D__elinux__ -D__uclinux__\
      %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix -Delinux -Duclinux}}}}\
    %{mbest-lib-options:\
     %{!moverride-best-lib-options:\
*************** Boston, MA 02111-1307, USA.  */
*** 135,142 ****

  /* Node: Storage Layout */

! /* We can align to 16 bits (only) with CRIS a.out.  */
! #define MAX_OFILE_ALIGNMENT 16


  /* Node: Data Output */
--- 112,119 ----

  /* Node: Storage Layout */

! /* All sections but the .bss is rounded up to a 4-byte multiple size.  */
! #define MAX_OFILE_ALIGNMENT 32


  /* Node: Data Output */
Index: cris.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.h,v
retrieving revision 1.80
diff -c -p -r1.80 cris.h
*** cris.h	30 Dec 2004 03:07:45 -0000	1.80
--- cris.h	26 Jan 2005 01:50:37 -0000
*************** extern const char *cris_elinux_stacksize
*** 210,244 ****
    %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
    %{!r:%{O2|O3: --gc-sections}}"

! /* Which library to get.  The only difference from the default is to get
!    libsc.a if -sim is given to the driver.  Repeat -lc -lsysX
!    {X=sim,linux}, because libsysX needs (at least) errno from libc, and
!    then we want to resolve new unknowns in libc against libsysX, not
!    libnosys.  */
  /* Override previous definitions (linux.h).  */
  #undef LIB_SPEC
  #define LIB_SPEC \
!  "%{sim*:-lc -lsyssim -lc -lsyssim}\
    %{!sim*:%{g*:-lg}\
      %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\
    -lnosys"

  /* Linker startfile options; crt0 flavors.
!
!    At the moment there are no gcrt0.o or mcrt0.o, but keep them here and
!    link them to crt0.o to be prepared.  Use scrt0.c if running the
!    simulator, linear style, or s2crt0.c if fixed style.  */
! /* We need to remove any previous definition (elfos.h).  */
  #undef STARTFILE_SPEC
  #define STARTFILE_SPEC \
!  "%{sim2:s2crt0.o%s}\
!   %{!sim2:%{sim:scrt0.o%s}\
!    %{!sim:%{pg:gcrt0.o%s}\
!     %{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
!   crtbegin.o%s"

  #undef ENDFILE_SPEC
! #define ENDFILE_SPEC "crtend.o%s"

  #define EXTRA_SPECS				\
    {"cpp_subtarget", CRIS_CPP_SUBTARGET_SPEC},	\
--- 210,236 ----
    %{sim2:%{!T*:-Tdata 0x4000000 -Tbss 0x8000000}}\
    %{!r:%{O2|O3: --gc-sections}}"

! /* Which library to get.  The simulator uses a different library for
!    the low-level syscalls (implementing the Linux syscall ABI instead
!    of direct-iron accesses).  Default everything with the stub "nosys"
!    library.  */
  /* Override previous definitions (linux.h).  */
  #undef LIB_SPEC
  #define LIB_SPEC \
!  "%{sim*:--start-group -lc -lsyslinux --end-group}\
    %{!sim*:%{g*:-lg}\
      %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} -lbsp}\
    -lnosys"

  /* Linker startfile options; crt0 flavors.
!    We need to remove any previous definition (elfos.h).  */
  #undef STARTFILE_SPEC
  #define STARTFILE_SPEC \
!  "%{sim*:crt1.o%s}%{!sim*:crt0.o%s}\
!   crti.o%s crtbegin.o%s"

  #undef ENDFILE_SPEC
! #define ENDFILE_SPEC "crtend.o%s crtn.o%s"

  #define EXTRA_SPECS				\
    {"cpp_subtarget", CRIS_CPP_SUBTARGET_SPEC},	\
*************** struct cum_args {int regs;};
*** 1335,1361 ****
  /* The jump table is immediately connected to the preceding insn.  */
  #define JUMP_TABLES_IN_TEXT_SECTION 1

- /* We pull a little trick to register the _fini function with atexit,
-    after (presumably) registering the eh frame info, since we don't handle
-    _fini (a.k.a. ___fini_start) in crt0 or have a crti for "pure" ELF.  If
-    you change this, don't forget that you can't have library function
-    references (e.g. to atexit) in crtend.o, since those won't be resolved
-    to libraries; those are linked in *before* crtend.o.  */
- #ifdef CRT_BEGIN
- # define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)		\
- static void __attribute__((__used__))				\
- call_ ## FUNC (void)						\
- {								\
-   asm (SECTION_OP);						\
-   FUNC ();							\
-   if (__builtin_strcmp (#FUNC, "frame_dummy") == 0)		\
-    {								\
-      extern void __fini__start (void);				\
-      atexit (__fini__start);					\
-    }								\
-   asm (TEXT_SECTION_ASM_OP);					\
- }
- #endif

  /* Node: PIC */

--- 1327,1332 ----

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]