From 7c262518a45491adb8a04f5ec4006dbe957ab7a4 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 3 Aug 2001 18:31:41 -0700 Subject: target.h (gcc_target): Add asm_out.named_section, section_type_flags, have_named_sections. * target.h (gcc_target): Add asm_out.named_section, section_type_flags, have_named_sections. * target-def.h (TARGET_ASM_NAMED_SECTION): New. (TARGET_HAVE_NAMED_SECTIONS): New. (TARGET_SECTION_TYPE_FLAGS): New. * Makefile.in (toplev.o): Depend on TARGET_H. (varasm.o, dbxout.o): Likewise. * c-common.c (decl_attributes): Check targetm.have_named_sections instead of ifdef ASM_OUTPUT_SECTION_NAME. * dbxout.c (dbxout_function_decl): Likewise. (dbxout_function_end): Likewise. * toplev.c (compile_file): Likewise. * varasm.c (exception_section): Likewise. * cp/decl2.c (finish_objects): Likewise. * defaults.h (EH_FRAME_SECTION): Remove. (EH_FRAME_SECTION_ASM_OP): Remove. (EH_FRAME_SECTION_NAME): New. (UNIQUE_SECTION): Don't depend on ASM_OUTPUT_SECTION_NAME. (UNIQUE_SECTION_P): Remove. * dwarf2out.c (SECTION_FORMAT): Remove. (ASM_OUTPUT_SECTION): Remove. (output_call_frame_info): Use named_section_flags. (output_comp_unit, dwarf2out_start_source_file): Likewise. (dwarf2out_end_source_file, dwarf2out_define): Likewise. (dwarf2out_undef, dwarf2out_init, dwarf2out_finish): Likewise. * varasm.c (in_eh_frame, eh_frame_section): Remove. (named_section_flags): New. (named_section): Use it and targetm.section_type_flags. (resolve_unique_section): New. (assemble_start_function): Use it. (asm_emit_uninitialised, assemble_variable): Likewise. (default_section_type_flags): New. (default_no_named_section, default_elf_asm_named_section): New. (default_coff_asm_named_section, default_pe_asm_named_section): New. * output.h: Update varasm.c decls. (SECTION_*): New flags. * crtstuff.c: Check EH_FRAME_SECTION_NAME not EH_FRAME_SECTION_ASM_OP. (__EH_FRAME_BEGIN__, __FRAME_END__): Use attribute section. * config/elfos.h (UNIQUE_SECTION_P): Remove. * config/alpha/elf.h, config/arm/linux-elf.h: Likewise. * config/arm/pe.h, config/arm/unknown-elf.h: Likewise. * config/i386/cygwin.h, config/i386/djgpp.h: Likewise. * config/i386/i386-interix.h, config/i386/win32.h: Likewise. * config/ia64/sysv4.h, config/mcore/mcore-pe.h: Likewise. * config/mips/elf.h, config/mips/elf64.h: Likewise. * config/mips/iris6gld.h, config/mips/mips.h: Likewise. * config/pa/pa64-hpux.h, * config/elfos.h (ASM_OUTPUT_SECTION_NAME): Remove. (TARGET_ASM_NAMED_SECTION): New. * config/psos.h, config/a29k/a29k.h, config/alpha/elf.h: Likewise. * config/alpha/vms.h, config/arm/coff.h: Likewise. * config/arm/conix-elf.h, config/arm/elf.h: Likewise. * config/arm/linux-elf.h, config/arm/pe.h: Likewise. * config/arm/unknown-elf.h, config/avr/avr.h: Likewise. * config/c4x/c4x.h, config/h8300/h8300.h: Likewise. * config/i386/cygwin.h, config/i386/djgpp.h: Likewise. * config/i386/i386-interix.h, config/i386/i386elf.h : Likewise. * config/i386/sco5.h, config/i386/win32.h: Likewise. * config/m68k/coff.h, config/mcore/mcore-pe.h: Likewise. * config/mcore/mcore.h, config/mips/elf.h: Likewise. * config/mips/elf64.h, config/mips/iris6.h: Likewise. * config/mips/netbsd.h, config/mips/openbsd.h: Likewise. * config/pa/pa64-hpux.h, config/rs6000/sysv4.h: Likewise. * config/rs6000/xcoff.h, config/sh/sh.h: Likewise. * config/sparc/sysv4.h: Likewise. * config/nextstep.h: Error until named sections implemented. * config/a29k/a29k.c (a29k_asm_named_section): New. * config/alpha/alpha.c (SECTION_VMS_OVERLAY): New. (vms_section_type_flags, vms_asm_named_section): New. * config/arm/arm.c (arm_elf_asm_named_section): New. * config/avr/avr.c (asm_output_section_name): Remove. * config/avr/avr-protos.h: Update. * config/c4x/c4x.c (c4x_asm_named_section): New. * config/h8300/h8300.c (h8300_asm_named_section): New. * config/i386/i386.c (sco_asm_named_section): New. * config/i386/winnt.c (SECTION_PE_SHARED): New. (i386_pe_section_type_flags): New. (i386_pe_asm_named_section): New. * config/i386/i386-protos.h: Update. * config/m68k/m68k.c (m68k_coff_asm_named_section): New. * config/mcore/mcore.c (mcore_asm_named_section): New. * config/mips/mips.c (iris6_asm_named_section): New. * config/mips/mips.h (ENCODE_SECTION_INFO): Use DECL_ONE_ONLY instead of UNIQUE_SECTION_P. * config/rs6000/rs6000.c (rs6000_elf_section_type_flags): New. (xcoff_asm_named_section): New. * config/sh/sh.c (sh_asm_named_section): New. * config/sparc/sparc.c (sparc_elf_asm_named_section): New. * config/i386/djgpp.h (EH_FRAME_SECTION_ASM_OP): Remove. * config/i386/sco5.h (EH_FRAME_SECTION_ASM_OP*): Remove. (EH_FRAME_SECTION_NAME): New. (EXCEPTION_SECTION): New. * config/ia64/ia64.h (EH_FRAME_SECTION_ASM_OP): Remove. (DEBUG_*_SECTION): Remove. * config/m68k/rtemself.h (EH_FRAME_SECTION_ASM_OP): Remove. * config/mips/iris6.h (DEBUG_*_SECTION): Remove. (EH_FRAME_SECTION_ASM_OP): Remove. * doc/tm.texi (UNIQUE_SECTION_P): Remove. (ASM_OUTPUT_SECTION_NAME): Remove. (TARGET_ASM_NAMED_SECTION): New. (TARGET_HAVE_NAMED_SECTIONS): New. (TARGET_SECTION_TYPE_FLAGS): New. (EH_FRAME_SECTION_ASM_OP): Remove. (EH_FRAME_SECTION_NAME): New. From-SVN: r44623 --- gcc/crtstuff.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'gcc/crtstuff.c') diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index 9f62009..75e9441 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -211,7 +211,7 @@ __do_global_dtors_aux (void) f (); } -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME #if defined(CRT_GET_RFIB_TEXT) || defined(CRT_GET_RFIB_DATA) /* If we used the new __register_frame_info_bases interface, make sure that we deregister from the same place. */ @@ -240,7 +240,7 @@ fini_dummy (void) asm (TEXT_SECTION_ASM_OP); } -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME /* Stick a call to __register_frame_info into the .init section. For some reason calls with no arguments work more reliably in .init, so stick the call in another function. */ @@ -279,7 +279,7 @@ init_dummy (void) #endif asm (TEXT_SECTION_ASM_OP); } -#endif /* EH_FRAME_SECTION_ASM_OP */ +#endif /* EH_FRAME_SECTION_NAME */ #else /* OBJECT_FORMAT_ELF */ @@ -350,13 +350,13 @@ __do_global_dtors (void) for (p = __DTOR_LIST__ + 1; (f = *p); p++) f (); -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME if (__deregister_frame_info) __deregister_frame_info (__EH_FRAME_BEGIN__); #endif } -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME /* Define a function here to call __register_frame. crtend.o is linked in after libgcc.a, and hence can't call libgcc.a functions directly. That can lead to unresolved function references. */ @@ -404,16 +404,16 @@ asm (DTORS_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */ STATIC func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) }; #endif -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME /* Stick a label at the beginning of the frame unwind info so we can register and deregister it with the exception handling library code. */ - -asm (EH_FRAME_SECTION_ASM_OP); #ifdef INIT_SECTION_ASM_OP STATIC #endif -char __EH_FRAME_BEGIN__[] = { }; -#endif /* EH_FRAME_SECTION_ASM_OP */ +char __EH_FRAME_BEGIN__[] + __attribute__((section(EH_FRAME_SECTION_NAME))) + = { }; +#endif /* EH_FRAME_SECTION_NAME */ #endif /* defined(CRT_BEGIN) */ @@ -494,14 +494,14 @@ asm (TEXT_SECTION_ASM_OP); not an SVR4-style .init section. __do_global_ctors can be non-static in this case because we protect it with -hidden_symbol. */ static func_ptr __CTOR_END__[]; -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME extern void __frame_dummy (void); #endif void __do_global_ctors (void) { func_ptr *p; -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME __frame_dummy (); #endif for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--) @@ -535,13 +535,12 @@ STATIC func_ptr __DTOR_END__[1] __attribute__ ((__unused__)) = { (func_ptr) 0 }; #endif -#ifdef EH_FRAME_SECTION_ASM_OP +#ifdef EH_FRAME_SECTION_NAME /* Terminate the frame unwind info section with a 4byte 0 as a sentinel; this would be the 'length' field in a real FDE. */ - -typedef unsigned int ui32 __attribute__ ((mode (SI))); -asm (EH_FRAME_SECTION_ASM_OP); -STATIC ui32 __FRAME_END__[] __attribute__ ((__unused__)) = { 0 }; +STATIC int __FRAME_END__[] + __attribute__ ((unused, mode(SI), section(EH_FRAME_SECTION_NAME))) + = { 0 }; #endif /* EH_FRAME_SECTION */ #endif /* defined(CRT_END) */ @@ -601,14 +600,9 @@ __dereg_frame_dtor (void) } /* Terminate the frame section with a final zero. */ - -/* Force cc1 to switch to .data section. */ -static void * force_to_data[1] __attribute__ ((__unused__)) = { }; - -typedef unsigned int ui32 __attribute__ ((mode (SI))); -asm (EH_FRAME_SECTION_ASM_OP); -static ui32 __FRAME_END__[] __attribute__ ((__unused__)) = { 0 }; - +STATIC int __FRAME_END__[] + __attribute__ ((unused, mode(SI), section(EH_FRAME_SECTION_NAME))) + = { 0 }; #endif /* CRT_END */ #endif /* OBJECT_FORMAT_MACHO */ -- cgit v1.1