Subject: Re: Linking...
To: Leslie Todd Masco <cactus@hks.net>
From: Ted Lemon <mellon@vix.com>
List: port-pmax
Date: 05/03/1995 15:15:56
Oh yeah. That's because __progname is being put in the wrong
section. I've checked in the fix. The patch is included below for
your edification...
_MelloN_
Index: crt0.S
===================================================================
RCS file: /a/cvsroot/src/lib/csu/mips/crt0.S,v
retrieving revision 1.3
retrieving revision 1.4
diff -c -r1.3 -r1.4
*** crt0.S 1994/12/15 17:04:55 1.3
--- crt0.S 1995/05/03 22:13:15 1.4
***************
*** 34,57 ****
* SUCH DAMAGE.
*
* from: @(#)crt0.s 8.2 (Berkeley) 3/21/94
! * $Id: crt0.S,v 1.3 1994/12/15 17:04:55 mycroft Exp $
*/
#include <machine/regdef.h>
#include <machine/machAsmDefs.h>
- .data
.comm _C_LABEL(environ), 4
! .align 2
! .globl _C_LABEL(__progname)
! _C_LABEL(__progname):
! .word $L1
$L1:
.word 0 # null string plus padding
.text
NON_LEAF(start, 24, ra)
.set noreorder
lw s0, 0(sp) # get argc from stack
addu s1, sp, 4 # get pointer to argv
addu s2, s1, 4 # skip null pointer on stack
--- 34,57 ----
* SUCH DAMAGE.
*
* from: @(#)crt0.s 8.2 (Berkeley) 3/21/94
! * $Id: crt0.S,v 1.4 1995/05/03 22:13:15 mellon Exp $
*/
#include <machine/regdef.h>
#include <machine/machAsmDefs.h>
.comm _C_LABEL(environ), 4
! .comm _C_LABEL(__progname), 4
! .data
$L1:
.word 0 # null string plus padding
.text
NON_LEAF(start, 24, ra)
.set noreorder
+ #ifdef __GP_SUPPORT__
+ la gp, _C_LABEL (_gp)
+ #endif
lw s0, 0(sp) # get argc from stack
addu s1, sp, 4 # get pointer to argv
addu s2, s1, 4 # skip null pointer on stack
***************
*** 74,80 ****
#endif
lw a0, 0(s1) # a0 = argv[0];
nop
! beq a0, zero, 2f # skip if a0 == NULL
move s3, a0 # save argv[0]
jal _C_LABEL(strrchr)
li a1, 0x2f # a1 = '/'
--- 74,84 ----
#endif
lw a0, 0(s1) # a0 = argv[0];
nop
! bne a0, zero, 2f # If a0 is NULL, use null string.
! nop
! la a0, $L1
! nop
! 2:
move s3, a0 # save argv[0]
jal _C_LABEL(strrchr)
li a1, 0x2f # a1 = '/'
***************
*** 83,89 ****
move v0, s3 # v0 = argv[0];
1:
sw v0, _C_LABEL(__progname)
- 2:
move a0, s0
move a1, s1
jal _C_LABEL(main) # v0 = main(argc, argv, env);
--- 87,92 ----