changeset 6272:2c912cc5293f

Fix linux-x86::glibc-core (glibc-2.3) linuxthreads crti.S
author Masamichi Hosoda <trueroad@users.noreply.github.com>
date Wed, 12 Nov 2014 22:43:08 +0900
parents 9cf230339b9d
children 90c52d104e6f
files gub/specs/glibc.py patches/glibc-2.3-linuxthreads-crti-crtn.patch
diffstat 2 files changed, 106 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gub/specs/glibc.py	Mon Nov 10 23:18:14 2014 +0900
+++ b/gub/specs/glibc.py	Wed Nov 12 22:43:08 2014 +0900
@@ -55,6 +55,7 @@
         'glibc-2.3-i386-crti-crtn.patch',
         'glibc-2.3-misc-sys-cdefs-inline.patch',
         'glibc-2.3-elf-Makefile.patch',
+        'glibc-2.3-linuxthreads-crti-crtn.patch',
         ]
     dependencies = ['cross/gcc', 'glibc-core', 'tools::bison', 'tools::gzip', 'tools::perl', 'linux-headers']
     configure_flags = (target.AutoBuild.configure_flags + misc.join_lines ('''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/glibc-2.3-linuxthreads-crti-crtn.patch	Wed Nov 12 22:43:08 2014 +0900
@@ -0,0 +1,105 @@
+This linuxthreads patch was created based on the following nptl patch.
+
+http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3add8e1353d62d77fdd9b4ca363cdfe7006b0efb
+
+--- a/linuxthreads/Makefile	2005-02-16 20:26:38.000000000 +0900
++++ b/linuxthreads/Makefile	2014-11-12 18:47:29.238567100 +0900
+@@ -97,13 +97,21 @@
+ 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
++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)
+ endif
++endif
+ 
+ librt-tests = ex10 ex11 tst-clock1
+ tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \
+@@ -268,11 +276,20 @@
+ endif
+ 
+ ifeq ($(build-shared),yes)
++ifeq (,$(wildcard $(sysdirs:%=%/crti.S)))
+ vpath pt-initfini.c $(full_config_sysdirs)
+ 
+ $(objpfx)pt-initfini.s: pt-initfini.c
+ 	$(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \
+ 		$(patsubst -f%,-fno-%,$(exceptions)) -o $@
++endif
++
++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.
+@@ -295,6 +312,8 @@
+ $(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
+ 	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+ 
++endif
++
+ ifneq ($(multidir),.)
+ $(objpfx)$(multidir):
+ 	@mkdir -p $(objpfx)$(multidir)
+--- /dev/null	2014-10-25 23:44:22.000000000 +0900
++++ b/linuxthreads/pt-crti.S	2014-10-25 23:43:18.445954300 +0900
+@@ -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
++#define PREINIT_FUNCTION_WEAK 0
++
++#include <crti.S>