summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-devel/native-cctools/files/aix-2/ld
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-devel/native-cctools/files/aix-2/ld')
-rw-r--r--sys-devel/native-cctools/files/aix-2/ld139
1 files changed, 139 insertions, 0 deletions
diff --git a/sys-devel/native-cctools/files/aix-2/ld b/sys-devel/native-cctools/files/aix-2/ld
new file mode 100644
index 000000000000..d4b637c03836
--- /dev/null
+++ b/sys-devel/native-cctools/files/aix-2/ld
@@ -0,0 +1,139 @@
+#! /usr/bin/env /bin/ksh
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Id$
+
+# 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 ($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