From cea3bd3e5a0a40eb90809bf90063da4911ba23b0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 26 Jan 2002 20:18:12 -0800 Subject: Makefile.in (CRTSTUFF_CFLAGS): New. * Makefile.in (CRTSTUFF_CFLAGS): New. (crtbegin.o, crtend.o, crtbeginS.o, crtendS.o, crtbeginT.o): Use it. * config.gcc (alpha-linux, alpha-freebsd, alpha-netbsd): Use plain crtstuff.c instead of alpha assembly version. * crtstuff.c (CRT_CALL_STATIC_FUNCTION): Rewrite to assume the entire dummy function sequence. Use FORCE_CODE_SECTION_ALIGN not FORCE_{INIT,FINI}_SECTION_ALIGN. (__do_global_dtors_aux): Mark used. (frame_dummy, __do_global_ctors_aux): Mark used. (fini_dummy, init_dummy): Remove. * config/alpha/crtbegin.asm: Remove file. * config/alpha/crtend.asm: Remove file. * config/alpha/t-crtbe: Remove file. * config/alpha/elf.h (CRT_CALL_STATIC_FUNCTION): New. (LINK_EH_SPEC): New. * config/cris/cris.h (CRT_CALL_STATIC_FUNCTION): Rewrite old FORCE_INIT_SECTION_ALIGN hack. Register __fini_start before calling constructors. * config/cris/linux.h (CRT_CALL_STATIC_FUNCTION): Undef. * config/i386/i386.h (CRT_CALL_STATIC_FUNCTION): New. * config/i386/linux.h (CRT_CALL_STATIC_FUNCTION): Replace old CRT_END_INIT_DUMMY hack. * config/i386/sol2.h (FORCE_CODE_SECTION_ALIGN): Replace FORCE_{INIT,FINI}_SECTION_ALIGN. * config/mcore/mcore-elf.h (FORCE_CODE_SECTION_ALIGN): Replace FORCE_{INIT,FINI}_SECTION_ALIGN. * config/s390/s390.h (CRT_CALL_STATIC_FUNCTION): Update for new invocation sequence. * config/sh/sh.h (CRT_CALL_STATIC_FUNCTION): Likewise. * doc/tm.texi (CRT_CALL_STATIC_FUNCTION): Update. (FORCE_CODE_SECTION_ALIGN): New. From-SVN: r49261 --- gcc/config/i386/linux.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'gcc/config/i386/linux.h') diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 63006b3..de634d3 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -1,5 +1,6 @@ /* Definitions for Intel 386 running Linux-based GNU systems with ELF format. - Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002 + Free Software Foundation, Inc. Contributed by Eric Youngdale. Modified for stabs-in-ELF by H.J. Lu. @@ -167,20 +168,20 @@ Boston, MA 02111-1307, USA. */ #if defined(__PIC__) && defined (USE_GNULIBC_1) /* This is a kludge. The i386 GNU/Linux dynamic linker needs ___brk_addr, - __environ and atexit (). We have to make sure they are in the .dynsym - section. We accomplish it by making a dummy call here. This - code is never reached. */ - -#define CRT_END_INIT_DUMMY \ - do \ - { \ - extern void *___brk_addr; \ - extern char **__environ; \ - \ - ___brk_addr = __environ; \ - atexit (0); \ - } \ - while (0) + __environ and atexit. We have to make sure they are in the .dynsym + section. We do this by forcing the assembler to create undefined + references to these symbols in the object file. */ +#undef CRT_CALL_STATIC_FUNCTION +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n\t" \ + "call " USER_LABEL_PREFIX #FUNC "\n" \ + TEXT_SECTION_ASM_OP "\n\t" \ + ".extern ___brk_addr\n\t" \ + ".type ___brk_addr,@object\n\t" \ + ".extern __environ\n\t" \ + ".type __environ,@object\n\t" \ + ".extern atexit\n\t" \ + ".type atexit,@function"); #endif /* Handle special EH pointer encodings. Absolute, pc-relative, and -- cgit v1.1