Commit 750930c1 by Melissa O'Neill Committed by Jeff Law

configure.in: Disable collect2 for nextstep.

        * configure.in: Disable collect2 for nextstep.  Instead use
        crtbegin/crtend.
        * configure: Rebuilt.
        * config/nextstep.h (STARTFILE_SPEC): Add crtbegin.
        (ENDFILE_SPEC): Define.
        (OBJECT_FORMAT_MACHO): Define.
        (EH_FRAME_SECTION_ASM_OP): Define.
        * crtstuff.c: Handle MACHO.

From-SVN: r22487
parent 655d03a8
Sat Sep 19 23:58:07 1998 Melissa O'Neill <oneill@cs.sfu.ca>
* configure.in: Disable collect2 for nextstep. Instead use
crtbegin/crtend.
* configure: Rebuilt.
* config/nextstep.h (STARTFILE_SPEC): Add crtbegin.
(ENDFILE_SPEC): Define.
(OBJECT_FORMAT_MACHO): Define.
(EH_FRAME_SECTION_ASM_OP): Define.
* crtstuff.c: Handle MACHO.
Sun Sep 20 00:24:24 1998 Robert Lipe <robertl@dgii.com>
* config/i386/sco5.h (TARGET_MEM_FUNCTIONS): Define.
......
......@@ -167,7 +167,12 @@ Boston, MA 02111-1307, USA. */
%{!p:-lcrt0.o}}}\
%{posix*:%{pg:-lgposixcrt0.o}%{!pg: \
%{p:%e-p profiling is no longer supported. Use -pg instead.} \
%{!p:-lposixcrt0.o}}}"
%{!p:-lposixcrt0.o}}} \
-lcrtbegin.o"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"-lcrtend.o"
/* Allow #sscs (but don't do anything). */
......@@ -203,6 +208,9 @@ Boston, MA 02111-1307, USA. */
"\t.text\n\t.stabs \"%s\",%d,0,0,Letext\nLetext:\n", \
"" , N_SO)
/* Define our object format type for crtstuff.c */
#define OBJECT_FORMAT_MACHO
/* Don't use .gcc_compiled symbols to communicate with GDB;
They interfere with numerically sorted symbol lists. */
......@@ -232,6 +240,8 @@ Boston, MA 02111-1307, USA. */
fprintf (FILE, ".reference .destructors_used\n"); \
} while (0)
#define EH_FRAME_SECTION_ASM_OP ".section __TEXT,__eh_frame,regular"
/* Don't output a .file directive. That is only used by the assembler for
error reporting. */
#undef ASM_FILE_START
......
......@@ -899,7 +899,7 @@ changequote([,])dnl
tmake_file=i386/t-next
xmake_file=i386/x-next
extra_objs=nextstep.o
use_collect2=yes
extra_parts="crtbegin.o crtend.o"
if test x$enable_threads = xyes; then
thread_file='mach'
fi
......@@ -1777,8 +1777,8 @@ changequote([,])dnl
tmake_file=m68k/t-next
xmake_file=m68k/x-next
extra_objs=nextstep.o
extra_parts="crtbegin.o crtend.o"
extra_headers=math-68881.h
use_collect2=yes
float_format=m68k
if test x$enable_threads = xyes; then
thread_file='mach'
......
......@@ -56,6 +56,8 @@ Boston, MA 02111-1307, USA. */
#include <stddef.h>
#include "frame.h"
#ifndef OBJECT_FORMAT_MACHO
/* Provide default definitions for the pseudo-ops used to switch to the
.ctors and .dtors sections.
......@@ -458,3 +460,71 @@ STATIC ui32 __FRAME_END__[] __attribute__ ((__unused__)) = { 0 };
#endif /* EH_FRAME_SECTION */
#endif /* defined(CRT_END) */
#else /* OBJECT_FORMAT_MACHO */
/* For Mach-O format executables, we assume that the system's runtime is
smart enough to handle constructors and destructors, but doesn't have
an init section (if it can't even handle constructors/destructors
you should be using INVOKE__main, not crtstuff). All we need to do
is install/deinstall the frame information for exceptions. We do this
by putting a constructor in crtbegin.o and a destructor in crtend.o.
crtend.o also puts in the terminating zero in the frame information
segment. */
/* The crtstuff for other object formats use the symbol __EH_FRAME_BEGIN__
to figure out the start of the exception frame, but here we use
getsectbynamefromheader to find this value. Either method would work,
but this method avoids creating any global symbols, which seems
cleaner. */
#include <mach-o/ldsyms.h>
extern const struct section *
getsectbynamefromheader (const struct mach_header *,
const char *, const char *);
#ifdef CRT_BEGIN
static void __reg_frame_ctor () __attribute__ ((constructor));
static void
__reg_frame_ctor ()
{
static struct object object;
const struct section *eh_frame;
eh_frame = getsectbynamefromheader (&_mh_execute_header,
"__TEXT", "__eh_frame");
__register_frame_info ((void *) eh_frame->addr, &object);
}
#endif /* CRT_BEGIN */
#ifdef CRT_END
static void __dereg_frame_dtor () __attribute__ ((destructor));
static
void __dereg_frame_dtor ()
{
const struct section *eh_frame;
eh_frame = getsectbynamefromheader (&_mh_execute_header,
"__TEXT", "__eh_frame");
__deregister_frame_info ((void *) eh_frame->addr);
}
/* Terminate the frame section with a final zero. */
/* Force cc1 to switch to .data section. */
static void * force_to_data[0] __attribute__ ((__unused__)) = { };
typedef unsigned int ui32 __attribute__ ((mode (SI)));
asm (EH_FRAME_SECTION_ASM_OP);
static ui32 __FRAME_END__[] __attribute__ ((__unused__)) = { 0 };
#endif /* CRT_END */
#endif /* OBJECT_FORMAT_MACHO */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment