This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for irix .globl directives


The irix o32 port will emit:

        .globl  foo .text

for each undefined function foo() that is called within the compilation
unit.  This is apparently needed to stop the native linker performing
unwanted optimisations.

Anyway, these directives are causing problems for --with-gnu-ld
configurations (and perhaps others) because we're emitting them
for built-in functions too.  libgcc_s.so therefore has undefined
references to __builtin_dwarf_cfa, __builtin_expect, etc.

There is already code to check for and avoid certain builtin functions.
The simplest fix seems to be to extend this check so that it covers all
builtins.  This certainly fixes the problem I was seeing and means we go
from a 100% to 0% execution failure rate in g77.

There are still some problems with C++ that I hope to look into soon.

Bootstrapped & regression tested on mips-sgi-irix6.5.  OK to install?

Richard

PS. I wondered about committing this as obvious but thought I'd better
    check first in case anyone knew of a reason why this was wrong.
    Perhaps it could be argued that the function shouldn't be seeing
    builtin functions in the first place.


	* config/mips/mips.c (mips_output_external): Replace checks for
	specific builtin-in functions with a check for DECL_BUILTIN_IN.

Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.345
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.345 mips.c
*** config/mips/mips.c	30 Nov 2003 19:30:14 -0000	1.345
--- config/mips/mips.c	1 Dec 2003 17:56:33 -0000
*************** mips_output_external (FILE *file ATTRIBU
*** 5568,5579 ****
  
    if (TARGET_IRIX && mips_abi == ABI_32
        && TREE_CODE (decl) == FUNCTION_DECL
!       /* ??? Don't include alloca, since gcc will always expand it
! 	 inline.  If we don't do this, the C++ library fails to build.  */
!       && strcmp (name, "alloca")
!       /* ??? Don't include __builtin_next_arg, because then gcc will not
! 	 bootstrap under Irix 5.1.  */
!       && strcmp (name, "__builtin_next_arg"))
      {
        p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
        p->next = extern_head;
--- 5568,5574 ----
  
    if (TARGET_IRIX && mips_abi == ABI_32
        && TREE_CODE (decl) == FUNCTION_DECL
!       && !DECL_BUILT_IN (decl))
      {
        p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
        p->next = extern_head;


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