summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2012-08-15 23:09:00 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-21 12:15:31 +0100
commit709aac9d25170b6a05d7904727bd7a06bb30f959 (patch)
tree1ee76856d82618078ff1982faac5caadf69d7c04
parent3435ce1586d9a6af79f47c5a2dc6d7f225b50b98 (diff)
downloadpoky-709aac9d25170b6a05d7904727bd7a06bb30f959.tar.gz
eglibc-2.16: Remove build dependency on libgcc_s and libgcc_eh
This patch backports two patches from glibc trunk essentially dropping the requirements to have libgcc_s and libgcc_eh this will simplify the toolchain bootstrap sequence. (From OE-Core rev: 9591c93c20af236fdc1a99b548435b6df75af497) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.16/0001-Add-ARM-specific-static-stubs.c.patch27
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.16/0001-Avoid-use-of-libgcc_s-and-libgcc_eh-when-building-gl.patch343
-rw-r--r--meta/recipes-core/eglibc/eglibc_2.16.bb4
3 files changed, 373 insertions, 1 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-2.16/0001-Add-ARM-specific-static-stubs.c.patch b/meta/recipes-core/eglibc/eglibc-2.16/0001-Add-ARM-specific-static-stubs.c.patch
new file mode 100644
index 0000000000..7186f898ee
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.16/0001-Add-ARM-specific-static-stubs.c.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Backport
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4
5From c57a67e03368687fc0d2ae8354cd1b347a61ea44 Mon Sep 17 00:00:00 2001
6From: Joseph Myers <joseph@codesourcery.com>
7Date: Thu, 5 Jul 2012 22:16:03 +0000
8Subject: [PATCH] Add ARM-specific static-stubs.c.
9
10---
11 ports/ChangeLog.arm | 4 ++++
12 ports/sysdeps/arm/static-stubs.c | 7 +++++++
13 2 files changed, 11 insertions(+)
14 create mode 100644 ports/sysdeps/arm/static-stubs.c
15
16Index: libc/ports/sysdeps/arm/static-stubs.c
17===================================================================
18--- /dev/null 1970-01-01 00:00:00.000000000 +0000
19+++ libc/ports/sysdeps/arm/static-stubs.c 2012-08-15 15:04:59.687669241 -0700
20@@ -0,0 +1,7 @@
21+/* When building with GCC with static-only libgcc, the dummy
22+ _Unwind_Resume from static-stubs.c needs to be used together with
23+ the dummy __aeabi_unwind_cpp_pr* from aeabi_unwind_cpp_pr1.c
24+ instead of the copies from libgcc. */
25+
26+#include <elf/static-stubs.c>
27+#include <aeabi_unwind_cpp_pr1.c>
diff --git a/meta/recipes-core/eglibc/eglibc-2.16/0001-Avoid-use-of-libgcc_s-and-libgcc_eh-when-building-gl.patch b/meta/recipes-core/eglibc/eglibc-2.16/0001-Avoid-use-of-libgcc_s-and-libgcc_eh-when-building-gl.patch
new file mode 100644
index 0000000000..dc35b9bd4a
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.16/0001-Avoid-use-of-libgcc_s-and-libgcc_eh-when-building-gl.patch
@@ -0,0 +1,343 @@
1Upstream-Status: Backport
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4From 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 Mon Sep 17 00:00:00 2001
5From: Joseph Myers <joseph@codesourcery.com>
6Date: Tue, 3 Jul 2012 19:14:59 +0000
7Subject: [PATCH] Avoid use of libgcc_s and libgcc_eh when building glibc.
8
9---
10 ChangeLog | 47 ++++++++++++++++++++++++++++++
11 Makeconfig | 68 ++++++++++++++++++++++++++++++++++++++------
12 Rules | 45 ++++++++++++++++++++++-------
13 elf/Makefile | 6 +++-
14 elf/static-stubs.c | 46 ++++++++++++++++++++++++++++++
15 ports/ChangeLog.arm | 7 +++++
16 ports/sysdeps/arm/Makefile | 8 ++++++
17 7 files changed, 206 insertions(+), 21 deletions(-)
18 create mode 100644 elf/static-stubs.c
19
20Index: libc/Makeconfig
21===================================================================
22--- libc.orig/Makeconfig 2012-07-04 18:26:22.000000000 -0700
23+++ libc/Makeconfig 2012-08-14 20:16:10.197093639 -0700
24@@ -415,9 +415,9 @@
25 LDFLAGS-rtld += $(hashstyle-LDFLAGS)
26 endif
27
28-# Command for linking programs with the C library.
29+# Commands for linking programs with the C library.
30 ifndef +link
31-+link = $(CC) -nostdlib -nostartfiles -o $@ \
32++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
33 $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
34 $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
35 $(addprefix $(csu-objpfx),$(start-installed-name)) \
36@@ -426,7 +426,10 @@
37 $(start-installed-name))\
38 $(+preinit) $(link-extra-libs) \
39 $(common-objpfx)libc% $(+postinit),$^) \
40- $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
41+ $(link-extra-libs)
42++link-after-libc = $(+postctor) $(+postinit)
43++link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
44++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
45 endif
46 # Command for linking PIE programs with the C library.
47 ifndef +link-pie
48@@ -443,7 +446,7 @@
49 endif
50 # Command for statically linking programs with the C library.
51 ifndef +link-static
52-+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
53++link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \
54 $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
55 $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
56 $(+preinit) $(+prector) \
57@@ -451,7 +454,12 @@
58 $(start-installed-name))\
59 $(+preinit) $(link-extra-libs-static) \
60 $(common-objpfx)libc% $(+postinit),$^) \
61- $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
62+ $(link-extra-libs-static) $(link-libc-static)
63++link-static-after-libc = $(+postctor) $(+postinit)
64++link-static = $(+link-static-before-libc) $(link-libc-static) \
65+ $(+link-static-after-libc)
66++link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
67+ $(+link-static-after-libc)
68 endif
69 # Command for statically linking bounded-pointer programs with the C library.
70 ifndef +link-bounded
71@@ -475,10 +483,12 @@
72 # We need the versioned name of libc.so in the deps of $(others) et al
73 # so that the symlink to libc.so is created before anything tries to
74 # run the linked programs.
75-link-libc = -Wl,-rpath-link=$(rpath-link) \
76+link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \
77 $(common-objpfx)libc.so$(libc.so-version) \
78 $(common-objpfx)$(patsubst %,$(libtype.oS),c) \
79- $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib)
80+ $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed)
81+link-libc = $(link-libc-before-gnulib) $(gnulib)
82+link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests)
83 # This is how to find at build-time things that will be installed there.
84 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
85 rpath-link = \
86@@ -488,6 +498,7 @@
87 nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
88 resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
89 link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
90+link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
91 endif
92 endif
93
94@@ -513,8 +524,43 @@
95
96 # The static libraries.
97 link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group
98+link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group
99 link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
100
101+# How to link against libgcc. Some libgcc functions, such as those
102+# for "long long" arithmetic or software floating point, can always be
103+# built without use of C library headers and do not have any global
104+# state so can safely be linked statically into any executable or
105+# shared library requiring them; these functions are in libgcc.a.
106+# Other functions, relating to exception handling, may require C
107+# library headers to build and it may not be safe to have more than
108+# one copy of them in a process; these functions are only in
109+# libgcc_s.so and libgcc_eh.a.
110+#
111+# To avoid circular dependencies when bootstrapping, it is desirable
112+# to avoid use of libgcc_s and libgcc_eh in building glibc. Where any
113+# glibc functionality (in particular, thread cancellation) requires
114+# exception handling, this is implemented through dlopen of libgcc_s
115+# to avoid unnecessary dependencies on libgcc_s by programs not using
116+# that functionality; executables built with glibc do not use
117+# exception handling other than through thread cancellation.
118+#
119+# Undefined references to functions from libgcc_eh or libgcc_s may
120+# arise for code built with -fexceptions. In the case of statically
121+# linked programs installed by glibc, unwinding will never actually
122+# occur at runtime and the use of elf/static-stubs.c to resolve these
123+# references is safe. In the case of statically linked test programs
124+# and test programs built with -fexceptions, unwinding may occur in
125+# some cases and it is preferable to link with libgcc_eh or libgcc_s
126+# so that the testing is as similar as possible to how programs will
127+# be built with the installed glibc.
128+#
129+# Some architectures have architecture-specific systems for exception
130+# handling that may involve undefined references to
131+# architecture-specific functions. On those architectures,
132+# gnulib-arch and static-gnulib-arch may be defined in sysdeps
133+# makefiles to use additional libraries for linking executables and
134+# shared libraries built by glibc.
135 ifndef gnulib
136 ifneq ($(have-cc-with-libunwind),yes)
137 libunwind =
138@@ -522,8 +568,12 @@
139 libunwind = -lunwind
140 endif
141 libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
142-gnulib := -lgcc $(libgcc_eh)
143-static-gnulib := -lgcc -lgcc_eh $(libunwind)
144+gnulib-arch =
145+gnulib = -lgcc $(gnulib-arch)
146+gnulib-tests := -lgcc $(libgcc_eh)
147+static-gnulib-arch =
148+static-gnulib = -lgcc $(static-gnulib-arch)
149+static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
150 libc.so-gnulib := -lgcc
151 endif
152 +preinit = $(addprefix $(csu-objpfx),crti.o)
153Index: libc/Rules
154===================================================================
155--- libc.orig/Rules 2012-07-04 18:25:47.000000000 -0700
156+++ libc/Rules 2012-08-14 20:16:10.197093639 -0700
157@@ -1,5 +1,4 @@
158-# Copyright (C) 1991-2000,2002,2003,2004,2005,2006,2011
159-# Free Software Foundation, Inc.
160+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
161 # This file is part of the GNU C Library.
162
163 # The GNU C Library is free software; you can redistribute it and/or
164@@ -103,29 +102,46 @@
165 # eglibc: endif
166
167 ifeq ($(build-programs),yes)
168-binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs)
169-binaries-static = $(others-static) $(tests-static) $(xtests-static)
170+binaries-all-notests = $(others) $(sysdep-others)
171+binaries-all-tests = $(tests) $(xtests) $(test-srcs)
172+binaries-all = $(binaries-all-notests) $(binaries-all-tests)
173+binaries-static-notests = $(others-static)
174+binaries-static-tests = $(tests-static) $(xtests-static)
175+binaries-static = $(binaries-static-notests) $(binaries-static-tests)
176 ifeq (yesyes,$(have-fpie)$(build-shared))
177 binaries-pie = $(others-pie) $(tests-pie) $(xtests-pie)
178 else
179 binaries-pie =
180 endif
181 else
182-binaries-all = $(tests) $(xtests) $(test-srcs)
183+binaries-all-notests =
184+binaries-all-tests = $(tests) $(xtests) $(test-srcs)
185+binaries-all = $(binaries-all-tests)
186+binaries-static-notests =
187+binaries-static-tests =
188 binaries-static =
189 binaries-pie =
190 endif
191
192-binaries-shared = $(filter-out $(binaries-pie) $(binaries-static), \
193- $(binaries-all))
194+binaries-shared-tests = $(filter-out $(binaries-pie) $(binaries-static), \
195+ $(binaries-all-tests))
196+binaries-shared-notests = $(filter-out $(binaries-pie) $(binaries-static), \
197+ $(binaries-all-notests))
198
199-ifneq "$(strip $(binaries-shared))" ""
200-$(addprefix $(objpfx),$(binaries-shared)): %: %.o \
201+ifneq "$(strip $(binaries-shared-notests))" ""
202+$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o \
203 $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
204 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
205 $(+link)
206 endif
207
208+ifneq "$(strip $(binaries-shared-tests))" ""
209+$(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \
210+ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
211+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
212+ $(+link-tests)
213+endif
214+
215 ifneq "$(strip $(binaries-pie))" ""
216 $(addprefix $(objpfx),$(binaries-pie)): %: %.o \
217 $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
218@@ -133,13 +149,20 @@
219 $(+link-pie)
220 endif
221
222-ifneq "$(strip $(binaries-static))" ""
223-$(addprefix $(objpfx),$(binaries-static)): %: %.o \
224+ifneq "$(strip $(binaries-static-notests))" ""
225+$(addprefix $(objpfx),$(binaries-static-notests)): %: %.o \
226 $(sort $(filter $(common-objpfx)lib%,$(link-libc-static))) \
227 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
228 $(+link-static)
229 endif
230
231+ifneq "$(strip $(binaries-static-tests))" ""
232+$(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \
233+ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \
234+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
235+ $(+link-static-tests)
236+endif
237+
238 ifeq ($(build-bounded),yes)
239 binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs))
240 $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \
241Index: libc/elf/Makefile
242===================================================================
243--- libc.orig/elf/Makefile 2012-07-04 18:26:34.000000000 -0700
244+++ libc/elf/Makefile 2012-08-14 20:16:10.197093639 -0700
245@@ -71,6 +71,8 @@
246 install-bin = sprof pldd
247 others-static = sln
248 install-rootsbin = sln
249+sln-modules := static-stubs
250+extra-objs += $(sln-modules:=.o)
251
252 ifeq (yes,$(use-ldconfig))
253 ifeq (yes,$(build-shared))
254@@ -78,7 +80,7 @@
255 others += ldconfig
256 install-rootsbin += ldconfig
257
258-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon
259+ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
260 extra-objs += $(ldconfig-modules:=.o)
261 endif
262 endif
263@@ -417,6 +419,8 @@
264
265 $(objpfx)sprof: $(libdl)
266
267+$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
268+
269 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
270
271 $(objpfx)pldd: $(pldd-modules:%=$(objpfx)%.o)
272Index: libc/elf/static-stubs.c
273===================================================================
274--- /dev/null 1970-01-01 00:00:00.000000000 +0000
275+++ libc/elf/static-stubs.c 2012-08-14 20:16:10.197093639 -0700
276@@ -0,0 +1,46 @@
277+/* Stub implementations of functions to link into statically linked
278+ programs without needing libgcc_eh.
279+ Copyright (C) 2012 Free Software Foundation, Inc.
280+ This file is part of the GNU C Library.
281+
282+ The GNU C Library is free software; you can redistribute it and/or
283+ modify it under the terms of the GNU Lesser General Public
284+ License as published by the Free Software Foundation; either
285+ version 2.1 of the License, or (at your option) any later version.
286+
287+ The GNU C Library is distributed in the hope that it will be useful,
288+ but WITHOUT ANY WARRANTY; without even the implied warranty of
289+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
290+ Lesser General Public License for more details.
291+
292+ You should have received a copy of the GNU Lesser General Public
293+ License along with the GNU C Library; if not, see
294+ <http://www.gnu.org/licenses/>. */
295+
296+/* Avoid backtrace (and so _Unwind_Backtrace) dependencies from
297+ sysdeps/unix/sysv/linux/libc_fatal.c. */
298+#include <sysdeps/posix/libc_fatal.c>
299+
300+#include <stdlib.h>
301+#include <unwind.h>
302+
303+/* These programs do not use thread cancellation, so _Unwind_Resume
304+ and the personality routine are never actually called. */
305+
306+void
307+_Unwind_Resume (struct _Unwind_Exception *exc __attribute__ ((unused)))
308+{
309+ abort ();
310+}
311+
312+_Unwind_Reason_Code
313+__gcc_personality_v0 (int version __attribute__ ((unused)),
314+ _Unwind_Action actions __attribute__ ((unused)),
315+ _Unwind_Exception_Class exception_class
316+ __attribute__ ((unused)),
317+ struct _Unwind_Exception *ue_header
318+ __attribute__ ((unused)),
319+ struct _Unwind_Context *context __attribute__ ((unused)))
320+{
321+ abort ();
322+}
323Index: libc/ports/sysdeps/arm/Makefile
324===================================================================
325--- libc.orig/ports/sysdeps/arm/Makefile 2012-07-04 18:25:41.000000000 -0700
326+++ libc/ports/sysdeps/arm/Makefile 2012-08-14 20:16:10.201093638 -0700
327@@ -1,8 +1,16 @@
328+gnulib-arch = $(elfobjdir)/libgcc-stubs.a
329+static-gnulib-arch = $(elfobjdir)/libgcc-stubs.a
330+
331 ifeq ($(subdir),elf)
332 sysdep-dl-routines += tlsdesc dl-tlsdesc
333 sysdep_routines += aeabi_unwind_cpp_pr1 find_exidx tlsdesc dl-tlsdesc
334 sysdep-rtld-routines += aeabi_unwind_cpp_pr1 tlsdesc dl-tlsdesc
335 shared-only-routines += aeabi_unwind_cpp_pr1
336+
337+$(objpfx)libgcc-stubs.a: $(objpfx)aeabi_unwind_cpp_pr1.os
338+ $(build-extra-lib)
339+
340+lib-noranlib: $(objpfx)libgcc-stubs.a
341 endif
342
343 ifeq ($(subdir),csu)
diff --git a/meta/recipes-core/eglibc/eglibc_2.16.bb b/meta/recipes-core/eglibc/eglibc_2.16.bb
index b053a5bf71..3b48674396 100644
--- a/meta/recipes-core/eglibc/eglibc_2.16.bb
+++ b/meta/recipes-core/eglibc/eglibc_2.16.bb
@@ -3,7 +3,7 @@ require eglibc.inc
3SRCREV = "19383" 3SRCREV = "19383"
4 4
5DEPENDS += "gperf-native" 5DEPENDS += "gperf-native"
6PR = "r5" 6PR = "r6"
7PR_append = "+svnr${SRCPV}" 7PR_append = "+svnr${SRCPV}"
8 8
9EGLIBC_BRANCH="eglibc-2_16" 9EGLIBC_BRANCH="eglibc-2_16"
@@ -25,6 +25,8 @@ SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};protocol=h
25 file://e500-math_private.patch \ 25 file://e500-math_private.patch \
26 file://fileops-without-wchar-io.patch \ 26 file://fileops-without-wchar-io.patch \
27 file://add_resource_h_to_wait_h.patch \ 27 file://add_resource_h_to_wait_h.patch \
28 file://0001-Avoid-use-of-libgcc_s-and-libgcc_eh-when-building-gl.patch \
29 file://0001-Add-ARM-specific-static-stubs.c.patch \
28 " 30 "
29LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \ 31LIC_FILES_CHKSUM = "file://LICENSES;md5=98a1128c4b58120182cbea3b1752d8b9 \
30 file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \ 32 file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \