public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Patch: do not ignore .type for undefined symbols in a.out
@ 2000-06-29 13:43 Hans-Peter Nilsson
  0 siblings, 0 replies; 2+ messages in thread
From: Hans-Peter Nilsson @ 2000-06-29 13:43 UTC (permalink / raw)
  To: binutils

(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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch: do not ignore .type for undefined symbols in a.out
@ 2000-06-29 15:35 Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2000-06-29 15:35 UTC (permalink / raw)
  To: hans-peter.nilsson; +Cc: binutils

Hi Hans-Peter,

: 2000-06-29  Hans-Peter Nilsson  <hp@axis.com>
: 
: 	* config/obj-aout.c (obj_aout_type): Do not ignore for undefined
: 	symbols; create them.

Approved.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-06-29 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-29 13:43 Patch: do not ignore .type for undefined symbols in a.out Hans-Peter Nilsson
2000-06-29 15:35 Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).