Commit 46f9491e by Eric Christopher Committed by Eric Christopher

c-pragma.h (add_weak): Move prototype from here...

2001-08-28  Eric Christopher <echristo@redhat.com>
	    Richard Henderson <rth@redhat.com>

	* c-pragma.h (add_weak): Move prototype from here...
	* output.h (add_weak): ... to here.
	* varasm.c (add_weak): Fix typo.
	* config/mips/crti.asm: New file.
	* config/mips/crtn.asm: Ditto.
	* config/mips/elf.h (SBSS_SECTION_ASM_OP) Add #undef.
	(CTOR_LISTS_DEFINED_EXTERNALLY): Remove.
	(INVOKE__main): Ditto.
	(INIT_SECTION_ASM_OP): New.
	(FINI_SECTION_ASM_OP): Ditto.
	(STARTFILE_SPEC): Add crti.
	(ENDFILE_SPEC): Add crtn.
	* config/mips/elf64.h: Same.
	* config/mips/rtems64.h (INVOKE__main, NAME__MAIN, SYMBOL__MAIN):
	Remove.
	* config/mips/vxworks.h: Ditto.
	* config/mips/t-elf: Support crti and crtn.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r45243
parent 5dde0143
2001-08-28 Eric Christopher <echristo@redhat.com>
Richard Henderson <rth@redhat.com>
* c-pragma.h (add_weak): Move prototype from here...
* output.h (add_weak): ... to here.
* varasm.c (add_weak): Fix typo.
* config/mips/crti.asm: New file.
* config/mips/crtn.asm: Ditto.
* config/mips/elf.h (SBSS_SECTION_ASM_OP) Add #undef.
(CTOR_LISTS_DEFINED_EXTERNALLY): Remove.
(INVOKE__main): Ditto.
(INIT_SECTION_ASM_OP): New.
(FINI_SECTION_ASM_OP): Ditto.
(STARTFILE_SPEC): Add crti.
(ENDFILE_SPEC): Add crtn.
* config/mips/elf64.h: Same.
* config/mips/rtems64.h (INVOKE__main, NAME__MAIN, SYMBOL__MAIN):
Remove.
* config/mips/vxworks.h: Ditto.
* config/mips/t-elf: Support crti and crtn.
2001-08-28 Alexandre Oliva <aoliva@redhat.com> 2001-08-28 Alexandre Oliva <aoliva@redhat.com>
* jump.c (mark_jump_label): Fix typo: REG_LABEL is EXPR_LIST, not * jump.c (mark_jump_label): Fix typo: REG_LABEL is EXPR_LIST, not
......
...@@ -41,11 +41,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -41,11 +41,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define HANDLE_PRAGMA_PACK 1 #define HANDLE_PRAGMA_PACK 1
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ #endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#ifdef HANDLE_PRAGMA_WEAK
extern int add_weak PARAMS ((const char *, const char *));
#endif /* HANDLE_PRAGMA_WEAK */
extern void init_pragma PARAMS ((void)); extern void init_pragma PARAMS ((void));
/* Duplicate prototypes for the register_pragma stuff and the typedef for /* Duplicate prototypes for the register_pragma stuff and the typedef for
......
/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
Return spill offset of 40 and 20. */
.section .init,"ax",@progbits
.globl _init
.type _init,@function
_init:
#ifdef __mips64
dsubu $sp,$sp,48
sd $31,40($sp)
#else
subu $sp,$sp,32
sw $31,20($sp)
#endif
.section .fini,"ax",@progbits
.globl _fini
.type _fini,@function
_fini:
#ifdef __mips64
dsubu $sp,$sp,48
sd $31,40($sp)
#else
subu $sp,$sp,32
sw $31,20($sp)
#endif
/* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
Return spill offset of 40 and 20. */
.section .init,"ax",@progbits
#ifdef __mips64
ld $31,40($sp)
daddu $sp,$sp,48
#else
lw $31,20($sp)
addu $sp,$sp,32
#endif
j $31
.section .fini,"ax",@progbits
#ifdef __mips64
ld $31,40($sp)
daddu $sp,$sp,48
#else
lw $31,20($sp)
addu $sp,$sp,32
#endif
j $31
...@@ -99,10 +99,12 @@ do { \ ...@@ -99,10 +99,12 @@ do { \
uninitialized global data will be output in the data section if uninitialized global data will be output in the data section if
`-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
used. */ used. */
#ifndef BSS_SECTION_ASM_OP #ifndef BSS_SECTION_ASM_OP
#define BSS_SECTION_ASM_OP "\t.section\t.bss" #define BSS_SECTION_ASM_OP "\t.section\t.bss"
#endif #endif
#undef SBSS_SECTION_ASM_OP
#define SBSS_SECTION_ASM_OP "\t.section .sbss" #define SBSS_SECTION_ASM_OP "\t.section .sbss"
/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
...@@ -213,18 +215,11 @@ do { \ ...@@ -213,18 +215,11 @@ do { \
#define UNIQUE_SECTION(DECL,RELOC) \ #define UNIQUE_SECTION(DECL,RELOC) \
mips_unique_section ((DECL), (RELOC)) mips_unique_section ((DECL), (RELOC))
/* There's no point providing a default definition of __CTOR_LIST__
since people are expected either to use crtbegin.o, or an equivalent,
or provide their own definition. */
#define CTOR_LISTS_DEFINED_EXTERNALLY
/* A list of other sections which the compiler might be "in" at any /* A list of other sections which the compiler might be "in" at any
given time. */ given time. */
#undef EXTRA_SECTIONS #undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata #define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata
#define INVOKE__main
#undef EXTRA_SECTION_FUNCTIONS #undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \ #define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
...@@ -241,12 +236,23 @@ void FN () \ ...@@ -241,12 +236,23 @@ void FN () \
} \ } \
} }
/* On elf, we *do* have support for the .init and .fini sections, and we
can put stuff in there to be executed before and after `main'. We let
crtstuff.c and other files know this by defining the following symbols.
The definitions say how to change sections to the .init and .fini
sections. This is the same for all known elf assemblers. */
#undef INIT_SECTION_ASM_OP
#define INIT_SECTION_ASM_OP "\t.section\t.init"
#undef FINI_SECTION_ASM_OP
#define FINI_SECTION_ASM_OP "\t.section\t.fini"
/* Don't set the target flags, this is done by the linker script */ /* Don't set the target flags, this is done by the linker script */
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC "" #define LIB_SPEC ""
#undef STARTFILE_SPEC #undef STARTFILE_SPEC
#define STARTFILE_SPEC "crtbegin%O%s %{!mno-crt0:crt0%O%s}" #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
#undef ENDFILE_SPEC #undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend%O%s" #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
...@@ -256,18 +256,11 @@ do { \ ...@@ -256,18 +256,11 @@ do { \
DECL_SECTION_NAME (DECL) = build_string (len, string); \ DECL_SECTION_NAME (DECL) = build_string (len, string); \
} while (0) } while (0)
/* There's no point providing a default definition of __CTOR_LIST__
since people are expected either to use crtbegin.o, or an equivalent,
or provide their own definition. */
#define CTOR_LISTS_DEFINED_EXTERNALLY
/* A list of other sections which the compiler might be "in" at any /* A list of other sections which the compiler might be "in" at any
given time. */ given time. */
#undef EXTRA_SECTIONS #undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_rdata #define EXTRA_SECTIONS in_sdata, in_rdata
#define INVOKE__main
#undef EXTRA_SECTION_FUNCTIONS #undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \ #define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
...@@ -282,12 +275,24 @@ void FN () \ ...@@ -282,12 +275,24 @@ void FN () \
in_section = ENUM; \ in_section = ENUM; \
} \ } \
} }
/* On elf, we *do* have support for the .init and .fini sections, and we
can put stuff in there to be executed before and after `main'. We let
crtstuff.c and other files know this by defining the following symbols.
The definitions say how to change sections to the .init and .fini
sections. This is the same for all known elf assemblers. */
#undef INIT_SECTION_ASM_OP
#define INIT_SECTION_ASM_OP "\t.section\t.init"
#undef FINI_SECTION_ASM_OP
#define FINI_SECTION_ASM_OP "\t.section\t.fini"
/* Don't set the target flags, this is done by the linker script */ /* Don't set the target flags, this is done by the linker script */
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC "" #define LIB_SPEC ""
#undef STARTFILE_SPEC #undef STARTFILE_SPEC
#define STARTFILE_SPEC "crtbegin%O%s %{!mno-crt0:crt0%O%s}" #define STARTFILE_SPEC "crti%O%s crtbegin%O%s %{!mno-crt0:crt0%O%s}"
#undef ENDFILE_SPEC #undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend%O%s" #define ENDFILE_SPEC "crtend%O%s crtn%O%s"
...@@ -33,10 +33,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -33,10 +33,6 @@ Boston, MA 02111-1307, USA. */
#undef EXTRA_SECTIONS #undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_rdata #define EXTRA_SECTIONS in_sdata, in_rdata
#undef INVOKE__main
#undef NAME__MAIN
#undef SYMBOL__MAIN
#undef EXTRA_SECTION_FUNCTIONS #undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \ #define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
......
CONFIG2_H = $(srcdir)/config/mips/ecoff.h CONFIG2_H = $(srcdir)/config/mips/ecoff.h
EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
# Don't let CTOR_LIST end up in sdata section. # Don't let CTOR_LIST end up in sdata section.
CRTSTUFF_T_CFLAGS = -G 0 CRTSTUFF_T_CFLAGS = -G 0
# Assemble startup files.
$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-c -o crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm
$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-c -o crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm
LIB1ASMSRC = mips/mips16.S LIB1ASMSRC = mips/mips16.S
LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \ LIB1ASMFUNCS = _m16addsf3 _m16subsf3 _m16mulsf3 _m16divsf3 \
_m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \ _m16eqsf2 _m16nesf2 _m16gtsf2 _m16gesf2 _m16lesf2 _m16ltsf2 \
...@@ -48,6 +56,7 @@ fp-bit.c: $(srcdir)/config/fp-bit.c ...@@ -48,6 +56,7 @@ fp-bit.c: $(srcdir)/config/fp-bit.c
MULTILIB_OPTIONS = msoft-float/msingle-float EL/EB mips1/mips3 MULTILIB_OPTIONS = msoft-float/msingle-float EL/EB mips1/mips3
MULTILIB_DIRNAMES = soft-float single el eb mips1 mips3 MULTILIB_DIRNAMES = soft-float single el eb mips1 mips3
MULTILIB_MATCHES = msingle-float=m4650 MULTILIB_MATCHES = msingle-float=m4650
EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
LIBGCC = stmp-multilib LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib INSTALL_LIBGCC = install-multilib
......
...@@ -20,10 +20,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -20,10 +20,6 @@ Boston, MA 02111-1307, USA. */
#undef EXTRA_SECTIONS #undef EXTRA_SECTIONS
#define EXTRA_SECTIONS in_sdata, in_rdata, in_sbss #define EXTRA_SECTIONS in_sdata, in_rdata, in_sbss
#undef INVOKE__main
#undef NAME__MAIN
#undef SYMBOL__MAIN
#undef EXTRA_SECTION_FUNCTIONS #undef EXTRA_SECTION_FUNCTIONS
#define EXTRA_SECTION_FUNCTIONS \ #define EXTRA_SECTION_FUNCTIONS \
SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \
......
...@@ -135,6 +135,10 @@ extern void leaf_renumber_regs_insn PARAMS ((rtx)); ...@@ -135,6 +135,10 @@ extern void leaf_renumber_regs_insn PARAMS ((rtx));
/* Locate the proper template for the given insn-code. */ /* Locate the proper template for the given insn-code. */
extern const char *get_insn_template PARAMS ((int, rtx)); extern const char *get_insn_template PARAMS ((int, rtx));
/* Add function NAME to the weak symbols list. VALUE is a weak alias
associated with NAME. */
extern int add_weak PARAMS ((const char *, const char *));
/* Functions in flow.c */ /* Functions in flow.c */
extern void allocate_for_life_analysis PARAMS ((void)); extern void allocate_for_life_analysis PARAMS ((void));
extern int regno_uninitialized PARAMS ((int)); extern int regno_uninitialized PARAMS ((int));
......
...@@ -4799,9 +4799,9 @@ output_constructor (exp, size, align) ...@@ -4799,9 +4799,9 @@ output_constructor (exp, size, align)
assemble_zeros (size - total_bytes); assemble_zeros (size - total_bytes);
} }
/* This structure contains any weak symbol declarations waiting to be
emitted. */
/* This structure contains any weak symbol declarations waiting
to be emitted. */
struct weak_syms struct weak_syms
{ {
struct weak_syms * next; struct weak_syms * next;
...@@ -4812,7 +4812,7 @@ struct weak_syms ...@@ -4812,7 +4812,7 @@ struct weak_syms
static struct weak_syms * weak_decls; static struct weak_syms * weak_decls;
/* Add function NAME to the weak symbols list. VALUE is a weak alias /* Add function NAME to the weak symbols list. VALUE is a weak alias
associatd with NAME. */ associated with NAME. */
int int
add_weak (name, value) add_weak (name, value)
...@@ -4878,7 +4878,6 @@ weak_finish () ...@@ -4878,7 +4878,6 @@ weak_finish ()
/* Remove NAME from the pending list of weak symbols. This prevents /* Remove NAME from the pending list of weak symbols. This prevents
the compiler from emitting multiple .weak directives which confuses the compiler from emitting multiple .weak directives which confuses
some assemblers. */ some assemblers. */
static void static void
remove_from_pending_weak_list (name) remove_from_pending_weak_list (name)
const char *name; const char *name;
......
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