[gnu.utils.bug] -Tdata command not properly handled by gcc/ld

glenne%hplsla@HP-SDE.SDE.HP.COM (Glenn Engel) (03/30/89)

System:  hp9000/350
gcc   :  1.34 using gnu a.out
ld    :  December 88

When using the new -Tdata option with gcc,  gcc splits up the option
when it get's passed on to ld:

gcc -v -Tdata c00000 test.c
gcc version 1.34
 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dhp9000s200 -Dhp9000s300 -DPWB -Dm
c68k -Dhpux -Dunix -D__hp9000s200__ -D__hp9000s300__ -D__PWB__ -D__mc68k__ -D__h
pux__ -D__unix__ -D__HAVE_68881__ -Dmc68020 test.c /tmp/cca28029.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-cc1 /tmp/cca28029.cpp -quiet -dumpbase test.c -version -o /t
mp/cca28029.s
GNU C version 1.34 (68k, MIT syntax) compiled by GNU C version 1.34.
 /usr/local/lib/gcc-as -mc68020 /tmp/cca28029.s -o test.o
 /usr/local/lib/gcc-ld -Tdata /usr/local/lib/gnu/crt0.o c00000 test.o /usr/local
/lib/gcc-gnulib -lc
ld: invalid argument to -Tdata

Notice that crt0.o got put between -Tdata and c00000.  If I try combining
the options together I get this result:

gcc -v -Tdatac00000 test.c
gcc version 1.34
 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dhp9000s200 -Dhp9000s300 -DPWB -Dm
c68k -Dhpux -Dunix -D__hp9000s200__ -D__hp9000s300__ -D__PWB__ -D__mc68k__ -D__h
pux__ -D__unix__ -D__HAVE_68881__ -Dmc68020 test.c /tmp/cca28064.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-cc1 /tmp/cca28064.cpp -quiet -dumpbase test.c -version -o /t
mp/cca28064.s
GNU C version 1.34 (68k, MIT syntax) compiled by GNU C version 1.34.
 /usr/local/lib/gcc-as -mc68020 /tmp/cca28064.s -o test.o
 /usr/local/lib/gcc-ld -Tdatac00000 /usr/local/lib/gnu/crt0.o test.o /usr/local/
lib/gcc-gnulib -lc
ld: -T argument not multiple of page size, with sharable output

I have fixed my version of ld.c to make it accept the -Tdatac00000 syntax.
Patches follow.

Thanks,

--
 |  Glenn R. Engel
 |  Hewlett-Packard 
 |  (206) 335-2066
 |  glenne%hplsla@hplabs.hp.com


*** ld.c.orig	Wed Mar 29 09:09:09 1989
--- ld.c	Wed Mar 29 09:26:29 1989
***************
*** 1128,1134
  decode_option (swt, arg)
       register char *swt, *arg;
  {
!   if (! strcmp (swt + 1, "Ttext"))
      {
        text_start = parse (arg, "%x", "invalid argument to -Ttext");
        T_flag_specified = 1;

--- 1128,1134 -----
  decode_option (swt, arg)
       register char *swt, *arg;
  {
!   if (! strncmp (swt + 1, "Ttext", 5))
      {
        if (swt[6] == 0) 
  	text_start = parse (arg, "%x", "invalid argument to -Ttext");
***************
*** 1130,1136
  {
    if (! strcmp (swt + 1, "Ttext"))
      {
!       text_start = parse (arg, "%x", "invalid argument to -Ttext");
        T_flag_specified = 1;
        return;
      }

--- 1130,1140 -----
  {
    if (! strncmp (swt + 1, "Ttext", 5))
      {
!       if (swt[6] == 0) 
! 	text_start = parse (arg, "%x", "invalid argument to -Ttext");
!       else
! 	text_start = parse (swt+6, "%x", "invalid argument to -Ttext");
!       
        T_flag_specified = 1;
        return;
      }
***************
*** 1134,1140
        T_flag_specified = 1;
        return;
      }
!   if (! strcmp (swt + 1, "Tdata"))
      {
        data_start = parse (arg, "%x", "invalid argument to -Tdata");
        Tdata_flag_specified = 1;

--- 1138,1144 -----
        T_flag_specified = 1;
        return;
      }
!   if (! strncmp (swt + 1, "Tdata",5))
      {
        if (swt[6] == 0) 
          data_start = parse (arg, "%x", "invalid argument to -Tdata");
***************
*** 1136,1142
      }
    if (! strcmp (swt + 1, "Tdata"))
      {
!       data_start = parse (arg, "%x", "invalid argument to -Tdata");
        Tdata_flag_specified = 1;
        return;
      }

--- 1140,1149 -----
      }
    if (! strncmp (swt + 1, "Tdata",5))
      {
!       if (swt[6] == 0) 
!         data_start = parse (arg, "%x", "invalid argument to -Tdata");
!       else
! 	data_start = parse (swt+6, "%x", "invalid argument to -Tdata");
        Tdata_flag_specified = 1;
        return;
      }