[oe-commits] org.oe.dev perl 5.8.7: Fix the perl shared library generation for sh3/sh4

lenehan commit openembedded-commits at lists.openembedded.org
Mon Sep 25 08:59:32 UTC 2006


perl 5.8.7: Fix the perl shared library generation for sh3/sh4
targets:

- You cannot link using LD on sh3/sh4, since ld fails to link in the
  hidden library of weak symbols that is needed. Ccc knows about this
  library and correctly links it in. The generate_config_sh script
  was replacing the configred linker with LD from the environment and
  the soname patch was passing parameters directly to LD which need
  to be passed differently when linking with gcc.

- Any code to go in shared libraries must be compiled with -fPIC,
  which while present in the config file was again being replaced
  from the environment by the generate_config_sh script.

Both these patches probably should be ok for all targets, but they
would definately need run-time testing. So they are just patched in
for sh3 and sh4 for now.

Also removed the old code I added not to install the shared library
if its not configured since its configured for all targets after this
change.

Author: lenehan at openembedded.org
Branch: org.openembedded.dev
Revision: e7a08dfe2257ebd11a3fbc4942c1704d657bb47a
ViewMTN: http://monotone.openembedded.org/revision.psp?id=e7a08dfe2257ebd11a3fbc4942c1704d657bb47a
Files:
1
packages/perl/perl-5.8.7/makefile-usegcc-to-link.patch
packages/perl/perl-5.8.7/override-generate-sh.patch
packages/perl/perl-5.8.7/config.sh-sh3-linux
packages/perl/perl-5.8.7/config.sh-sh4-linux
packages/perl/perl.inc
packages/perl/perl_5.8.7.bb
Diffs:

#
# mt diff -r667ef4999a5af5427b76ba33e077434204ea2d19 -re7a08dfe2257ebd11a3fbc4942c1704d657bb47a
#
# 
# 
# add_file "packages/perl/perl-5.8.7/makefile-usegcc-to-link.patch"
#  content [190b6f6aef6d3624b0ff1caa9bc2a8740e02ddc8]
# 
# add_file "packages/perl/perl-5.8.7/override-generate-sh.patch"
#  content [afba0835a42adedc695143d01689f4b2cbf933bd]
# 
# patch "packages/perl/perl-5.8.7/config.sh-sh3-linux"
#  from [56f48bae647b813fae627783d68ba4834173f73b]
#    to [0733c2d5d83ca00be48c62b8f42701d857fd0862]
# 
# patch "packages/perl/perl-5.8.7/config.sh-sh4-linux"
#  from [a498ecbf31909d4499dfa11bfa4235f0be71ad8e]
#    to [410b1eb911514b8498124683bc1e5bf8695d9fd5]
# 
# patch "packages/perl/perl.inc"
#  from [696e73f001ec32ad59f63f6e5a3103b5aa79cac3]
#    to [18b7932d814526732508579b66376f58e95726d9]
# 
# patch "packages/perl/perl_5.8.7.bb"
#  from [ea35302799a4150e70d3e0c158905564030cb4a8]
#    to [88bb9c33126dc36e9b6ecfbdab494d1d1b974a7d]
# 
============================================================
--- packages/perl/perl-5.8.7/makefile-usegcc-to-link.patch	190b6f6aef6d3624b0ff1caa9bc2a8740e02ddc8
+++ packages/perl/perl-5.8.7/makefile-usegcc-to-link.patch	190b6f6aef6d3624b0ff1caa9bc2a8740e02ddc8
@@ -0,0 +1,27 @@
+You cannot use LD to link on sh, you must use gcc otherwise shared
+libraries will not work since ld doesn't know about the hidden gcc
+shared libary requirements.
+
+--- perl-5.8.7/Cross/Makefile	2006/09/25 05:52:56	1.1
++++ perl-5.8.7/Cross/Makefile	2006/09/25 05:57:34
+@@ -12,7 +12,7 @@
+ 
+ export CC = $(CROSS)gcc
+ export CXX = $(CROSS)g++
+-export LD = $(CROSS)ld
++export LD = $(CC)
+ export STRIP = $(CROSS)strip
+ export AR = $(CROSS)ar
+ export RANLIB = $(CROSS)ranlib
+
+--- perl-5.8.7/Makefile.SH.orig	2003-07-10 14:59:04.000000000 -0700
++++ perl-5.8.7/Makefile.SH	2003-07-10 15:14:08.000000000 -0700
+@@ -494,7 +494,7 @@
+ 	case "$useshrplib" in
+ 	true)
+ 		$spitshell >>Makefile <<'!NO!SUBS!'
+-	$(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) $(libs) -soname libperl.so.5
++	$(CC) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) $(libs) -Wl,-soname,libperl.so.5
+ !NO!SUBS!
+ 		case "$osname" in
+ 		aix)
============================================================
--- packages/perl/perl-5.8.7/override-generate-sh.patch	afba0835a42adedc695143d01689f4b2cbf933bd
+++ packages/perl/perl-5.8.7/override-generate-sh.patch	afba0835a42adedc695143d01689f4b2cbf933bd
@@ -0,0 +1,16 @@
+Use the ld flags from the supplied configuration file. For sh we need the
+flags that specify to build PIC code so that the shared libraries work.
+
+--- perl-5.8.7/Cross/generate_config_sh~	2006-09-25 16:34:09.000000000 +1000
++++ perl-5.8.7/Cross/generate_config_sh	2006-09-25 16:34:09.000000000 +1000
+@@ -19,8 +19,8 @@
+ $callbacks->{'ar'} = [\&simple_process, ["AR", "arm-linux-ar"]];
+ $callbacks->{'archname'} = [\&simple_process, ["SYS", "armv4l-linux"]];
+ $callbacks->{'cc'} = [\&simple_process, ["CC", "arm-linux-gcc"]];
+-$callbacks->{'cccdlflags'} = [\&simple_process, ["CFLAGS", ""]];
+-$callbacks->{'ccdlflags'} = [\&simple_process, ["CFLAGS", ""]];
++#$callbacks->{'cccdlflags'} = [\&simple_process, ["CFLAGS", ""]];
++#$callbacks->{'ccdlflags'} = [\&simple_process, ["CFLAGS", ""]];
+ $callbacks->{'ccflags'} = [\&simple_process, ["CFLAGS", "-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"]];
+ $callbacks->{'ccflags_uselargefiles'} = [\&simple_process, ["CFLAGS", "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"]];
+ $callbacks->{'ccname'} = [\&simple_process, ["CC", "arm-linux-gcc"]];
============================================================
--- packages/perl/perl-5.8.7/config.sh-sh3-linux	56f48bae647b813fae627783d68ba4834173f73b
+++ packages/perl/perl-5.8.7/config.sh-sh3-linux	0733c2d5d83ca00be48c62b8f42701d857fd0862
@@ -971,7 +971,7 @@ usesfio='false'
 useposix='true'
 usereentrant='undef'
 usesfio='false'
