Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jun 2000 20:32:47 -0700 (PDT)
From:      yakisoba@f2.dion.ne.jp
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   gnu/19327: Fix to build 'a.out' binary.
Message-ID:  <20000616033247.31C4A37BA59@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         19327
>Category:       gnu
>Synopsis:       Fix to build 'a.out' binary.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 15 20:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Naohiko Tsuji
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
>Environment:
__FreeBSD_version >= 400012 (GCC 2.95.X and later)


>Description:
  After the base compiler is upgraded to GCC 2.95.2, 'a.out' binary
could not build.
  CURRENT and 4.0-STABLE GCC Target Macro still support both 'ELF'
and 'a.out'. So this problem is bug ? Or switch to 'ELF' only soon ?

If fix now, correct '__main.o' in libgcc.a like below.
     
    a.out __main.o:                     ELF  __main.o:
                   U ___CTOR_LIST__
                   U ___DTOR_LIST__
          00000028 T ___do_global_ctors
          00000000 T ___do_global_dtors
          0000007c T ___main
                   U __exit_dummy_decl
          000000a4 D __exit_dummy_ref
                   U _atexit

P.S. Now 'ELF' has garbege.

    ELF   __main.o:
                   U __do_global_ctors
          00000000 T __main

>How-To-Repeat:

>Fix:
  1. Delete define 'INVOKE__main' in GCC Target Macro 'i386/freebsd.h'.

  2. Add the next line to GCC Target Macro 'i386/freebsd.h'.

     #if defined (IN_LIBGCC2) && !defined (__ELF__)
     #undef OBJECT_FORMAT_ELF
     #undef INIT_SECTION_ASM_OP
     #endif

  3. Add CFLAGS to 'gnu/lib/libgcc/Makefile'.

     CFLAGS+=   -DIN_LIBGCC2

  4. Improve 'function.c' hack.

*** contrib/gcc/function.c.orig Tue Nov  2 03:56:02 1999
--- contrib/gcc/function.c      Mon Jun 12 22:35:02 2000
***************
*** 6040,6059 ****
  #define HAS_INIT_SECTION
  #endif
  
- #ifndef GEN_CALL__MAIN
- #define GEN_CALL__MAIN \
-   do {                                                                        \
-     emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0,    \
-                      VOIDmode, 0);                                    \
-   } while (0)
- #endif
- 
  void
  expand_main_function ()
  {
! #if defined(INVOKE__main) || !defined (HAS_INIT_SECTION)
    GEN_CALL__MAIN;
  #endif /* not HAS_INIT_SECTION */
  }
  
  extern struct obstack permanent_obstack;
--- 6040,6056 ----
  #define HAS_INIT_SECTION
  #endif
  
  void
  expand_main_function ()
  {
! #ifdef GEN_CALL__MAIN
    GEN_CALL__MAIN;
+ #else
+ #if !defined (HAS_INIT_SECTION)
+   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, NAME__MAIN), 0,
+                    VOIDmode, 0);
  #endif /* not HAS_INIT_SECTION */
+ #endif /* GEN_CALL__MAIN */
  }
  
  extern struct obstack permanent_obstack;

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000616033247.31C4A37BA59>