public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-devel/native-cctools/files: ld-aix-1
@ 2011-02-09 15:53 Michael Haubenwallner (haubi)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Haubenwallner (haubi) @ 2011-02-09 15:53 UTC (permalink / raw
  To: gentoo-commits

haubi       11/02/09 15:53:53

  Added:                ld-aix-1
  Log:
  On AIX, wrap ld to support '-soname' flag (#213277). Moved from prefix-overlay to gentoo-x86.
  
  (Portage version: 2.2.01.17865-prefix/cvs/AIX 00C0078A4C00)

Revision  Changes    Path
1.1                  sys-devel/native-cctools/files/ld-aix-1

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1?rev=1.1&content-type=text/plain

Index: ld-aix-1
===================================================================
#! /bin/ksh
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1,v 1.1 2011/02/09 15:53:53 haubi Exp $

# Upon '-soname' and similar flags, create a "shared library" on AIX being an
# archive file containing an Import File and the shared object file, as in:
# http://lists.gnu.org/archive/html/libtool/2011-01/msg00023.html
# with updates in:
# http://lists.gnu.org/archive/html/libtool/2011-02/msg00000.html
#
# This helper script is meant not depend on anything Gentoo specific.

ld=/usr/ccs/bin/ld
ar=/usr/ccs/bin/ar
strip=/usr/ccs/bin/strip
dump=/usr/sbin/dump
awk=/usr/bin/awk
rm=/usr/bin/rm
mkdir=/usr/bin/mkdir
mv=/usr/bin/mv
ln=/usr/bin/ln

oldargs=
output=
soname=
newargs=
OBJECT_MODE=${OBJECT_MODE:-32}

while [[ $# -gt 0 ]]
do
	arg=$1
	shift
	oldargs="${oldargs} '${arg}'"
	case ${arg} in
	-o)
		newargs="${newargs} -o '$1'"
		output=$1
		oldargs="${oldargs} '$1'"
		shift
		;;
	-bM:SRE)
		newargs="${newargs} '-G' '-bernotok'"
		;;
	-soname=*)
		soname=${arg#-soname=}
		;;
	-h*)
		soname=${arg#-h}
		;;
	-soname|-h)
		soname=$1
		shift
		;;
	-b32)
		newargs="${newargs} '${arg}'"
		OBJECT_MODE=32
		;;
	-b64)
		newargs="${newargs} '${arg}'"
		OBJECT_MODE=64
		;;
	*)
		newargs="${newargs} '${arg}'"
		;;
	esac
done

if [[ -z ${output} || -z ${soname} ]]; then
	eval "exec ${ld} ${oldargs}"
	exit 1
fi

# Running ld against the orginal target file to retain
# ld error message when there's a problem with it:
eval "${ld} -o '${output}' ${newargs}" || exit 1

workdir="${output}.$$"

${rm} -rf "${workdir}" || exit 1
trap "${rm} -rf '${workdir}'" 0

case ${soname} in
*\(*\))
	shro=${soname#*\(}
	shro=${shro%\)}
	shri=${shro%.*}.imp
	;;
*\[*\])
	shro=${soname#*\[}
	shro=${shro%\]}
	shri=${shro%.*}.imp
	;;
none) # loadable only module, not linkable: no import file
	shro='shr.o'
	soname="${output##*/}(${shro})"
	shri=
	;;
auto)
	shro='shr.o'
	soname=${output##*/}
	if [[ ${soname} == lib*.so* ]]; then
		# linkable library: need import file
		shri=${shro%.*}.imp
	else
		# loadable only module, not linkable: no import file
		shri=
	fi
	soname="${soname}(${shro})"
	;;
*)
	shro='shr.o'
	shri=${shro%.*}.imp
	soname="${soname}(${shro})"
	;;
esac

export OBJECT_MODE

${mkdir} "${workdir}" || exit 1
${strip} -e "${output}" || exit 1
if [[ -n ${shri} ]]; then
	${dump} -Tv "${output}" > "${workdir}"/syms || exit 1
	${awk} '
		BEGIN {
			print "#! '"${soname}"'"
			print "# '"${OBJECT_MODE}"'"
		}
		{
			if ($6 != "SECdef") {
				if ($4 == "EXP" || $4 == "ImpExp") {
					print $8
				} else
				if ($4 == "wEXP") {
					print $8" weak"
				}
			}
		}' <"${workdir}"/syms > "${workdir}"/${shri} || exit 1
fi
${mv} "${output}" "${workdir}/${shro}" || exit 1
${ar} rc "${output}" ${shri:+"${workdir}/${shri}"} "${workdir}/${shro}" || exit 1
exit 0






^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in sys-devel/native-cctools/files: ld-aix-1
@ 2011-02-28 17:34 Michael Haubenwallner (haubi)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Haubenwallner (haubi) @ 2011-02-28 17:34 UTC (permalink / raw
  To: gentoo-commits

haubi       11/02/28 17:34:23

  Modified:             ld-aix-1
  Log:
  use /bin/ksh via /usr/bin/env, for bug#282539
  
  (Portage version: 2.2.01.18036-prefix/cvs/AIX 00C0078A4C00)

Revision  Changes    Path
1.2                  sys-devel/native-cctools/files/ld-aix-1

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1?r1=1.1&r2=1.2

Index: ld-aix-1
===================================================================
RCS file: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ld-aix-1	9 Feb 2011 15:53:53 -0000	1.1
+++ ld-aix-1	28 Feb 2011 17:34:23 -0000	1.2
@@ -1,6 +1,6 @@
-#! /bin/ksh
+#! /usr/bin/env /bin/ksh
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1,v 1.1 2011/02/09 15:53:53 haubi Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/native-cctools/files/ld-aix-1,v 1.2 2011/02/28 17:34:23 haubi Exp $
 
 # Upon '-soname' and similar flags, create a "shared library" on AIX being an
 # archive file containing an Import File and the shared object file, as in:






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-28 17:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-09 15:53 [gentoo-commits] gentoo-x86 commit in sys-devel/native-cctools/files: ld-aix-1 Michael Haubenwallner (haubi)
  -- strict thread matches above, loose matches on Subject: below --
2011-02-28 17:34 Michael Haubenwallner (haubi)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox