Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
glibc.i686
glibc-2.16-powerpc-initfini.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File glibc-2.16-powerpc-initfini.patch of Package glibc.i686
commit 3add8e1353d62d77fdd9b4ca363cdfe7006b0efb Author: Joseph Myers <joseph@codesourcery.com> Date: Wed Feb 8 01:45:26 2012 +0000 Support crti.S and crtn.S provided directly by architectures. 2012-02-08 Joseph Myers <joseph@codesourcery.com> Support crti.S and crtn.S provided directly by architectures. * csu/Makefile [crti.S in sysdirs] (generated): Do not append. [crti.S in sysdirs] (omit-deps): Likewise. [crti.S in sysdirs] (CFLAGS-initfini.s): Do not define variable. [crti.S in sysdirs] ($(crtstuff:%=$(objpfx)%.o)): Disable rule. [crti.S in sysdirs] ($(objpfx)initfini.s): Likewise. [crti.S in sysdirs] ($(objpfx)crti.S): Likewise. [crti.S in sysdirs] ($(objpfx)crtn.S): Likewise. [crti.S in sysdirs] ($(patsubst %,$(objpfx)crt%.o,i n)): Likewise. [crti.S in sysdirs] ($(objpfx)defs.h): Likewise. [crti.S in sysdirs] (initfini.c): Remove vpath directive. * sysdeps/i386/crti.S, sysdeps/i386/crtn.S: New files, based on compiler output for sysdeps/generic/initfini.c. * sysdeps/i386/elf/Makefile: Remove file. * sysdeps/i386/Makefile (CFLAGS-initfini.s): Remove variable. Index: glibc-2.15/csu/Makefile =================================================================== --- glibc-2.15.orig/csu/Makefile +++ glibc-2.15/csu/Makefile @@ -75,10 +75,6 @@ before-compile += $(objpfx)abi-tag.h generated += abi-tag.h endif -ifeq ($(have-initfini),yes) - -CPPFLAGS += -DHAVE_INITFINI - # These are the special initializer/finalizer files. They are always the # first and last file in the link. crti.o ... crtn.o define the global # "functions" _init and _fini to run the .init and .fini sections. @@ -86,6 +82,13 @@ crtstuff = crti crtn install-lib += $(crtstuff:=.o) extra-objs += $(crtstuff:=.o) + +# Conditionals on the existence of a sysdeps version of crti.S are +# temporary until all targets either have such a file or have been +# removed, after which the old approach of postprocessing compiler +# output will be removed. +ifeq (,$(wildcard $(sysdirs:%=%/crti.S))) + generated += $(crtstuff:=.S) initfini.s defs.h omit-deps += $(crtstuff) Index: glibc-2.15/nptl/Makefile =================================================================== --- glibc-2.15.orig/nptl/Makefile +++ glibc-2.15/nptl/Makefile @@ -335,15 +335,22 @@ ifneq (,$(patsubst .,,$(multidir))) generated-dirs := $(firstword $(subst /, , $(multidir))) crti-objs += $(multidir)/crti.o crtn-objs += $(multidir)/crtn.o +# Conditionals on the existence of a sysdeps version of crti.S are +# temporary until all targets either have such a file or have been +# removed, after which the old approach of postprocessing compiler +# output will be removed. +ifeq (,$(wildcard $(sysdirs:%=%/crti.S))) omit-deps += $(multidir)/crti $(multidir)/crtn +endif $(objpfx)$(multidir): mkdir -p $@ endif extra-objs += $(crti-objs) $(crtn-objs) +ifeq (,$(wildcard $(sysdirs:%=%/crti.S))) omit-deps += crti crtn - CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time) -fno-unwind-tables -fno-asynchronous-unwind-tables endif +endif CFLAGS-flockfile.c = -D_IO_MTSAFE_IO CFLAGS-ftrylockfile.c = -D_IO_MTSAFE_IO @@ -543,15 +550,24 @@ $(addprefix $(objpfx),$(tests) $(test-sr endif ifeq ($(build-shared),yes) +ifeq (,$(wildcard $(sysdirs:%=%/crti.S))) vpath pt-initfini.c $(sysdirs) $(objpfx)pt-initfini.s: pt-initfini.c $(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \ $(patsubst -f%,-fno-%,$(exceptions)) -o $@ +endif $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0 $(make-test-out) 2>&1 | cmp - tst-cleanup0.expect > $@ +ifneq (,$(wildcard $(sysdirs:%=%/crti.S))) + +$(objpfx)crti.o: $(objpfx)pt-crti.o + ln -f $< $@ + +else + # We only have one kind of startup code files. Static binaries and # shared libraries are build using the PIC version. $(objpfx)crti.S: $(objpfx)pt-initfini.s @@ -573,6 +589,8 @@ $(objpfx)crti.o: $(objpfx)crti.S $(objpf $(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h $(compile.S) -g0 $(ASFLAGS-.os) -o $@ +endif + ifneq ($(multidir),.) $(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)/ ln -f $< $@ Index: glibc-2.15/nptl/pt-crti.S =================================================================== --- /dev/null +++ glibc-2.15/nptl/pt-crti.S @@ -0,0 +1,44 @@ +/* Special .init and .fini section support for libpthread. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Arrange for __pthread_initialize_minimal_internal to be called at + libpthread startup, instead of conditionally calling + __gmon_start__. */ + +#define PREINIT_FUNCTION __pthread_initialize_minimal_internal +#define PREINIT_FUNCTION_WEAK 0 + +#include <crti.S> Index: glibc-2.15/sysdeps/i386/Makefile =================================================================== --- glibc-2.15.orig/sysdeps/i386/Makefile +++ glibc-2.15/sysdeps/i386/Makefile @@ -5,12 +5,6 @@ asm-CPPFLAGS += -DGAS_SYNTAX # The i386 `long double' is a distinct type we support. long-double-fcts = yes -ifeq ($(subdir),csu) -# On i686 we must avoid generating the trampoline functions generated -# to get the GOT pointer. -CFLAGS-initfini.s += -march=i386 -mtune=i386 -endif - ifeq ($(subdir),gmon) sysdep_routines += i386-mcount endif Index: glibc-2.15/sysdeps/i386/crti.S =================================================================== --- /dev/null +++ glibc-2.15/sysdeps/i386/crti.S @@ -0,0 +1,85 @@ +/* Special .init and .fini section support for x86. + Copyright (C) 1995-2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* crti.S puts a function prologue at the beginning of the .init and + .fini sections and defines global symbols for those addresses, so + they can be called as functions. The symbols _init and _fini are + magic and cause the linker to emit DT_INIT and DT_FINI. */ + +#include <libc-symbols.h> +#include <sysdep.h> + +#ifndef PREINIT_FUNCTION +# define PREINIT_FUNCTION __gmon_start__ +#endif + +#ifndef PREINIT_FUNCTION_WEAK +# define PREINIT_FUNCTION_WEAK 1 +#endif + +#if PREINIT_FUNCTION_WEAK + weak_extern (PREINIT_FUNCTION) +#else + .hidden PREINIT_FUNCTION +#endif + + .section .init,"ax",@progbits + .p2align 2 + .globl _init + .type _init, @function +_init: + pushl %ebx + /* Maintain 16-byte stack alignment for called functions. */ + subl $8, %esp + LOAD_PIC_REG (bx) +#if PREINIT_FUNCTION_WEAK + movl PREINIT_FUNCTION@GOT(%ebx), %eax + testl %eax, %eax + je .Lno_weak_fn + call PREINIT_FUNCTION@PLT +.Lno_weak_fn: +#else + call PREINIT_FUNCTION +#endif + + .section .fini,"ax",@progbits + .p2align 2 + .globl _fini + .type _fini, @function +_fini: + pushl %ebx + subl $8, %esp + LOAD_PIC_REG (bx) Index: glibc-2.15/sysdeps/i386/crtn.S =================================================================== --- /dev/null +++ glibc-2.15/sysdeps/i386/crtn.S @@ -0,0 +1,48 @@ +/* Special .init and .fini section support for x86. + Copyright (C) 1995-2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* crtn.S puts function epilogues in the .init and .fini sections + corresponding to the prologues in crti.S. */ + + .section .init,"ax",@progbits + addl $8, %esp + popl %ebx + ret + + .section .fini,"ax",@progbits + addl $8, %esp + popl %ebx + ret Index: glibc-2.15/sysdeps/i386/elf/Makefile =================================================================== --- glibc-2.15.orig/sysdeps/i386/elf/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -ifeq ($(subdir),csu) -# Turn off -fasynchronous-unwind-tables -CFLAGS-initfini.s += -fno-asynchronous-unwind-tables -endif Index: glibc-2.15/Makeconfig =================================================================== --- glibc-2.15.orig/Makeconfig +++ glibc-2.15/Makeconfig @@ -394,11 +394,6 @@ ifndef asm-CPPFLAGS asm-CPPFLAGS = endif -# ELF always supports init/fini sections -ifeq ($(elf),yes) -have-initfini = yes -endif - ifeq ($(have-as-needed),yes) as-needed := -Wl,--as-needed no-as-needed := -Wl,--no-as-needed @@ -412,14 +407,8 @@ no-whole-archive = -Wl,--no-whole-archiv whole-archive = -Wl,--whole-archive # Installed name of the startup code. -ifneq ($(have-initfini),yes) -# When not having init/fini, there is just one startfile, called crt0.o. -start-installed-name = crt0.o -else -# On systems having init/fini, crt0.o is called crt1.o, and there are -# some additional bizarre files. +# The ELF convention is that the startfile is called crt1.o start-installed-name = crt1.o -endif # On systems that do not need a special startfile for statically linked # binaries, simply set it to the normal name. ifndef static-start-installed-name Index: glibc-2.15/config.h.in =================================================================== --- glibc-2.15.orig/config.h.in +++ glibc-2.15/config.h.in @@ -42,9 +42,6 @@ assembler instructions per line. Default is `;' */ #undef ASM_LINE_SEP -/* Define if not using ELF, but `.init' and `.fini' sections are available. */ -#undef HAVE_INITFINI - /* Define if __attribute__((section("foo"))) puts quotes around foo. */ #undef HAVE_SECTION_QUOTES Index: glibc-2.15/config.make.in =================================================================== --- glibc-2.15.orig/config.make.in +++ glibc-2.15/config.make.in @@ -48,11 +48,9 @@ all-warnings = @all_warnings@ elf = @elf@ have-z-combreloc = @libc_cv_z_combreloc@ have-z-execstack = @libc_cv_z_execstack@ -have-initfini = @libc_cv_have_initfini@ have-Bgroup = @libc_cv_Bgroup@ have-as-needed = @libc_cv_as_needed@ libgcc_s_suffix = @libc_cv_libgcc_s_suffix@ -need-nopic-initfini = @nopic_initfini@ with-fp = @with_fp@ old-glibc-headers = @old_glibc_headers@ unwind-find-fde = @libc_cv_gcc_unwind_find_fde@ Index: glibc-2.15/configure =================================================================== --- glibc-2.15.orig/configure +++ glibc-2.15/configure @@ -610,7 +610,6 @@ RELEASE VERSION mach_interface_list DEFINES -nopic_initfini static_nss bounded omitfp @@ -7995,7 +7994,6 @@ $as_echo "$libc_cv_pic_default" >&6; } - Index: glibc-2.15/configure.in =================================================================== --- glibc-2.15.orig/configure.in +++ glibc-2.15/configure.in @@ -2377,7 +2377,6 @@ AC_SUBST(profile) AC_SUBST(omitfp) AC_SUBST(bounded) AC_SUBST(static_nss) -AC_SUBST(nopic_initfini) AC_SUBST(DEFINES) Index: glibc-2.15/csu/gmon-start.c =================================================================== --- glibc-2.15.orig/csu/gmon-start.c +++ glibc-2.15/csu/gmon-start.c @@ -1,5 +1,5 @@ /* Code to enable profiling at program startup. - Copyright (C) 1995,1996,1997,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,2000,2001,2002,2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -43,23 +43,14 @@ extern char etext[]; # endif #endif -#ifndef HAVE_INITFINI -/* This function gets called at startup by the normal constructor - mechanism. We link this file together with start.o to produce gcrt1.o, - so this constructor will be first in the list. */ - -extern void __gmon_start__ (void) __attribute__ ((constructor)); -#else -/* In ELF and COFF, we cannot use the normal constructor mechanism to call +/* We cannot use the normal constructor mechanism to call __gmon_start__ because gcrt1.o appears before crtbegin.o in the link. - Instead crti.o calls it specially (see initfini.c). */ + Instead crti.o calls it specially. */ extern void __gmon_start__ (void); -#endif void __gmon_start__ (void) { -#ifdef HAVE_INITFINI /* Protect from being called more than once. Since crti.o is linked into every shared library, each of their init functions will call us. */ static int called; @@ -68,7 +59,6 @@ __gmon_start__ (void) return; called = 1; -#endif /* Start keeping profiling records. */ __monstartup ((u_long) TEXT_START, (u_long) &etext); Index: glibc-2.15/sysdeps/powerpc/powerpc32/crti.S =================================================================== --- /dev/null +++ glibc-2.15/sysdeps/powerpc/powerpc32/crti.S @@ -0,0 +1,90 @@ +/* Special .init and .fini section support for PowerPC. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* crti.S puts a function prologue at the beginning of the .init and + .fini sections and defines global symbols for those addresses, so + they can be called as functions. The symbols _init and _fini are + magic and cause the linker to emit DT_INIT and DT_FINI. */ + +#include <libc-symbols.h> +#include <sysdep.h> + +#ifndef PREINIT_FUNCTION +# define PREINIT_FUNCTION __gmon_start__ +#endif + +#ifndef PREINIT_FUNCTION_WEAK +# define PREINIT_FUNCTION_WEAK 1 +#endif + +#if PREINIT_FUNCTION_WEAK + weak_extern (PREINIT_FUNCTION) +#else + .hidden PREINIT_FUNCTION +#endif + + .section .init,"ax",@progbits + .align 2 + .globl _init + .type _init, @function +_init: + stwu r1, -16(r1) + mflr r0 + stw r0, 20(r1) + stw r30, 8(r1) + SETUP_GOT_ACCESS (r30, .Lgot_label_i) + addis r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@ha + addi r30, r30, _GLOBAL_OFFSET_TABLE_-.Lgot_label_i@l +#if PREINIT_FUNCTION_WEAK + lwz r0, PREINIT_FUNCTION@got(r30) + cmpwi cr7, r0, 0 + beq+ cr7, 1f + bl PREINIT_FUNCTION@plt +1: +#else + bl PREINIT_FUNCTION@local +#endif + + .section .fini,"ax",@progbits + .align 2 + .globl _fini + .type _fini, @function +_fini: + stwu r1, -16(r1) + mflr r0 + stw r0, 20(r1) + stw r30, 8(r1) + SETUP_GOT_ACCESS (r30, .Lgot_label_f) Index: glibc-2.15/sysdeps/powerpc/powerpc32/crtn.S =================================================================== --- /dev/null +++ glibc-2.15/sysdeps/powerpc/powerpc32/crtn.S @@ -0,0 +1,54 @@ +/* Special .init and .fini section support for PowerPC. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* crtn.S puts function epilogues in the .init and .fini sections + corresponding to the prologues in crti.S. */ + +#include <sysdep.h> + + .section .init,"ax",@progbits + lwz r0, 20(r1) + mtlr r0 + lwz r30, 8(r1) + addi r1, r1, 16 + blr + + .section .fini,"ax",@progbits + lwz r0, 20(r1) + mtlr r0 + lwz r30, 8(r1) + addi r1, r1, 16 + blr Index: glibc-2.15/sysdeps/powerpc/powerpc64/crti.S =================================================================== --- /dev/null +++ glibc-2.15/sysdeps/powerpc/powerpc64/crti.S @@ -0,0 +1,107 @@ +/* Special .init and .fini section support for PowerPC64. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* crti.S puts a function prologue at the beginning of the .init and + .fini sections and defines global symbols for those addresses, so + they can be called as functions. The symbols _init and _fini are + magic and cause the linker to emit DT_INIT and DT_FINI. */ + +#include <libc-symbols.h> +#include <sysdep.h> + +#ifndef PREINIT_FUNCTION +# define PREINIT_FUNCTION __gmon_start__ +#endif + +#ifndef PREINIT_FUNCTION_WEAK +# define PREINIT_FUNCTION_WEAK 1 +#endif + +#if PREINIT_FUNCTION_WEAK + weak_extern (PREINIT_FUNCTION) +#else + .hidden PREINIT_FUNCTION +#endif + +#if PREINIT_FUNCTION_WEAK + .section ".toc", "aw" +.LC0: + .tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION +#endif + .type BODY_LABEL (_init), @function + .globl _init + .section ".opd", "aw" + .align 3 +_init: OPD_ENT (_init) +#ifdef HAVE_ASM_GLOBAL_DOT_NAME + .globl BODY_LABEL (_init) + .size _init, 24 +#else + .type _init, @function +#endif + .section ".init", "ax", @progbits + .align ALIGNARG (2) +BODY_LABEL (_init): + mflr 0 + std 0, 16(r1) + stdu r1, -112(r1) +#if PREINIT_FUNCTION_WEAK + addis r9, r2, .LC0@toc@ha + ld r0, .LC0@toc@l(r9) + cmpdi cr7, r0, 0 + beq+ cr7, 1f +#endif + bl JUMPTARGET (PREINIT_FUNCTION) + nop +1: + + .type BODY_LABEL (_fini), @function + .globl _fini + .section ".opd", "aw" + .align 3 +_fini: OPD_ENT (_fini) +#ifdef HAVE_ASM_GLOBAL_DOT_NAME + .globl BODY_LABEL (_fini) + .size _fini, 24 +#else + .type _fini, @function +#endif + .section ".fini", "ax", @progbits + .align ALIGNARG (2) +BODY_LABEL (_fini): + mflr 0 + std 0, 16(r1) + stdu r1, -112(r1) Index: glibc-2.15/sysdeps/powerpc/powerpc64/crtn.S =================================================================== --- /dev/null +++ glibc-2.15/sysdeps/powerpc/powerpc64/crtn.S @@ -0,0 +1,52 @@ +/* Special .init and .fini section support for PowerPC64. + Copyright (C) 2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + In addition to the permissions in the GNU Lesser General Public + License, the Free Software Foundation gives you unlimited + permission to link the compiled version of this file with other + programs, and to distribute those programs without any restriction + coming from the use of this file. (The GNU Lesser General Public + License restrictions do apply in other respects; for example, they + cover modification of the file, and distribution when not linked + into another program.) + + Note that people who make modified versions of this file are not + obligated to grant this special exception for their modified + versions; it is their choice whether to do so. The GNU Lesser + General Public License gives permission to release a modified + version without this exception; this exception also makes it + possible to release a modified version which carries forward this + exception. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* crtn.S puts function epilogues in the .init and .fini sections + corresponding to the prologues in crti.S. */ + +#include <sysdep.h> + + .section .init,"ax",@progbits + addi r1, r1, 112 + ld r0, 16(r1) + mtlr r0 + blr + + .section .fini,"ax",@progbits + addi r1, r1, 112 + ld r0, 16(r1) + mtlr r0 + blr
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor