This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Patch: do not ignore .type for undefined symbols in a.out


(I'm trying to sneak a few ELF-isms past the a.out pseudo reader.)
It seems ".type" is somehow supported in a.out, but for some reason the
symbol has to be in the symbol table at the point where ".type" is found.
This is not true for "standard" gcc output for local functions, like in:
...
	.text
	.align 1
	.type	_pad_home1,@function
_pad_home1:
...

The .type pseudo would be --silently, I guess, but still wrongly-- ignored
by way of s_ignore if it wasn't for the '@' character.  This is a line
separator for CRIS, but is a special character in the .type pseudo syntax.
 Note that '@' is a line separator for a29k too, apparently without
problems.

Anyway, it seems wrong to ignore yet undefined symbols for .type in a.out;
the ELF .type pseudo does not.  This patch just changes symbol_find to
symbol_find_or_make and deletes the (sym != NULL) check, the rest is
formatting.

Ok to install?

2000-06-29  Hans-Peter Nilsson  <hp@axis.com>

	* config/obj-aout.c (obj_aout_type): Do not ignore for undefined
	symbols; create them.

Index: obj-aout.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-aout.c,v
retrieving revision 1.7
diff -p -c -r1.7 obj-aout.c
*** obj-aout.c	2000/06/25 17:59:21	1.7
--- obj-aout.c	2000/06/29 19:54:35
*************** obj_aout_weak (ignore)
*** 396,402 ****
  
  /* Handle .type.  On {Net,Open}BSD, this is used to set the n_other field,
     which is then apparently used when doing dynamic linking.  Older
!    versions ogas ignored the .type pseudo-op, so we also ignore it if
     we can't parse it.  */
  
  static void
--- 396,402 ----
  
  /* Handle .type.  On {Net,Open}BSD, this is used to set the n_other field,
     which is then apparently used when doing dynamic linking.  Older
!    versions of gas ignored the .type pseudo-op, so we also ignore it if
     we can't parse it.  */
  
  static void
*************** obj_aout_type (ignore)
*** 409,439 ****
  
    name = input_line_pointer;
    c = get_symbol_end ();
!   sym = symbol_find (name);
    *input_line_pointer = c;
!   if (sym != NULL)
      {
        SKIP_WHITESPACE ();
!       if (*input_line_pointer == ',')
  	{
  	  ++input_line_pointer;
! 	  SKIP_WHITESPACE ();
! 	  if (*input_line_pointer == '@')
! 	    {
! 	      ++input_line_pointer;
! 	      if (strncmp (input_line_pointer, "object", 6) == 0)
  #ifdef BFD_ASSEMBLER
! 		aout_symbol (symbol_get_bfdsym (sym))->other = 1;
  #else
! 		S_SET_OTHER (sym, 1);
  #endif
! 	      else if (strncmp (input_line_pointer, "function", 8) == 0)
  #ifdef BFD_ASSEMBLER
! 		aout_symbol (symbol_get_bfdsym (sym))->other = 2;
  #else
! 		S_SET_OTHER (sym, 2);
  #endif
- 	    }
  	}
      }
  
--- 409,436 ----
  
    name = input_line_pointer;
    c = get_symbol_end ();
!   sym = symbol_find_or_make (name);
    *input_line_pointer = c;
!   SKIP_WHITESPACE ();
!   if (*input_line_pointer == ',')
      {
+       ++input_line_pointer;
        SKIP_WHITESPACE ();
!       if (*input_line_pointer == '@')
  	{
  	  ++input_line_pointer;
! 	  if (strncmp (input_line_pointer, "object", 6) == 0)
  #ifdef BFD_ASSEMBLER
! 	    aout_symbol (symbol_get_bfdsym (sym))->other = 1;
  #else
! 	  S_SET_OTHER (sym, 1);
  #endif
! 	  else if (strncmp (input_line_pointer, "function", 8) == 0)
  #ifdef BFD_ASSEMBLER
! 	    aout_symbol (symbol_get_bfdsym (sym))->other = 2;
  #else
! 	  S_SET_OTHER (sym, 2);
  #endif
  	}
      }
  
brgds, H-P

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