Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-08-06 05:40:12 +0400
committerChristopher Faylor <me@cgf.cx>2003-08-06 05:40:12 +0400
commit4b154cc1b3b5c73e719ab505a8fcb7ae7b5113ae (patch)
tree74552e797798985fd06fed387397956bb5a4484a /winsup/cygwin
parent4423d92489cd1a3bbcd1657bfbdef2d8a4cbf71f (diff)
* Makefile.in: Rework to accommodate new speclib arguments.
* speclib: Rework to extract everything from libcygwin.a rather than building things from existing object files.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/Makefile.in18
-rw-r--r--winsup/cygwin/crt0.c2
-rwxr-xr-xwinsup/cygwin/speclib34
4 files changed, 42 insertions, 18 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 619a6fb5b..f79614038 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2003-08-05 Christopher Faylor <cgf@redhat.com>
+
+ * Makefile.in: Rework to accommodate new speclib arguments.
+ * speclib: Rework to extract everything from libcygwin.a rather than
+ building things from existing object files.
+
2003-08-05 Pavel Tsekov <ptsekov@gmx.net>
* path.cc (cygdrive_getmntent): Do not skip over drives of type
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 57facbb9d..66e72cc58 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -116,7 +116,6 @@ RUNTESTFLAGS =
DLL_NAME:=cygwin1.dll
TEST_DLL_NAME:=cygwin0.dll
-LIB_NAME:=libcygwin.a
TEST_LIB_NAME:=libcygwin0.a
DEF_FILE:=cygwin.def
DLL_ENTRY:=@DLL_ENTRY@
@@ -233,10 +232,11 @@ NEW_FUNCTIONS:=regcomp posix_regcomp \
API_VER:=$(srcdir)/include/cygwin/version.h
PWD:=${shell pwd}
-SUBLIBS:=libpthread.a $(PWD)/libm.a libc.a
+LIB_NAME:=$(PWD)/libcygwin.a
+SUBLIBS:=$(PWD)/libpthread.a $(PWD)/libm.a $(PWD)/libc.a
EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a
INSTOBJS:=automode.o binmode.o textmode.o
-TARGET_LIBS:=$(LIB_NAME) $(SUBLIBS) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
+TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS)
.PHONY: all force dll_ofiles install all_target install_target all_host install_host \
install install-libs install-headers -lgcc
@@ -376,14 +376,14 @@ dcrt0.o sigproc.o: child_info_magic.h
shared.o: shared_info_magic.h
-libpthread.a: speclib cygwin.def pthread.o thread.o
- /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
+$(PWD)/libpthread.a: speclib $(LIB_NAME) pthread.o thread.o
+ /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
-$(PWD)/libm.a: speclib cygwin.def $(LIBM)
- /bin/sh ${word 1, $^} $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
+$(PWD)/libm.a: speclib $(LIB_NAME) $(LIBM)
+ /bin/sh ${word 1, $^} $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
-$(PWD)/libc.a: speclib cygwin.def $(PWD)/libm.a libpthread.a
- /bin/sh ${word 1, $^} -v $@ "${NM}" "${DLLTOOL}" "${AS}" ${wordlist 2, 99, $^}
+$(PWD)/libc.a: speclib $(LIB_NAME) $(PWD)/libm.a libpthread.a
+ /bin/sh ${word 1, $^} -v $@ "${NM}" "$(AR)" ${wordlist 2, 99, $^}
lib%.a: %.o
$(AR) cru $@ $?
diff --git a/winsup/cygwin/crt0.c b/winsup/cygwin/crt0.c
index 2837a54d1..52ba7bd34 100644
--- a/winsup/cygwin/crt0.c
+++ b/winsup/cygwin/crt0.c
@@ -30,6 +30,8 @@ int __cygwin_crt0_bp = 0;
extern int main (int argc, char **argv);
+void cygwin_crt0 (int (*main) (int, char **));
+
void
mainCRTStartup ()
{
diff --git a/winsup/cygwin/speclib b/winsup/cygwin/speclib
index 6f8e0cd73..69074096c 100755
--- a/winsup/cygwin/speclib
+++ b/winsup/cygwin/speclib
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -x
# speclib - Make a special version of the cygwin import library.
#
# Copyright 2001, 2002 Red Hat, Inc.
@@ -10,14 +10,30 @@
# details.
case "$1" in
- -v) v="-v"; shift
+ -v) shift; v() { :; } ;;
+ *) v() { /bin/false; } ;;
esac
lib=$1; shift
nm=$1; shift
-dlltool=$1; shift
-as=$1; shift
-def=$1; shift
-trap "rm -f /tmp/$$.def" 0 1 2 15
-(echo "LIBRARY cygwin1.dll
-EXPORTS"; $nm --extern-only --defined-only $* | sed -e '/^[ ]*$/d' -e '/:$/d' -e 's/^.* _\(.*\)/\1/' | grep $v -f - -w $def |egrep -vi '^library|exports|^$' | sort) > /tmp/$$.def
-$dlltool --as=$as -d /tmp/$$.def -l "$lib"
+ar=$1; shift
+libdll=$1; shift
+cp /dev/null /tmp/$$.objs
+trap "/bin/rm -rf /tmp/$$.dir /tmp/$$.syms /tmp/$$.objs /tmp/$$.raw" 0 1 2 15
+$nm --extern-only --defined-only $* | sed -e '/^[ ]*$/d' -e '/:$/d' -e 's%^.* _\(.*\)%/ __imp__\1$/p%' | grep -v ' __imp___imp__' > /tmp/$$.syms
+v || $nm -Ap --extern-only --defined-only $libdll | egrep ' I __head| I _.*_iname' | awk -F: '{print $2}' > /tmp/$$.objs
+$nm -Ap --extern-only --defined-only $libdll | sed -n -f /tmp/$$.syms | awk -F: '{print $2}' >> /tmp/$$.objs
+sort -o /tmp/$$.objs -u /tmp/$$.objs
+
+[ -s /tmp/$$.objs ] || { echo "speclib: couldn't find symbols for $lib" 1>&2; exit 1; }
+
+/bin/rm -f /tmp/$$>dir
+mkdir /tmp/$$.dir
+cd /tmp/$$.dir
+if v; then
+ $ar x $libdll
+ /bin/rm -f `cat /tmp/$$.objs`
+else
+ $ar x $libdll `cat /tmp/$$.objs`
+fi
+/bin/rm -f $lib
+$ar crus $lib *.o