-useshrplib='false'
+useshrplib='true'
 usesitecustomize='undef'
 usesocks='undef'
 usethreads='undef'
============================================================
--- packages/perl/perl-5.8.7/config.sh-sh4-linux	a498ecbf31909d4499dfa11bfa4235f0be71ad8e
+++ packages/perl/perl-5.8.7/config.sh-sh4-linux	410b1eb911514b8498124683bc1e5bf8695d9fd5
@@ -971,7 +971,7 @@ usesfio='false'
 useposix='true'
 usereentrant='undef'
 usesfio='false'
-useshrplib='false'
+useshrplib='true'
 usesitecustomize='undef'
 usesocks='undef'
 usethreads='undef'
============================================================
--- packages/perl/perl.inc	696e73f001ec32ad59f63f6e5a3103b5aa79cac3
+++ packages/perl/perl.inc	18b7932d814526732508579b66376f58e95726d9
@@ -46,9 +46,7 @@ do_install() {
 
 do_install() {
 	oe_runmake install
-	# Make sure the shared library is configured before trying to move it
-	grep -q "useshrplib='false'" ${S}/config.sh ||
-		mv ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-${TARGET_OS}/CORE/libperl.so ${D}/${libdir}/libperl.so.${PV}
+	mv ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-${TARGET_OS}/CORE/libperl.so ${D}/${libdir}/libperl.so.${PV}
 	( cd ${D}/usr/bin/; rm perl; ln -s perl${PV} perl )
 }
 
============================================================
--- packages/perl/perl_5.8.7.bb	ea35302799a4150e70d3e0c158905564030cb4a8
+++ packages/perl/perl_5.8.7.bb	88bb9c33126dc36e9b6ecfbdab494d1d1b974a7d
@@ -10,9 +10,16 @@ SRC_URI += "file://config.sh-armeb-linux
 	    file://config.sh-sh3-linux \
 	    file://config.sh-sh4-linux"
 
+# Patches for sh3/sh4, use gcc to link and override generaet.sh to
+# use PIC mode for compiling shared library objects.
+SRC_URI_append_sh4 += "file://override-generate-sh.patch;patch=1"
+SRC_URI_append_sh4 += "file://makefile-usegcc-to-link.patch;patch=1"
+SRC_URI_append_sh3 += "file://override-generate-sh.patch;patch=1"
+SRC_URI_append_sh3 += "file://makefile-usegcc-to-link.patch;patch=1"
+
 PARALLEL_MAKE = ""
 
-PR = "r17"
+PR = "r18"
 
 do_configure() {
 	ln -sf ${HOSTPERL} ${STAGING_BINDIR}/hostperl
@@ -57,9 +64,7 @@ do_install_append() {
 }
 
 do_install_append() {
-	# Make sure the shared library is configured before trying to symlink it
-	grep -q "useshrplib='false'" ${S}/config.sh ||
-		ln -s libperl.so.${PV} ${D}/${libdir}/libperl.so.5
+	ln -s libperl.so.${PV} ${D}/${libdir}/libperl.so.5
 	sed -i -e "s,${D},,g" ${D}/${libdir}/perl5/${PV}/${TARGET_ARCH}-${TARGET_OS}/Config_heavy.pl
 }
 






More information about the Openembedded-commits mailing list