🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52138

GNU C lib for Sony

#52138
From: Michael Werner
Date: Mon, 08 Feb 1993 07:40
112 lines
4143 bytes
I am attempting to port GNU C library to Sony NEWS RISC 3410. 
However, I have a problem with the startup code to replace crt0.o 
(at least I think that is where the problem is).

The program to demonstrate this is the following:

#include <ansidecl.h>
#include <stdio.h>
#include <stdlib.h>

int
DEFUN(main, (argc, argv), int argc AND char **argv)
{
  printf("argc equals %d\n",argc);
}

This is compiled using 
make test_arg.o ; gcc -nostdlib start.o test_arg.o -o test_arg libc.a -lgcc libc.a

in the base directory gcc-1.05/

The output is "argc equals 0"

The startup code used is taken from 
glibc-1.05/sysdeps/unix/bsd/ultrix4/mips/start.c which was written by
Brendan Kehoe and Ian Lance Taylor.
I have made no modifications as I don't know enough to change it.
Following is the startup code start.c

/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

The GNU C Library 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
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB.  If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.  */

#include <ansidecl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>

#ifndef	__GNUC__
  #error This file uses GNU C extensions; you must compile with GCC.
#endif

/* The first piece of initialized data.  */
int __data_start = 0;

VOLATILE int errno = 0;

#ifndef	HAVE_GNU_LD
#undef	environ
#define	__environ	environ
#endif

char **__environ;

extern void EXFUN(__libc_init, (int argc, char **argv, char **envp));
extern int EXFUN(main, (int argc, char **argv, char **envp));

/* Use the frame pointer to access the arguments.  This assumes that
   the function was not compiled with -fno-frame-pointer.  */
register long int fp asm("fp");

void
DEFUN_VOID(__start)
{
  int argc;
  char **argv, **envp;

  /* Set up the global pointer.  */
  asm volatile ("la $28,_gp");
  argc = ((int *) fp)[0];
  argv = (char **) &((int *) fp)[1];
  envp = &argv[argc + 1];
  __environ = envp;

  __libc_init (argc, argv, envp);
  errno = 0;
  exit (main (argc, argv, envp));
}

Has anyone any idea about what is going on?


-- 
Yours,

Mike

----------------------------------------------------------------------------
+                                                                          +
+    *		  *			Michael Werner		           +
+     *		 *	    		werner@dirac.physics.uq.oz.au      +
+      * 	*			Theoretical Quantum Optics,        + 
+       -------		                Department of Physics,             +
+      *       *                        University of Queensland.          +
+     *		*			St. Lucia. 4072. Australia         +
+    *           *                                                         +
+                                                                          +   
---------------------------------------------------------------------------- 
Technical Details
Message-ID: <C24DC4.C1y@bunyip.cc.uq.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!dirac.physics.uq.oz.au!werner

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,2d34f89cd697cba1,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-02-07 23:40:51 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!dirac.physics.uq.oz.au!werner
From: werner@physics.uq.oz.au (Michael Werner)
Subject: GNU C lib for Sony 
Message-ID: <C24DC4.C1y@bunyip.cc.uq.oz.au>
Sender: news@bunyip.cc.uq.oz.au (USENET News System)
Reply-To: werner@dirac.physics.uq.oz.au
Organization: Department of Physics, University of Queensland
Date: Mon, 8 Feb 1993 07:40:51 GMT
Lines: 112