1992-03-07 05:32:07 +01:00
|
|
|
/* Specialized bits of code needed to support construction and
|
|
|
|
destruction of file-scope objects in C++ code.
|
2013-02-04 20:06:20 +01:00
|
|
|
Copyright (C) 1991-2013 Free Software Foundation, Inc.
|
1996-06-28 20:08:53 +02:00
|
|
|
Contributed by Ron Guilmette (rfg@monkeys.com).
|
1992-03-07 05:32:07 +01:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
This file is part of GCC.
|
1992-03-07 05:32:07 +01:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
2009-04-09 17:00:19 +02:00
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
version.
|
1992-03-07 05:32:07 +01:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
1992-03-07 05:32:07 +01:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1992-03-07 05:32:07 +01:00
|
|
|
|
i * libgcc1-test.c, libgcc1.c, config/i386/perform.h: Delete file.
* testsuite/gcc.dg/complete-port.c: New (revised version of
libgcc1-test.c)
* po/POTFILES.in: Remove libgcc1-test.c and libgcc1.c.
* Makefile.in: Delete variables: OLDCC, CCLIBFLAGS, OLDAR,
OLDAR_FLAGS, LIBGCC1, LIBGCC1_TEST, CROSS_LIBGCC1,
LIB1FUNCS, and LIB1FUNCS_EXTRA. Delete rules: libgcc1-test,
libgcc1-test.o. Clarify commentary now that libgcc1 no longer exists.
* cross-make: Don't set LIBGCC1.
* mklibgcc.in: Delete all code for building from libgcc1.c.
Always honor LIB1ASMFUNCS if set.
* crtstuff.c, floatlib.c, longlong.h, config/fp-bit.c,
config/arc/lib1funcs.asm, config/arm/lib1funcs.asm,
config/d30v/libgcc1.asm, config/fr30/lib1funcs.asm,
config/h8300/lib1funcs.asm, config/i386/cygwin.asm,
config/i386/uwin.asm, config/m68hc11/larith.asm,
config/m68k/lb1sf68.asm, config/mcore/lib1.asm,
config/mn10200/lib1funcs.asm, config/sh/lib1funcs.asm,
config/sparc/lb1spc.asm, config/sparc/lb1spl.asm,
config/v850/lib1funcs.asm, config/c4x/libgcc.S:
Delete or update references to libgcc1 in commentary.
* config/t-libc-ok, config/t-linux, config/t-linux-aout,
config/t-netbsd, config/a29k/t-a29kbare, config/a29k/t-vx29k,
config/alpha/t-interix, config/alpha/t-osf, config/alpha/t-vms,
config/arc/t-arc, config/arm/t-arm-aout, config/arm/t-arm-coff,
config/arm/t-arm-elf, config/arm/t-linux, config/arm/t-pe,
config/arm/t-semi, config/arm/t-strongarm-coff,
config/arm/t-strongarm-elf, config/arm/t-strongarm-pe,
config/arm/t-xscale-coff, config/arm/t-xscale-elf, config/avr/t-avr,
config/c4x/t-c4x, config/d30v/t-d30v, config/fr30/t-fr30,
config/h8300/t-h8300, config/i386/t-beos, config/i386/t-cygwin,
config/i386/t-i386elf, config/i386/t-interix, config/i386/t-netware,
config/i386/t-next, config/i386/t-rtems-i386, config/i386/t-sol2,
config/i960/t-960bare, config/i960/t-vxworks960, config/ia64/t-ia64,
config/m32r/t-m32r, config/m68hc11/t-m68hc11-gas, config/m68k/t-lynx,
config/m68k/t-m68kbare, config/m68k/t-m68kelf,
config/m68k/t-mot3300-gald, config/m68k/t-mot3300-gas,
config/m68k/t-next, config/m68k/t-vxworks68, config/m88k/t-bug,
config/m88k/t-dgux, config/m88k/t-dgux-gas, config/m88k/t-dguxbcs,
config/m88k/t-luna, config/m88k/t-luna-gas, config/m88k/t-m88k,
config/m88k/t-m88k-gas, config/m88k/t-sysv4, config/mcore/t-mcore,
config/mcore/t-mcore-pe, config/mips/t-bsd, config/mips/t-bsd-gas,
config/mips/t-cross64, config/mips/t-ecoff, config/mips/t-elf,
config/mips/t-iris6, config/mips/t-r3900, config/mips/t-svr3,
config/mips/t-svr3-gas, config/mips/t-svr4, config/mips/t-svr4-gas,
config/mips/t-ultrix, config/mn10200/t-mn10200,
config/mn10300/t-mn10300, config/pa/t-linux, config/pa/t-linux64,
config/pa/t-pa, config/pa/t-pa64, config/pa/t-pro,
config/pdp11/t-pdp11, config/pj/t-pj, config/rs6000/t-aix43,
config/rs6000/t-beos, config/rs6000/t-darwin, config/rs6000/t-newas,
config/rs6000/t-ppccomm, config/rs6000/t-rs6000, config/sh/t-linux,
config/sh/t-sh, config/sparc/t-chorus-elf, config/sparc/t-elf,
config/sparc/t-sol2, config/sparc/t-sp86x, config/sparc/t-sparcbare,
config/sparc/t-sparclite, config/sparc/t-splet,
config/sparc/t-sunos41, config/sparc/t-vxsparc,
config/sparc/t-vxsparc64, config/v850/t-v850:
Don't set any of LIBGCC1, CROSS_LIBGCC1, or LIBGCC1_TEST.
* config/alpha/alpha.h, config/i386/i386.h, config/i860/i860.h:
Don't set FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, INTIFY, or FLOATIFY.
* config/d30v/d30v.h: Don't mention LIBGCC_NEEDS_DOUBLE,
FLOAT_VALUE_TYPE, FLOAT_ARG_TYPE, FLOATIFY, INTIFY,
nongcc_SI_type, nongcc_word_type, or perform_*
* config/i860/fx2800: Don't define perform_umodsi3 or perform_modsi3.
* config/i386/386bsd.h, config/i386/beos-elf.h,
config/i386/linux-aout.h, config/i386/linux-oldld.h,
config/i386/linux.h, config/i386/mach.h, config/i386/netbsd.h,
config/i386/openbsd.h, config/i386/osfrose.h, config/i386/rtemself.h:
Don't include i386/perform.h.
* config/a29k/t-a29k, config/arm/t-semiaof, config/i370/t-i370,
config/i370/t-linux, config/i370/t-mvs, config/i370/t-oe,
config/i386/t-djgpp, config/i386/t-i386bare, config/i386/t-vsta,
config/ia64/t-hpux, config/mips/t-mips, config/mips/t-mips-gas,
config/mips/t-osfrose, config/sparc/t-sp64, config/sparc/t-sunos40,
config/vax/t-openbsd, config/vax/t-vax: Delete.
* config.gcc: Remove references to deleted files.
(arm-semi-aof): Use arm/t-semi for tmake_file.
* gcc.texi, install.texi, invoke.texi, tm.texi:
Delete or rewrite text which is no longer relevant now that
libgcc1 no longer exists.
* config/t-openbsd, config/alpha/t-interix, config/i386/t-interix:
No need to set INSTALL_ASSERT_H. (Missed in previous sweep.)
From-SVN: r42188
2001-05-17 05:16:18 +02:00
|
|
|
/* This file is a bit like libgcc2.c in that it is compiled
|
1992-03-07 05:32:07 +01:00
|
|
|
multiple times and yields multiple .o files.
|
|
|
|
|
|
|
|
This file is useful on target machines where the object file format
|
|
|
|
supports multiple "user-defined" sections (e.g. COFF, ELF, ROSE). On
|
|
|
|
such systems, this file allows us to avoid running collect (or any
|
|
|
|
other such slow and painful kludge). Additionally, if the target
|
|
|
|
system supports a .init section, this file allows us to support the
|
|
|
|
linking of C++ code with a non-C++ main program.
|
|
|
|
|
|
|
|
Note that if INIT_SECTION_ASM_OP is defined in the tm.h file, then
|
|
|
|
this file *will* make use of the .init section. If that symbol is
|
|
|
|
not defined however, then the .init section will not be used.
|
|
|
|
|
1992-06-04 21:12:25 +02:00
|
|
|
Currently, only ELF and COFF are supported. It is likely however that
|
|
|
|
ROSE could also be supported, if someone was willing to do the work to
|
|
|
|
make whatever (small?) adaptations are needed. (Some work may be
|
|
|
|
needed on the ROSE assembler and linker also.)
|
1992-03-07 05:32:07 +01:00
|
|
|
|
|
|
|
This file must be compiled with gcc. */
|
|
|
|
|
2005-05-10 12:27:44 +02:00
|
|
|
/* Target machine header files require this define. */
|
|
|
|
#define IN_LIBGCC2
|
|
|
|
|
2005-05-11 15:40:12 +02:00
|
|
|
/* FIXME: Including auto-host is incorrect, but until we have
|
|
|
|
identified the set of defines that need to go into auto-target.h,
|
|
|
|
this will have to do. */
|
|
|
|
#include "auto-host.h"
|
2005-11-15 02:21:29 +01:00
|
|
|
#undef pid_t
|
|
|
|
#undef rlim_t
|
|
|
|
#undef ssize_t
|
|
|
|
#undef vfork
|
configure.in: Kill tm.h.
* configure.in: Kill tm.h. Include the files in the $tm_file
list in all three of config.h, hconfig.h, tconfig.h, after the
relevant set of xm_files. Put TARGET_CPU_DEFAULT in all
three, include insn-codes.h in all three (#ifndef GENERATOR_FILE).
* configure: Regenerate.
* Makefile.in (clean): Don't delete tm.h.
* system.h: If SUCCESS_EXIT_CODE and FATAL_EXIT_CODE are not
defined, set them from EXIT_SUCCESS and EXIT_FAILURE. If
those are not defined, set SEC and FEC to 0 and 1.
* gcc.texi: Update to match.
* crtstuff.c: Include tconfig.h, not auto-host.h and tm.h.
* config/fp-bit.c, config/m68k/aux-crt2.asm,
config/m68k/aux-crtn.asm, config/m68k/aux-mcount.c:
Include tconfig.h, not tm.h.
* config/xm-lynx.h, config/xm-std32.h,
config/a29k/xm-a29k.h, config/a29k/xm-unix.h,
config/alpha/xm-alpha.h, config/arc/xm-arc.h,
config/avr/xm-avr.h, config/c4x/xm-c4x.h,
config/clipper/xm-clix.h, config/convex/xm-convex.h,
config/d30v/xm-d30v.h, config/dsp16xx/xm-dsp16xx.h,
config/elxsi/xm-elxsi.h, config/fr30/xm-fr30.h,
config/h8300/xm-h8300.h, config/i370/xm-linux.h,
config/i386/xm-i386.h, config/i860/xm-i860.h,
config/i960/xm-i960.h, config/ia64/xm-ia64.h,
config/m32r/xm-m32r.h, config/m68hc11/xm-m68hc11.h,
config/m88k/xm-m88k.h, config/mcore/xm-mcore.h,
config/mips/xm-mips.h, config/mn10200/xm-mn10200.h,
config/mn10300/xm-mn10300.h, config/ns32k/xm-ns32k.h,
config/pa/xm-linux.h, config/pa/xm-pa.h,
config/pa/xm-pa64hpux.h, config/pa/xm-pahpux.h,
config/pa/xm-papro.h, config/pdp11/xm-pdp11.h,
config/pj/xm-pj.h, config/romp/xm-romp.h,
config/rs6000/xm-beos.h, config/rs6000/xm-rs6000.h,
config/rs6000/xm-sysv4.h, config/sh/xm-sh.h,
config/sparc/xm-sparc.h, config/sparc/xm-sysv4.h,
config/v850/xm-v850.h, config/vax/xm-vax.h,
config/we32k/xm-we32k.h:
Don't include tm.h.
Don't define SUCCESS_EXIT_CODE or FATAL_EXIT_CODE.
* config/i370/xm-i370.h, config/i370/xm-mvs.h,
config/i370/xm-oe.h: Don't include tm.h. Don't define
SUCCESS_EXIT_CODE.
* config/vax/xm-vms.h: Don't include tm.h.
* config/xm-lynx.h, config/avr/xm-avr.h,
config/fr30/xm-fr30.h, config/pdp11/xm-pdp11.h,
Delete; made empty by above changes.
* config/i386/xm-lynx.h, config/m68k/xm-lynx.h,
config/rs6000/xm-lynx.h, config/sparc/xm-lynx.h:
Don't include config/xm-lynx.h or tm.h.
* config/xm-gnu.h: Don't include fcntl.h.
* config/sparc/xm-lynx.h: Don't include sys/types.h and
sys/wait.h.
* config/clipper/xm-clix.h, config/vax/xm-vax.h: Don't define isinf.
From-SVN: r40199
2001-03-03 04:32:55 +01:00
|
|
|
#include "tconfig.h"
|
2000-02-01 22:30:52 +01:00
|
|
|
#include "tsystem.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tm.h"
|
Move libgcc_tm_file to toplevel libgcc
gcc:
* configure.ac (libgcc_tm_file_list, libgcc_tm_include_list):
Remove.
* configure: Regenerate.
* Makefile.in (libgcc_tm_file_list, libgcc_tm_include_list): Remove.
(TM_H): Remove libgcc_tm.h, $(libgcc_tm_file_list).
(libgcc_tm.h, cs-libgcc_tm.h): Remove.
(clean): Remove libgcc_tm.h
* mkconfig.sh: Don't include libgcc_tm.h in tm.h.
* config.gcc (libgcc_tm_file): Remove.
(arm*-*-linux*): Remove libgcc_tm_file for arm*-*-linux-*eabi.
(arm*-*-uclinux*): Remove libgcc_tm_file for arm*-*-uclinux*eabi.
(arm*-*-eabi*, arm*-*-symbianelf*): Remove libgcc_tm_file.
(avr-*-rtems*): Likewise.
(avr-*-*): Likewise.
(frv-*-elf): Likewise.
(frv-*-*linux*): Likewise.
(h8300-*-rtems*): Likewise.
(h8300-*-elf*): Likewise.
(i[34567]86-*-darwin*): Likewise.
(x86_64-*-darwin*): Likewise.
(rx-*-elf*): Likewise.
(tic6x-*-elf): Likewise.
(tic6x-*-uclinux): Likewise.
(i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
libgcc:
* configure.ac (tm_file_): New variable.
Determine from tm_file.
(tm_file, tm_defines): Substitute.
* configure: Regenerate.
* mkheader.sh: New file.
* Makefile.in (clean): Remove libgcc_tm.h.
($(objects)): Depend on libgcc_tm.h.
(libgcc_tm_defines, libgcc_tm_file): New variables.
(libgcc_tm.h, libgcc_tm.stamp): New targets.
($(libgcc-objects), $(libgcc-s-objects), $(libgcc-eh-objects))
($(libgcov-objects), $(libunwind-objects), $(libunwind-s-objects))
($(extra-parts)): Depend on libgcc_tm.h.
* config.host (tm_defines, tm_file): New variable.
(arm*-*-linux*): Set tm_file for arm*-*-linux-*eabi.
(arm*-*-uclinux*): Set tm_file for arm*-*-uclinux*eabi.
(arm*-*-eabi*, arm*-*-symbianelf*): Set tm_file.
(avr-*-rtems*): Likewise.
(avr-*-*): Likewise.
(frv-*-elf): Likewise.
(frv-*-*linux*): Likewise.
(h8300-*-rtems*): Likewise.
(h8300-*-elf*): Likewise.
(i[34567]86-*-darwin*): Likewise.
(x86_64-*-darwin*): Likewise.
(rx-*-elf): Likewise.
(tic6x-*-uclinux): Likewise.
(tic6x-*-elf): Likewise.
(i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
* config/alpha/gthr-posix.c: Include libgcc_tm.h.
* config/i386/cygming-crtbegin.c: Likewise.
* config/i386/cygming-crtend.c: Likewise.
* config/ia64/fde-vms.c: Likewise.
* config/ia64/unwind-ia64.c: Likewise.
* config/libbid/bid_gcc_intrinsics.h: Likewise.
* config/rs6000/darwin-fallback.c: Likewise.
* config/stormy16/lib2funcs.c: Likewise.
* config/xtensa/unwind-dw2-xtensa.c: Likewise.
* crtstuff.c: Likewise.
* dfp-bit.h: Likewise.
* emutls.c: Likewise.
* fixed-bit.c: Likewise.
* fp-bit.c: Likewise.
* generic-morestack-thread.c: Likewise.
* generic-morestack.c: Likewise.
* libgcc2.c: Likewise.
* libgcov.c: Likewise.
* unwind-dw2-fde-dip.c: Likewise.
* unwind-dw2-fde.c: Likewise.
* unwind-dw2.c: Likewise.
* unwind-sjlj.c: Likewise.
Co-Authored-By: Paolo Bonzini <bonzini@gnu.org>
From-SVN: r180775
2011-11-02 16:26:35 +01:00
|
|
|
#include "libgcc_tm.h"
|
2001-03-28 13:04:51 +02:00
|
|
|
#include "unwind-dw2-fde.h"
|
1992-03-07 05:32:07 +01:00
|
|
|
|
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
2002-01-27 05:18:12 +01:00
|
|
|
#ifndef FORCE_CODE_SECTION_ALIGN
|
|
|
|
# define FORCE_CODE_SECTION_ALIGN
|
|
|
|
#endif
|
|
|
|
|
2000-08-25 09:21:54 +02:00
|
|
|
#ifndef CRT_CALL_STATIC_FUNCTION
|
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
2002-01-27 05:18:12 +01:00
|
|
|
# define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
|
|
|
|
static void __attribute__((__used__)) \
|
|
|
|
call_ ## FUNC (void) \
|
|
|
|
{ \
|
|
|
|
asm (SECTION_OP); \
|
|
|
|
FUNC (); \
|
|
|
|
FORCE_CODE_SECTION_ALIGN \
|
|
|
|
asm (TEXT_SECTION_ASM_OP); \
|
|
|
|
}
|
2000-08-25 09:21:54 +02:00
|
|
|
#endif
|
|
|
|
|
2009-09-22 18:28:26 +02:00
|
|
|
#if defined(OBJECT_FORMAT_ELF) \
|
|
|
|
&& !defined(OBJECT_FORMAT_FLAT) \
|
|
|
|
&& defined(HAVE_LD_EH_FRAME_HDR) \
|
|
|
|
&& !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
|
|
|
|
&& defined(__FreeBSD__) && __FreeBSD__ >= 7
|
|
|
|
#include <link.h>
|
|
|
|
# define USE_PT_GNU_EH_FRAME
|
|
|
|
#endif
|
|
|
|
|
2010-12-23 13:08:21 +01:00
|
|
|
#if defined(OBJECT_FORMAT_ELF) \
|
|
|
|
&& !defined(OBJECT_FORMAT_FLAT) \
|
|
|
|
&& defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR) \
|
|
|
|
&& !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
|
|
|
|
&& defined(__sun__) && defined(__svr4__)
|
|
|
|
#include <link.h>
|
|
|
|
# define USE_PT_GNU_EH_FRAME
|
|
|
|
#endif
|
|
|
|
|
2007-01-18 20:09:59 +01:00
|
|
|
#if defined(OBJECT_FORMAT_ELF) \
|
|
|
|
&& !defined(OBJECT_FORMAT_FLAT) \
|
|
|
|
&& defined(HAVE_LD_EH_FRAME_HDR) \
|
2002-01-25 12:22:52 +01:00
|
|
|
&& !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
&& defined(__GLIBC__) && __GLIBC__ >= 2
|
|
|
|
#include <link.h>
|
2007-08-24 04:50:23 +02:00
|
|
|
/* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
|
|
|
|
But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
|
|
|
|
# if !defined(__UCLIBC__) \
|
|
|
|
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
|
|
|
|
# define USE_PT_GNU_EH_FRAME
|
|
|
|
# endif
|
|
|
|
#endif
|
2012-08-19 17:11:40 +02:00
|
|
|
|
|
|
|
#if defined(OBJECT_FORMAT_ELF) \
|
|
|
|
&& !defined(OBJECT_FORMAT_FLAT) \
|
|
|
|
&& defined(HAVE_LD_EH_FRAME_HDR) \
|
|
|
|
&& !defined(CRTSTUFFT_O) \
|
|
|
|
&& defined(inhibit_libc) \
|
|
|
|
&& (defined(__GLIBC__) || defined(__gnu_linux__) || defined(__GNU__))
|
|
|
|
/* On systems using glibc, an inhibit_libc build of libgcc is only
|
|
|
|
part of a bootstrap process. Build the same crt*.o as would be
|
|
|
|
built with headers present, so that it is not necessary to build
|
|
|
|
glibc more than once for the bootstrap to converge. */
|
|
|
|
# define USE_PT_GNU_EH_FRAME
|
|
|
|
#endif
|
|
|
|
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
#if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
|
|
|
|
# define USE_EH_FRAME_REGISTRY
|
|
|
|
#endif
|
2004-11-24 15:35:31 +01:00
|
|
|
#if defined(EH_FRAME_SECTION_NAME) && EH_TABLES_CAN_BE_READ_ONLY
|
2002-11-26 13:34:25 +01:00
|
|
|
# define EH_FRAME_SECTION_CONST const
|
|
|
|
#else
|
|
|
|
# define EH_FRAME_SECTION_CONST
|
|
|
|
#endif
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
|
2007-05-04 21:20:28 +02:00
|
|
|
#if !defined(DTOR_LIST_END) && defined(OBJECT_FORMAT_ELF) \
|
|
|
|
&& defined(HAVE_GAS_HIDDEN) && !defined(FINI_ARRAY_SECTION_ASM_OP)
|
|
|
|
# define HIDDEN_DTOR_LIST_END
|
|
|
|
#endif
|
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
|
|
|
|
# define USE_TM_CLONE_REGISTRY 1
|
|
|
|
#endif
|
|
|
|
|
1999-02-27 23:21:58 +01:00
|
|
|
/* We do not want to add the weak attribute to the declarations of these
|
2001-03-28 13:04:51 +02:00
|
|
|
routines in unwind-dw2-fde.h because that will cause the definition of
|
|
|
|
these symbols to be weak as well.
|
1999-02-27 23:21:58 +01:00
|
|
|
|
|
|
|
This exposes a core issue, how to handle creating weak references vs
|
|
|
|
how to create weak definitions. Either we have to have the definition
|
|
|
|
of TARGET_WEAK_ATTRIBUTE be conditional in the shared header files or
|
|
|
|
have a second declaration if we want a function's references to be weak,
|
|
|
|
but not its definition.
|
|
|
|
|
|
|
|
Making TARGET_WEAK_ATTRIBUTE conditional seems like a good solution until
|
alias.c, [...]: Fix comment typos.
* alias.c, crtstuff.c, dbxout.c, domwalk.c, domwalk.h, gcc.c,
gcse.c, global.c, lambda-code.c, loop.c, mips-tdump.c,
optabs.h, predict.c, reg-stack.c, regclass.c, sched-rgn.c,
tree-optimize.c, tree-ssa-dom.c, tree-ssa-forwprop.c,
tree-ssa-operands.c, tree-ssa-phiopt.c,
tree-ssa-threadupdate.c: Fix comment typos.
From-SVN: r87707
2004-09-18 21:47:10 +02:00
|
|
|
one thinks about scaling to larger problems -- i.e., the condition under
|
1999-02-27 23:21:58 +01:00
|
|
|
which TARGET_WEAK_ATTRIBUTE is active will eventually get far too
|
|
|
|
complicated.
|
|
|
|
|
|
|
|
So, we take an approach similar to #pragma weak -- we have a second
|
|
|
|
declaration for functions that we want to have weak references.
|
|
|
|
|
|
|
|
Neither way is particularly good. */
|
2009-11-25 11:55:54 +01:00
|
|
|
|
1999-02-27 23:21:58 +01:00
|
|
|
/* References to __register_frame_info and __deregister_frame_info should
|
|
|
|
be weak in this file if at all possible. */
|
2003-10-31 Andreas Jaeger <aj@suse.de>,
Zack Weinberg <zack@codesourcery.com>
* crtstuff.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
* unwind-dw2-fde.h (struct fde_vector):
Constify 'orig_data' and 'array' fields.
(__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie, next_fde, _Unwind_Find_FDE): Constify arguments,
return values, and casts of type fde *, struct dwarf_fde *,
and struct dwarf_cie *.
* unwind-dw2-fde.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie_encoding, ): Constify struct dwarf_cie * argument.
(get_fde_encoding, fde_unencoded_compare, fde_single_encoding_compare)
(fde_mixed_encoding_compare, fde_compare_t, start_fde_sort, fde_insert)
fde_split, SWAP, frame_downheap, frame_heapsort)
(classify_object_over_fdes, add_fdes, linear_search_fdes,
binary_search_unencoded_fdes, binary_search_single_encoding_fdes,
binary_search_mixed_encoding_fdes, search_object, _Unwind_Find_FDE):
Constify arguments, local variables, return values, and casts
of type fde *, fde **, struct dwarf_fde *, and struct dwarf_cie *.
Use const pointer types in sizeof expressions, for clarity.
* unwind-dw2-fde-glibc.c
(_Unwind_find_registered_FDE, _Unwind_find_FDE): Constify return value.
(struct unw_eh_callback_data): Constify 'ret' field.
Co-Authored-By: Zack Weinberg <zack@codesourcery.com>
From-SVN: r73155
2003-10-31 21:46:26 +01:00
|
|
|
extern void __register_frame_info (const void *, struct object *)
|
1999-02-27 23:21:58 +01:00
|
|
|
TARGET_ATTRIBUTE_WEAK;
|
2003-10-31 Andreas Jaeger <aj@suse.de>,
Zack Weinberg <zack@codesourcery.com>
* crtstuff.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
* unwind-dw2-fde.h (struct fde_vector):
Constify 'orig_data' and 'array' fields.
(__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie, next_fde, _Unwind_Find_FDE): Constify arguments,
return values, and casts of type fde *, struct dwarf_fde *,
and struct dwarf_cie *.
* unwind-dw2-fde.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie_encoding, ): Constify struct dwarf_cie * argument.
(get_fde_encoding, fde_unencoded_compare, fde_single_encoding_compare)
(fde_mixed_encoding_compare, fde_compare_t, start_fde_sort, fde_insert)
fde_split, SWAP, frame_downheap, frame_heapsort)
(classify_object_over_fdes, add_fdes, linear_search_fdes,
binary_search_unencoded_fdes, binary_search_single_encoding_fdes,
binary_search_mixed_encoding_fdes, search_object, _Unwind_Find_FDE):
Constify arguments, local variables, return values, and casts
of type fde *, fde **, struct dwarf_fde *, and struct dwarf_cie *.
Use const pointer types in sizeof expressions, for clarity.
* unwind-dw2-fde-glibc.c
(_Unwind_find_registered_FDE, _Unwind_find_FDE): Constify return value.
(struct unw_eh_callback_data): Constify 'ret' field.
Co-Authored-By: Zack Weinberg <zack@codesourcery.com>
From-SVN: r73155
2003-10-31 21:46:26 +01:00
|
|
|
extern void __register_frame_info_bases (const void *, struct object *,
|
2001-05-22 18:57:40 +02:00
|
|
|
void *, void *)
|
|
|
|
TARGET_ATTRIBUTE_WEAK;
|
2003-10-31 Andreas Jaeger <aj@suse.de>,
Zack Weinberg <zack@codesourcery.com>
* crtstuff.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
* unwind-dw2-fde.h (struct fde_vector):
Constify 'orig_data' and 'array' fields.
(__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie, next_fde, _Unwind_Find_FDE): Constify arguments,
return values, and casts of type fde *, struct dwarf_fde *,
and struct dwarf_cie *.
* unwind-dw2-fde.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie_encoding, ): Constify struct dwarf_cie * argument.
(get_fde_encoding, fde_unencoded_compare, fde_single_encoding_compare)
(fde_mixed_encoding_compare, fde_compare_t, start_fde_sort, fde_insert)
fde_split, SWAP, frame_downheap, frame_heapsort)
(classify_object_over_fdes, add_fdes, linear_search_fdes,
binary_search_unencoded_fdes, binary_search_single_encoding_fdes,
binary_search_mixed_encoding_fdes, search_object, _Unwind_Find_FDE):
Constify arguments, local variables, return values, and casts
of type fde *, fde **, struct dwarf_fde *, and struct dwarf_cie *.
Use const pointer types in sizeof expressions, for clarity.
* unwind-dw2-fde-glibc.c
(_Unwind_find_registered_FDE, _Unwind_find_FDE): Constify return value.
(struct unw_eh_callback_data): Constify 'ret' field.
Co-Authored-By: Zack Weinberg <zack@codesourcery.com>
From-SVN: r73155
2003-10-31 21:46:26 +01:00
|
|
|
extern void *__deregister_frame_info (const void *)
|
1999-02-27 23:21:58 +01:00
|
|
|
TARGET_ATTRIBUTE_WEAK;
|
2003-10-31 Andreas Jaeger <aj@suse.de>,
Zack Weinberg <zack@codesourcery.com>
* crtstuff.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
* unwind-dw2-fde.h (struct fde_vector):
Constify 'orig_data' and 'array' fields.
(__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie, next_fde, _Unwind_Find_FDE): Constify arguments,
return values, and casts of type fde *, struct dwarf_fde *,
and struct dwarf_cie *.
* unwind-dw2-fde.c (__register_frame_info, __register_frame_info_bases)
(__deregister_frame_info, __deregister_frame_info_bases):
Constify void * argument.
(get_cie_encoding, ): Constify struct dwarf_cie * argument.
(get_fde_encoding, fde_unencoded_compare, fde_single_encoding_compare)
(fde_mixed_encoding_compare, fde_compare_t, start_fde_sort, fde_insert)
fde_split, SWAP, frame_downheap, frame_heapsort)
(classify_object_over_fdes, add_fdes, linear_search_fdes,
binary_search_unencoded_fdes, binary_search_single_encoding_fdes,
binary_search_mixed_encoding_fdes, search_object, _Unwind_Find_FDE):
Constify arguments, local variables, return values, and casts
of type fde *, fde **, struct dwarf_fde *, and struct dwarf_cie *.
Use const pointer types in sizeof expressions, for clarity.
* unwind-dw2-fde-glibc.c
(_Unwind_find_registered_FDE, _Unwind_find_FDE): Constify return value.
(struct unw_eh_callback_data): Constify 'ret' field.
Co-Authored-By: Zack Weinberg <zack@codesourcery.com>
From-SVN: r73155
2003-10-31 21:46:26 +01:00
|
|
|
extern void *__deregister_frame_info_bases (const void *)
|
2001-05-23 01:01:33 +02:00
|
|
|
TARGET_ATTRIBUTE_WEAK;
|
2003-10-28 04:47:37 +01:00
|
|
|
extern void __do_global_ctors_1 (void);
|
1999-02-27 23:21:58 +01:00
|
|
|
|
2001-08-19 05:53:34 +02:00
|
|
|
/* Likewise for _Jv_RegisterClasses. */
|
|
|
|
extern void _Jv_RegisterClasses (void *) TARGET_ATTRIBUTE_WEAK;
|
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
/* Likewise for transactional memory clone tables. */
|
|
|
|
extern void _ITM_registerTMCloneTable (void *, size_t) TARGET_ATTRIBUTE_WEAK;
|
|
|
|
extern void _ITM_deregisterTMCloneTable (void *) TARGET_ATTRIBUTE_WEAK;
|
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#ifdef OBJECT_FORMAT_ELF
|
|
|
|
|
|
|
|
/* Declare a pointer to void function type. */
|
|
|
|
typedef void (*func_ptr) (void);
|
|
|
|
#define STATIC static
|
|
|
|
|
|
|
|
#else /* OBJECT_FORMAT_ELF */
|
|
|
|
|
1992-03-07 05:32:07 +01:00
|
|
|
#include "gbl-ctors.h"
|
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#define STATIC
|
|
|
|
|
|
|
|
#endif /* OBJECT_FORMAT_ELF */
|
1992-03-07 05:32:07 +01:00
|
|
|
|
|
|
|
#ifdef CRT_BEGIN
|
|
|
|
|
2001-08-19 05:53:34 +02:00
|
|
|
/* NOTE: In order to be able to support SVR4 shared libraries, we arrange
|
|
|
|
to have one set of symbols { __CTOR_LIST__, __DTOR_LIST__, __CTOR_END__,
|
|
|
|
__DTOR_END__ } per root executable and also one set of these symbols
|
|
|
|
per shared library. So in any given whole process image, we may have
|
|
|
|
multiple definitions of each of these symbols. In order to prevent
|
|
|
|
these definitions from conflicting with one another, and in order to
|
|
|
|
ensure that the proper lists are used for the initialization/finalization
|
|
|
|
of each individual shared library (respectively), we give these symbols
|
|
|
|
only internal (i.e. `static') linkage, and we also make it a point to
|
|
|
|
refer to only the __CTOR_END__ symbol in crtend.o and the __DTOR_LIST__
|
|
|
|
symbol in crtbegin.o, where they are defined. */
|
|
|
|
|
2011-08-20 22:02:17 +02:00
|
|
|
/* No need for .ctors/.dtors section if linker can place them in
|
|
|
|
.init_array/.fini_array section. */
|
|
|
|
#ifndef USE_INITFINI_ARRAY
|
2001-08-19 05:53:34 +02:00
|
|
|
/* The -1 is a flag to __do_global_[cd]tors indicating that this table
|
|
|
|
does not start with a count of elements. */
|
|
|
|
#ifdef CTOR_LIST_BEGIN
|
|
|
|
CTOR_LIST_BEGIN;
|
|
|
|
#elif defined(CTORS_SECTION_ASM_OP)
|
|
|
|
/* Hack: force cc1 to switch to .data section early, so that assembling
|
|
|
|
__CTOR_LIST__ does not undo our behind-the-back change to .ctors. */
|
2010-05-10 17:53:04 +02:00
|
|
|
static func_ptr force_to_data[1] __attribute__ ((__used__)) = { };
|
2001-08-19 05:53:34 +02:00
|
|
|
asm (CTORS_SECTION_ASM_OP);
|
|
|
|
STATIC func_ptr __CTOR_LIST__[1]
|
2010-05-10 17:53:04 +02:00
|
|
|
__attribute__ ((__used__, aligned(sizeof(func_ptr))))
|
2001-08-19 05:53:34 +02:00
|
|
|
= { (func_ptr) (-1) };
|
|
|
|
#else
|
|
|
|
STATIC func_ptr __CTOR_LIST__[1]
|
2010-05-10 17:53:04 +02:00
|
|
|
__attribute__ ((__used__, section(".ctors"), aligned(sizeof(func_ptr))))
|
2001-08-19 05:53:34 +02:00
|
|
|
= { (func_ptr) (-1) };
|
|
|
|
#endif /* __CTOR_LIST__ alternatives */
|
|
|
|
|
|
|
|
#ifdef DTOR_LIST_BEGIN
|
|
|
|
DTOR_LIST_BEGIN;
|
|
|
|
#elif defined(DTORS_SECTION_ASM_OP)
|
|
|
|
asm (DTORS_SECTION_ASM_OP);
|
|
|
|
STATIC func_ptr __DTOR_LIST__[1]
|
|
|
|
__attribute__ ((aligned(sizeof(func_ptr))))
|
|
|
|
= { (func_ptr) (-1) };
|
|
|
|
#else
|
|
|
|
STATIC func_ptr __DTOR_LIST__[1]
|
|
|
|
__attribute__((section(".dtors"), aligned(sizeof(func_ptr))))
|
|
|
|
= { (func_ptr) (-1) };
|
|
|
|
#endif /* __DTOR_LIST__ alternatives */
|
2011-08-20 22:02:17 +02:00
|
|
|
#endif /* USE_INITFINI_ARRAY */
|
2001-08-19 05:53:34 +02:00
|
|
|
|
2002-06-04 04:55:28 +02:00
|
|
|
#ifdef USE_EH_FRAME_REGISTRY
|
2001-08-19 05:53:34 +02:00
|
|
|
/* Stick a label at the beginning of the frame unwind info so we can register
|
|
|
|
and deregister it with the exception handling library code. */
|
2002-11-26 13:34:25 +01:00
|
|
|
STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
|
2001-08-19 05:53:34 +02:00
|
|
|
__attribute__((section(EH_FRAME_SECTION_NAME), aligned(4)))
|
|
|
|
= { };
|
2002-06-04 04:55:28 +02:00
|
|
|
#endif /* USE_EH_FRAME_REGISTRY */
|
2001-08-19 05:53:34 +02:00
|
|
|
|
|
|
|
#ifdef JCR_SECTION_NAME
|
|
|
|
/* Stick a label at the beginning of the java class registration info
|
|
|
|
so we can register them properly. */
|
|
|
|
STATIC void *__JCR_LIST__[]
|
2010-05-11 17:44:26 +02:00
|
|
|
__attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void*))))
|
2001-08-19 05:53:34 +02:00
|
|
|
= { };
|
|
|
|
#endif /* JCR_SECTION_NAME */
|
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if USE_TM_CLONE_REGISTRY
|
|
|
|
STATIC func_ptr __TMC_LIST__[]
|
2011-11-26 22:16:49 +01:00
|
|
|
__attribute__((used, section(".tm_clone_table"), aligned(sizeof(void*))))
|
2011-11-21 23:10:06 +01:00
|
|
|
= { };
|
2011-11-26 22:16:49 +01:00
|
|
|
# ifdef HAVE_GAS_HIDDEN
|
2011-11-21 23:10:06 +01:00
|
|
|
extern func_ptr __TMC_END__[] __attribute__((__visibility__ ("hidden")));
|
2011-11-26 22:16:49 +01:00
|
|
|
# endif
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
deregister_tm_clones (void)
|
|
|
|
{
|
|
|
|
void (*fn) (void *);
|
|
|
|
|
|
|
|
#ifdef HAVE_GAS_HIDDEN
|
|
|
|
if (__TMC_END__ - __TMC_LIST__ == 0)
|
|
|
|
return;
|
|
|
|
#else
|
|
|
|
if (__TMC_LIST__[0] == NULL)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
fn = _ITM_deregisterTMCloneTable;
|
|
|
|
__asm ("" : "+r" (fn));
|
|
|
|
if (fn)
|
|
|
|
fn (__TMC_LIST__);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
register_tm_clones (void)
|
|
|
|
{
|
|
|
|
void (*fn) (void *, size_t);
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
#ifdef HAVE_GAS_HIDDEN
|
|
|
|
size = (__TMC_END__ - __TMC_LIST__) / 2;
|
|
|
|
#else
|
|
|
|
for (size = 0; __TMC_LIST__[size * 2] != NULL; size++)
|
|
|
|
continue;
|
|
|
|
#endif
|
|
|
|
if (size == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fn = _ITM_registerTMCloneTable;
|
|
|
|
__asm ("" : "+r" (fn));
|
|
|
|
if (fn)
|
|
|
|
fn (__TMC_LIST__, size);
|
|
|
|
}
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_TM_CLONE_REGISTRY */
|
|
|
|
|
2005-04-29 16:09:45 +02:00
|
|
|
#if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
|
2001-08-21 12:12:07 +02:00
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#ifdef OBJECT_FORMAT_ELF
|
|
|
|
|
1999-12-17 08:39:13 +01:00
|
|
|
/* Declare the __dso_handle variable. It should have a unique value
|
2000-04-05 09:34:36 +02:00
|
|
|
in every shared-object; in a main program its value is zero. The
|
|
|
|
object should in any case be protected. This means the instance
|
|
|
|
in one DSO or the main program is not used in another object. The
|
|
|
|
dynamic linker takes care of this. */
|
|
|
|
|
2006-05-16 05:49:57 +02:00
|
|
|
#ifdef TARGET_LIBGCC_SDATA_SECTION
|
|
|
|
extern void *__dso_handle __attribute__ ((__section__ (TARGET_LIBGCC_SDATA_SECTION)));
|
|
|
|
#endif
|
2000-04-05 09:34:36 +02:00
|
|
|
#ifdef HAVE_GAS_HIDDEN
|
2002-02-26 22:17:22 +01:00
|
|
|
extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));
|
2000-04-05 09:34:36 +02:00
|
|
|
#endif
|
1999-12-17 08:39:13 +01:00
|
|
|
#ifdef CRTSTUFFS_O
|
|
|
|
void *__dso_handle = &__dso_handle;
|
|
|
|
#else
|
|
|
|
void *__dso_handle = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The __cxa_finalize function may not be available so we use only a
|
|
|
|
weak declaration. */
|
|
|
|
extern void __cxa_finalize (void *) TARGET_ATTRIBUTE_WEAK;
|
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
/* Run all the global destructors on exit from the program. */
|
2009-11-25 11:55:54 +01:00
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
/* Some systems place the number of pointers in the first word of the
|
|
|
|
table. On SVR4 however, that word is -1. In all cases, the table is
|
|
|
|
null-terminated. On SVR4, we start from the beginning of the list and
|
|
|
|
invoke each per-compilation-unit destructor routine in order
|
|
|
|
until we find that null.
|
|
|
|
|
|
|
|
Note that this function MUST be static. There will be one of these
|
|
|
|
functions in each root executable and one in each shared library, but
|
|
|
|
although they all have the same code, each one is unique in that it
|
|
|
|
refers to one particular associated `__DTOR_LIST__' which belongs to the
|
1996-10-24 03:23:43 +02:00
|
|
|
same particular root executable or shared library file.
|
|
|
|
|
|
|
|
On some systems, this routine is run more than once from the .fini,
|
|
|
|
when exit is called recursively, so we arrange to remember where in
|
|
|
|
the list we left off processing, and we resume at that point,
|
|
|
|
should we be re-invoked. */
|
1994-11-19 05:09:58 +01:00
|
|
|
|
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
2002-01-27 05:18:12 +01:00
|
|
|
static void __attribute__((used))
|
1999-03-23 01:43:51 +01:00
|
|
|
__do_global_dtors_aux (void)
|
1994-11-19 05:09:58 +01:00
|
|
|
{
|
2005-04-29 16:09:45 +02:00
|
|
|
static _Bool completed;
|
1997-11-25 19:55:32 +01:00
|
|
|
|
2001-05-22 18:57:40 +02:00
|
|
|
if (__builtin_expect (completed, 0))
|
1997-11-25 19:55:32 +01:00
|
|
|
return;
|
|
|
|
|
1999-12-19 06:36:13 +01:00
|
|
|
#ifdef CRTSTUFFS_O
|
|
|
|
if (__cxa_finalize)
|
1999-12-17 08:39:13 +01:00
|
|
|
__cxa_finalize (__dso_handle);
|
1999-12-19 06:36:13 +01:00
|
|
|
#endif
|
1999-12-17 08:39:13 +01:00
|
|
|
|
2005-04-29 16:09:45 +02:00
|
|
|
#ifdef FINI_ARRAY_SECTION_ASM_OP
|
|
|
|
/* If we are using .fini_array then destructors will be run via that
|
|
|
|
mechanism. */
|
2007-05-04 21:20:28 +02:00
|
|
|
#elif defined(HIDDEN_DTOR_LIST_END)
|
|
|
|
{
|
|
|
|
/* Safer version that makes sure only .dtors function pointers are
|
|
|
|
called even if the static variable is maliciously changed. */
|
|
|
|
extern func_ptr __DTOR_END__[] __attribute__((visibility ("hidden")));
|
|
|
|
static size_t dtor_idx;
|
|
|
|
const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
|
|
|
|
func_ptr f;
|
|
|
|
|
|
|
|
while (dtor_idx < max_idx)
|
|
|
|
{
|
|
|
|
f = __DTOR_LIST__[++dtor_idx];
|
|
|
|
f ();
|
|
|
|
}
|
|
|
|
}
|
2005-04-29 16:09:45 +02:00
|
|
|
#else /* !defined (FINI_ARRAY_SECTION_ASM_OP) */
|
2007-05-04 21:20:28 +02:00
|
|
|
{
|
|
|
|
static func_ptr *p = __DTOR_LIST__ + 1;
|
|
|
|
func_ptr f;
|
|
|
|
|
|
|
|
while ((f = *p))
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
f ();
|
|
|
|
}
|
|
|
|
}
|
2005-04-29 16:09:45 +02:00
|
|
|
#endif /* !defined(FINI_ARRAY_SECTION_ASM_OP) */
|
1997-09-10 20:00:28 +02:00
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if USE_TM_CLONE_REGISTRY
|
2011-11-26 22:16:49 +01:00
|
|
|
deregister_tm_clones ();
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_TM_CLONE_REGISTRY */
|
|
|
|
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
#ifdef USE_EH_FRAME_REGISTRY
|
2003-06-04 07:21:41 +02:00
|
|
|
#ifdef CRT_GET_RFIB_DATA
|
2001-05-23 01:01:33 +02:00
|
|
|
/* If we used the new __register_frame_info_bases interface,
|
|
|
|
make sure that we deregister from the same place. */
|
|
|
|
if (__deregister_frame_info_bases)
|
|
|
|
__deregister_frame_info_bases (__EH_FRAME_BEGIN__);
|
|
|
|
#else
|
1999-02-27 23:21:58 +01:00
|
|
|
if (__deregister_frame_info)
|
|
|
|
__deregister_frame_info (__EH_FRAME_BEGIN__);
|
1997-09-10 20:00:28 +02:00
|
|
|
#endif
|
2001-05-23 01:01:33 +02:00
|
|
|
#endif
|
|
|
|
|
1997-11-25 19:55:32 +01:00
|
|
|
completed = 1;
|
1994-11-19 05:09:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Stick a call to __do_global_dtors_aux into the .fini section. */
|
2005-04-29 16:09:45 +02:00
|
|
|
#ifdef FINI_SECTION_ASM_OP
|
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
2002-01-27 05:18:12 +01:00
|
|
|
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
|
2009-08-29 17:37:48 +02:00
|
|
|
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
|
2005-04-29 16:09:45 +02:00
|
|
|
static func_ptr __do_global_dtors_aux_fini_array_entry[]
|
2011-12-06 22:35:41 +01:00
|
|
|
__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(func_ptr))))
|
2005-04-29 16:09:45 +02:00
|
|
|
= { __do_global_dtors_aux };
|
2009-08-29 17:37:48 +02:00
|
|
|
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
|
|
|
|
static void __attribute__((used))
|
|
|
|
__do_global_dtors_aux_1 (void)
|
|
|
|
{
|
|
|
|
atexit (__do_global_dtors_aux);
|
|
|
|
}
|
|
|
|
CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_dtors_aux_1)
|
|
|
|
#endif
|
1994-11-19 05:09:58 +01:00
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if defined(USE_EH_FRAME_REGISTRY) \
|
|
|
|
|| defined(JCR_SECTION_NAME) \
|
|
|
|
|| defined(USE_TM_CLONE_REGISTRY)
|
1997-12-15 08:05:04 +01:00
|
|
|
/* 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. */
|
1997-09-10 20:00:28 +02:00
|
|
|
|
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
2002-01-27 05:18:12 +01:00
|
|
|
static void __attribute__((used))
|
1999-03-23 01:43:51 +01:00
|
|
|
frame_dummy (void)
|
1997-09-10 20:00:28 +02:00
|
|
|
{
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
#ifdef USE_EH_FRAME_REGISTRY
|
1997-12-07 01:31:01 +01:00
|
|
|
static struct object object;
|
2003-06-04 07:21:41 +02:00
|
|
|
#ifdef CRT_GET_RFIB_DATA
|
2001-05-22 18:57:40 +02:00
|
|
|
void *tbase, *dbase;
|
|
|
|
tbase = 0;
|
|
|
|
CRT_GET_RFIB_DATA (dbase);
|
|
|
|
if (__register_frame_info_bases)
|
|
|
|
__register_frame_info_bases (__EH_FRAME_BEGIN__, &object, tbase, dbase);
|
|
|
|
#else
|
1999-02-27 23:21:58 +01:00
|
|
|
if (__register_frame_info)
|
|
|
|
__register_frame_info (__EH_FRAME_BEGIN__, &object);
|
2003-06-04 07:21:41 +02:00
|
|
|
#endif /* CRT_GET_RFIB_DATA */
|
2002-02-05 11:31:06 +01:00
|
|
|
#endif /* USE_EH_FRAME_REGISTRY */
|
2011-11-21 23:10:06 +01:00
|
|
|
|
2001-08-19 05:53:34 +02:00
|
|
|
#ifdef JCR_SECTION_NAME
|
2004-01-21 17:01:26 +01:00
|
|
|
if (__JCR_LIST__[0])
|
|
|
|
{
|
|
|
|
void (*register_classes) (void *) = _Jv_RegisterClasses;
|
|
|
|
__asm ("" : "+r" (register_classes));
|
|
|
|
if (register_classes)
|
|
|
|
register_classes (__JCR_LIST__);
|
|
|
|
}
|
2001-08-19 05:53:34 +02:00
|
|
|
#endif /* JCR_SECTION_NAME */
|
2011-11-21 23:10:06 +01:00
|
|
|
|
|
|
|
#if USE_TM_CLONE_REGISTRY
|
2011-11-26 22:16:49 +01:00
|
|
|
register_tm_clones ();
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_TM_CLONE_REGISTRY */
|
1997-09-10 20:00:28 +02:00
|
|
|
}
|
|
|
|
|
2005-04-29 16:09:45 +02:00
|
|
|
#ifdef INIT_SECTION_ASM_OP
|
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
2002-01-27 05:18:12 +01:00
|
|
|
CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
|
2005-04-29 16:09:45 +02:00
|
|
|
#else /* defined(INIT_SECTION_ASM_OP) */
|
|
|
|
static func_ptr __frame_dummy_init_array_entry[]
|
2011-12-06 22:35:41 +01:00
|
|
|
__attribute__ ((__used__, section(".init_array"), aligned(sizeof(func_ptr))))
|
2005-04-29 16:09:45 +02:00
|
|
|
= { frame_dummy };
|
|
|
|
#endif /* !defined(INIT_SECTION_ASM_OP) */
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */
|
1997-09-10 20:00:28 +02:00
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#else /* OBJECT_FORMAT_ELF */
|
|
|
|
|
1992-03-19 21:41:45 +01:00
|
|
|
/* The function __do_global_ctors_aux is compiled twice (once in crtbegin.o
|
1992-05-13 23:25:51 +02:00
|
|
|
and once in crtend.o). It must be declared static to avoid a link
|
1992-03-19 21:41:45 +01:00
|
|
|
error. Here, we define __do_global_ctors as an externally callable
|
|
|
|
function. It is externally callable so that __main can invoke it when
|
|
|
|
INVOKE__main is defined. This has the additional effect of forcing cc1
|
|
|
|
to switch to the .text section. */
|
1996-07-04 00:07:53 +02:00
|
|
|
|
2000-02-12 20:19:01 +01:00
|
|
|
static void __do_global_ctors_aux (void);
|
1999-03-23 01:43:51 +01:00
|
|
|
void
|
|
|
|
__do_global_ctors (void)
|
1992-05-24 05:32:28 +02:00
|
|
|
{
|
2001-08-21 12:12:07 +02:00
|
|
|
#ifdef INVOKE__main
|
|
|
|
/* If __main won't actually call __do_global_ctors then it doesn't matter
|
|
|
|
what's inside the function. The inside of __do_global_ctors_aux is
|
|
|
|
called automatically in that case. And the Alliant fx2800 linker
|
|
|
|
crashes on this reference. So prevent the crash. */
|
1992-05-24 05:32:28 +02:00
|
|
|
__do_global_ctors_aux ();
|
|
|
|
#endif
|
|
|
|
}
|
1992-03-07 05:32:07 +01:00
|
|
|
|
|
|
|
asm (INIT_SECTION_ASM_OP); /* cc1 doesn't know that we are switching! */
|
|
|
|
|
|
|
|
/* A routine to invoke all of the global constructors upon entry to the
|
|
|
|
program. We put this into the .init section (for systems that have
|
|
|
|
such a thing) so that we can properly perform the construction of
|
2001-10-10 13:33:39 +02:00
|
|
|
file-scope static-storage C++ objects within shared libraries. */
|
1992-03-07 05:32:07 +01:00
|
|
|
|
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
2002-01-27 05:18:12 +01:00
|
|
|
static void __attribute__((used))
|
1999-03-23 01:43:51 +01:00
|
|
|
__do_global_ctors_aux (void) /* prologue goes in .init section */
|
1992-03-07 05:32:07 +01:00
|
|
|
{
|
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
2002-01-27 05:18:12 +01:00
|
|
|
FORCE_CODE_SECTION_ALIGN /* explicit align before switch to .text */
|
1992-03-07 05:32:07 +01:00
|
|
|
asm (TEXT_SECTION_ASM_OP); /* don't put epilogue and body in .init */
|
|
|
|
DO_GLOBAL_CTORS_BODY;
|
1999-09-20 20:59:09 +02:00
|
|
|
atexit (__do_global_dtors);
|
1992-03-07 05:32:07 +01:00
|
|
|
}
|
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#endif /* OBJECT_FORMAT_ELF */
|
1996-10-16 22:25:25 +02:00
|
|
|
|
2001-08-21 12:12:07 +02:00
|
|
|
#elif defined(HAS_INIT_SECTION) /* ! INIT_SECTION_ASM_OP */
|
1996-10-16 22:25:25 +02:00
|
|
|
|
2003-11-21 20:48:24 +01:00
|
|
|
extern void __do_global_dtors (void);
|
|
|
|
|
1996-10-16 22:25:25 +02:00
|
|
|
/* This case is used by the Irix 6 port, which supports named sections but
|
|
|
|
not an SVR4-style .fini section. __do_global_dtors can be non-static
|
1997-09-10 20:00:28 +02:00
|
|
|
in this case because we protect it with -hidden_symbol. */
|
|
|
|
|
1996-10-16 22:25:25 +02:00
|
|
|
void
|
1999-03-23 01:43:51 +01:00
|
|
|
__do_global_dtors (void)
|
1996-10-16 22:25:25 +02:00
|
|
|
{
|
2001-05-22 18:57:40 +02:00
|
|
|
func_ptr *p, f;
|
|
|
|
for (p = __DTOR_LIST__ + 1; (f = *p); p++)
|
|
|
|
f ();
|
1997-09-10 20:00:28 +02:00
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if USE_TM_CLONE_REGISTRY
|
2011-11-26 22:16:49 +01:00
|
|
|
deregister_tm_clones ();
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_TM_CLONE_REGISTRY */
|
|
|
|
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
#ifdef USE_EH_FRAME_REGISTRY
|
1999-02-27 23:21:58 +01:00
|
|
|
if (__deregister_frame_info)
|
|
|
|
__deregister_frame_info (__EH_FRAME_BEGIN__);
|
1997-09-10 20:00:28 +02:00
|
|
|
#endif
|
1996-10-16 22:25:25 +02:00
|
|
|
}
|
1998-01-02 23:50:23 +01:00
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if defined(USE_EH_FRAME_REGISTRY) \
|
|
|
|
|| defined(JCR_SECTION_NAME) \
|
|
|
|
|| defined(USE_TM_CLONE_REGISTRY)
|
2001-08-21 12:12:07 +02:00
|
|
|
/* A helper function for __do_global_ctors, which is in crtend.o. Here
|
|
|
|
in crtbegin.o, we can reference a couple of symbols not visible there.
|
|
|
|
Plus, since we're before libgcc.a, we have no problems referencing
|
|
|
|
functions from there. */
|
1998-01-02 23:50:23 +01:00
|
|
|
void
|
2001-08-21 12:12:07 +02:00
|
|
|
__do_global_ctors_1(void)
|
1998-01-02 23:50:23 +01:00
|
|
|
{
|
configure.in: Check for ld.
* configure.in: Check for ld.
(HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option.
* configure, config.in: Rebuilt.
* config.gcc: Add crtbeginT.o to extra_parts where needed.
* config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc
frame unwinding on Linux.
* config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde
frame unwinding.
* config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static.
* config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define.
* config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't
iterate further if pc falls into current library, but fde was not
found.
* config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static
if using glibc.
(LINK_EH_SPEC): Define.
* config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64):
Use crtbeginT.o for -static.
(LINK_EH_SPEC): Define.
* config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o.
* Makefile.in (crtbeginT.o): Add rule.
* gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
If neither -static-libgcc nor -shared-libgcc is passed and -shared,
use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
If none of the above switches are passed, use -lgcc -lgcc_eh.
(init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.
* mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if
creating libgcc_s.so, put them into separate libgcc_eh.a instead.
* unwind-dw2-fde.c: Don't include any headers if this file
is included from other .c file.
* unwind-dw2-fde-glibc.c: New file.
* crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define.
Use it instead of EH_FRAME_SECTION_NAME where appropriate.
From-SVN: r48039
2001-12-15 12:49:18 +01:00
|
|
|
#ifdef USE_EH_FRAME_REGISTRY
|
1998-01-02 23:50:23 +01:00
|
|
|
static struct object object;
|
1999-02-27 23:21:58 +01:00
|
|
|
if (__register_frame_info)
|
|
|
|
__register_frame_info (__EH_FRAME_BEGIN__, &object);
|
1992-03-19 21:41:45 +01:00
|
|
|
#endif
|
2011-11-21 23:10:06 +01:00
|
|
|
|
2001-08-09 01:33:51 +02:00
|
|
|
#ifdef JCR_SECTION_NAME
|
2004-01-21 17:01:26 +01:00
|
|
|
if (__JCR_LIST__[0])
|
|
|
|
{
|
|
|
|
void (*register_classes) (void *) = _Jv_RegisterClasses;
|
|
|
|
__asm ("" : "+r" (register_classes));
|
|
|
|
if (register_classes)
|
|
|
|
register_classes (__JCR_LIST__);
|
|
|
|
}
|
2001-08-19 05:53:34 +02:00
|
|
|
#endif
|
2011-11-21 23:10:06 +01:00
|
|
|
|
|
|
|
#if USE_TM_CLONE_REGISTRY
|
2011-11-26 22:16:49 +01:00
|
|
|
register_tm_clones ();
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_TM_CLONE_REGISTRY */
|
2001-08-19 05:53:34 +02:00
|
|
|
}
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */
|
2001-08-09 01:33:51 +02:00
|
|
|
|
2001-08-21 12:12:07 +02:00
|
|
|
#else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
|
|
|
|
#error "What are you doing with crtstuff.c, then?"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(CRT_END) /* ! CRT_BEGIN */
|
|
|
|
|
2011-08-20 22:02:17 +02:00
|
|
|
/* No need for .ctors/.dtors section if linker can place them in
|
|
|
|
.init_array/.fini_array section. */
|
|
|
|
#ifndef USE_INITFINI_ARRAY
|
2001-08-21 12:12:07 +02:00
|
|
|
/* Put a word containing zero at the end of each of our two lists of function
|
|
|
|
addresses. Note that the words defined here go into the .ctors and .dtors
|
|
|
|
sections of the crtend.o file, and since that file is always linked in
|
|
|
|
last, these words naturally end up at the very ends of the two lists
|
|
|
|
contained in these two sections. */
|
|
|
|
|
|
|
|
#ifdef CTOR_LIST_END
|
|
|
|
CTOR_LIST_END;
|
|
|
|
#elif defined(CTORS_SECTION_ASM_OP)
|
|
|
|
/* Hack: force cc1 to switch to .data section early, so that assembling
|
|
|
|
__CTOR_LIST__ does not undo our behind-the-back change to .ctors. */
|
2010-05-10 17:53:04 +02:00
|
|
|
static func_ptr force_to_data[1] __attribute__ ((__used__)) = { };
|
2001-08-21 12:12:07 +02:00
|
|
|
asm (CTORS_SECTION_ASM_OP);
|
|
|
|
STATIC func_ptr __CTOR_END__[1]
|
|
|
|
__attribute__((aligned(sizeof(func_ptr))))
|
|
|
|
= { (func_ptr) 0 };
|
|
|
|
#else
|
|
|
|
STATIC func_ptr __CTOR_END__[1]
|
|
|
|
__attribute__((section(".ctors"), aligned(sizeof(func_ptr))))
|
|
|
|
= { (func_ptr) 0 };
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DTOR_LIST_END
|
|
|
|
DTOR_LIST_END;
|
2007-05-04 21:20:28 +02:00
|
|
|
#elif defined(HIDDEN_DTOR_LIST_END)
|
|
|
|
#ifdef DTORS_SECTION_ASM_OP
|
|
|
|
asm (DTORS_SECTION_ASM_OP);
|
|
|
|
#endif
|
|
|
|
func_ptr __DTOR_END__[1]
|
2010-05-11 17:44:26 +02:00
|
|
|
__attribute__ ((used,
|
2007-05-04 21:20:28 +02:00
|
|
|
#ifndef DTORS_SECTION_ASM_OP
|
|
|
|
section(".dtors"),
|
|
|
|
#endif
|
|
|
|
aligned(sizeof(func_ptr)), visibility ("hidden")))
|
|
|
|
= { (func_ptr) 0 };
|
2001-08-21 12:12:07 +02:00
|
|
|
#elif defined(DTORS_SECTION_ASM_OP)
|
|
|
|
asm (DTORS_SECTION_ASM_OP);
|
|
|
|
STATIC func_ptr __DTOR_END__[1]
|
2010-05-11 17:44:26 +02:00
|
|
|
__attribute__ ((used, aligned(sizeof(func_ptr))))
|
2001-08-21 12:12:07 +02:00
|
|
|
= { (func_ptr) 0 };
|
|
|
|
#else
|
|
|
|
STATIC func_ptr __DTOR_END__[1]
|
2010-05-11 17:44:26 +02:00
|
|
|
__attribute__((used, section(".dtors"), aligned(sizeof(func_ptr))))
|
2001-08-21 12:12:07 +02:00
|
|
|
= { (func_ptr) 0 };
|
|
|
|
#endif
|
2011-08-20 22:02:17 +02:00
|
|
|
#endif /* USE_INITFINI_ARRAY */
|
1992-03-07 05:32:07 +01:00
|
|
|
|
2001-08-21 12:12:07 +02:00
|
|
|
#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. */
|
2004-10-14 01:31:23 +02:00
|
|
|
# if __INT_MAX__ == 2147483647
|
|
|
|
typedef int int32;
|
|
|
|
# elif __LONG_MAX__ == 2147483647
|
|
|
|
typedef long int32;
|
|
|
|
# elif __SHRT_MAX__ == 2147483647
|
|
|
|
typedef short int32;
|
|
|
|
# else
|
|
|
|
# error "Missing a 4 byte integer"
|
|
|
|
# endif
|
|
|
|
STATIC EH_FRAME_SECTION_CONST int32 __FRAME_END__[]
|
2010-05-11 17:44:26 +02:00
|
|
|
__attribute__ ((used, section(EH_FRAME_SECTION_NAME),
|
2004-10-14 01:31:23 +02:00
|
|
|
aligned(sizeof(int32))))
|
2001-08-21 12:12:07 +02:00
|
|
|
= { 0 };
|
2001-10-26 03:51:01 +02:00
|
|
|
#endif /* EH_FRAME_SECTION_NAME */
|
2001-08-21 12:12:07 +02:00
|
|
|
|
|
|
|
#ifdef JCR_SECTION_NAME
|
|
|
|
/* Null terminate the .jcr section array. */
|
2009-11-25 11:55:54 +01:00
|
|
|
STATIC void *__JCR_END__[1]
|
2010-05-11 17:44:26 +02:00
|
|
|
__attribute__ ((used, section(JCR_SECTION_NAME),
|
2001-08-21 12:12:07 +02:00
|
|
|
aligned(sizeof(void *))))
|
|
|
|
= { 0 };
|
|
|
|
#endif /* JCR_SECTION_NAME */
|
1992-03-07 05:32:07 +01:00
|
|
|
|
2011-11-21 23:10:06 +01:00
|
|
|
#if USE_TM_CLONE_REGISTRY
|
2011-11-26 22:16:49 +01:00
|
|
|
# ifndef HAVE_GAS_HIDDEN
|
|
|
|
static
|
|
|
|
# endif
|
2011-11-21 23:10:06 +01:00
|
|
|
func_ptr __TMC_END__[]
|
2011-11-26 22:16:49 +01:00
|
|
|
__attribute__((used, section(".tm_clone_table"), aligned(sizeof(void *))))
|
|
|
|
# ifdef HAVE_GAS_HIDDEN
|
|
|
|
__attribute__((__visibility__ ("hidden"))) = { };
|
|
|
|
# else
|
|
|
|
= { 0, 0 };
|
|
|
|
# endif
|
2011-11-21 23:10:06 +01:00
|
|
|
#endif /* USE_TM_CLONE_REGISTRY */
|
|
|
|
|
2005-04-29 16:09:45 +02:00
|
|
|
#ifdef INIT_ARRAY_SECTION_ASM_OP
|
|
|
|
|
|
|
|
/* If we are using .init_array, there is nothing to do. */
|
|
|
|
|
|
|
|
#elif defined(INIT_SECTION_ASM_OP)
|
1992-03-07 05:32:07 +01:00
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#ifdef OBJECT_FORMAT_ELF
|
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
2002-01-27 05:18:12 +01:00
|
|
|
static void __attribute__((used))
|
1999-03-23 01:43:51 +01:00
|
|
|
__do_global_ctors_aux (void)
|
1994-11-19 05:09:58 +01:00
|
|
|
{
|
|
|
|
func_ptr *p;
|
|
|
|
for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
|
|
|
|
(*p) ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Stick a call to __do_global_ctors_aux into the .init section. */
|
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
2002-01-27 05:18:12 +01:00
|
|
|
CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_ctors_aux)
|
1994-11-19 05:09:58 +01:00
|
|
|
#else /* OBJECT_FORMAT_ELF */
|
|
|
|
|
|
|
|
/* Stick the real initialization code, followed by a normal sort of
|
|
|
|
function epilogue at the very end of the .init section for this
|
|
|
|
entire root executable file or for this entire shared library file.
|
|
|
|
|
|
|
|
Note that we use some tricks here to get *just* the body and just
|
|
|
|
a function epilogue (but no function prologue) into the .init
|
1995-05-16 14:39:54 +02:00
|
|
|
section of the crtend.o file. Specifically, we switch to the .text
|
1994-11-19 05:09:58 +01:00
|
|
|
section, start to define a function, and then we switch to the .init
|
|
|
|
section just before the body code.
|
|
|
|
|
|
|
|
Earlier on, we put the corresponding function prologue into the .init
|
|
|
|
section of the crtbegin.o file (which will be linked in first).
|
|
|
|
|
|
|
|
Note that we want to invoke all constructors for C++ file-scope static-
|
|
|
|
storage objects AFTER any other possible initialization actions which
|
|
|
|
may be performed by the code in the .init section contributions made by
|
|
|
|
other libraries, etc. That's because those other initializations may
|
|
|
|
include setup operations for very primitive things (e.g. initializing
|
|
|
|
the state of the floating-point coprocessor, etc.) which should be done
|
1996-07-04 00:07:53 +02:00
|
|
|
before we start to execute any of the user's code. */
|
1992-03-07 05:32:07 +01:00
|
|
|
|
|
|
|
static void
|
1999-03-23 01:43:51 +01:00
|
|
|
__do_global_ctors_aux (void) /* prologue goes in .text section */
|
1992-03-07 05:32:07 +01:00
|
|
|
{
|
|
|
|
asm (INIT_SECTION_ASM_OP);
|
|
|
|
DO_GLOBAL_CTORS_BODY;
|
1999-09-20 20:59:09 +02:00
|
|
|
atexit (__do_global_dtors);
|
1998-04-04 15:32:39 +02:00
|
|
|
} /* epilogue and body go in .init section */
|
|
|
|
|
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
2002-01-27 05:18:12 +01:00
|
|
|
FORCE_CODE_SECTION_ALIGN
|
1998-04-04 15:32:39 +02:00
|
|
|
asm (TEXT_SECTION_ASM_OP);
|
1992-03-07 05:32:07 +01:00
|
|
|
|
1994-11-19 05:09:58 +01:00
|
|
|
#endif /* OBJECT_FORMAT_ELF */
|
|
|
|
|
2001-08-21 12:12:07 +02:00
|
|
|
#elif defined(HAS_INIT_SECTION) /* ! INIT_SECTION_ASM_OP */
|
1996-10-16 22:25:25 +02:00
|
|
|
|
2003-11-21 20:48:24 +01:00
|
|
|
extern void __do_global_ctors (void);
|
|
|
|
|
1996-10-16 22:25:25 +02:00
|
|
|
/* This case is used by the Irix 6 port, which supports named sections but
|
|
|
|
not an SVR4-style .init section. __do_global_ctors can be non-static
|
1997-09-10 20:00:28 +02:00
|
|
|
in this case because we protect it with -hidden_symbol. */
|
1996-10-16 22:25:25 +02:00
|
|
|
void
|
1999-03-23 01:43:51 +01:00
|
|
|
__do_global_ctors (void)
|
1996-10-16 22:25:25 +02:00
|
|
|
{
|
|
|
|
func_ptr *p;
|
2011-11-21 23:10:06 +01:00
|
|
|
#if defined(USE_EH_FRAME_REGISTRY) \
|
|
|
|
|| defined(JCR_SECTION_NAME) \
|
|
|
|
|| defined(USE_TM_CLONE_REGISTRY)
|
2001-08-21 12:12:07 +02:00
|
|
|
__do_global_ctors_1();
|
1997-09-10 20:00:28 +02:00
|
|
|
#endif
|
1996-10-16 22:25:25 +02:00
|
|
|
for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--)
|
|
|
|
(*p) ();
|
|
|
|
}
|
1994-11-19 05:09:58 +01:00
|
|
|
|
2001-08-21 12:12:07 +02:00
|
|
|
#else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
|
|
|
|
#error "What are you doing with crtstuff.c, then?"
|
1992-03-19 21:41:45 +01:00
|
|
|
#endif
|
1992-03-07 05:32:07 +01:00
|
|
|
|
2001-08-21 12:12:07 +02:00
|
|
|
#else /* ! CRT_BEGIN && ! CRT_END */
|
|
|
|
#error "One of CRT_BEGIN or CRT_END must be defined."
|
1992-03-19 21:41:45 +01:00
|
|
|
#endif
|