diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c4bd70cca..ea4b04680 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2005-08-07 Christopher Faylor + + * dllfixdbg: New perl script. + * configure.in: Detect objcopy, objdump, strip. + * configure: Regenerate. + * Makefile.in: Pass target objcopy/objdump to new dllfixdbg script. + Remove previous perl check. + * cygwin.sc: Add .gnu_debuglink_overlay section for eventual + replacement with .gnu_debuglink section. Revert move of cygheap to end + of image. + 2005-08-06 Corinna Vinschen * Makefile.in: Allow previous patch to work in a 64 bit environment. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index e968f72a3..ebf5e2632 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -1,5 +1,5 @@ # Makefile.in for Cygwin. -# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. +# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. # # This file is part of Cygwin. # @@ -65,6 +65,9 @@ DLLTOOL:=@DLLTOOL@ WINDRES:=@WINDRES@ AS:=@AS@ NM:=@NM@ +OBJCOPY:=@OBJCOPY@ +OBJDUMP:=@OBJDUMP@ +STRIP:=@STRIP@ LDSCRIPT:=cygwin.sc # @@ -366,18 +369,13 @@ maintainer-clean realclean: clean # Rule to build cygwin.dll -$(TEST_DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DLL_IMPORTS) $(LIBSERVER) $(LIBC) $(LIBM) $(API_VER) Makefile winver_stamp +$(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg $(DLL_OFILES) $(DLL_IMPORTS) $(LIBSERVER) $(LIBC) $(LIBM) $(API_VER) Makefile winver_stamp $(CXX) $(CXXFLAGS) -Wl,--gc-sections $(nostdlib) -Wl,-T$(firstword $^) \ -Wl,--heap=0 -Wl,--out-implib,cygdll.a -shared -o $@ \ -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o winver.o \ $(MALLOC_OBJ) $(LIBSERVER) $(LIBM) $(LIBC) \ -lgcc $(DLL_IMPORTS) - @$(NM) $@ | perl -Minteger -n -e '/^((0{8})?61[0-9a-f]+) A __cygheap_end/ and do {$$cygheap_end = $$1; exit;};\ - END { \ - die "ERROR: _cygheap_end not found in $@\n" unless defined($$cygheap_end); \ - die "ERROR: _cygheap_end is not on a 64k boundary (0x$$cygheap_end)!\n" if (hex($$cygheap_end) & 0xffff);\ - exit 0; \ - }' + @$(word 2,$^) $(OBJDUMP) $(OBJCOPY) $@ ${patsubst %0.dll,%1.dbg,$@} @ln -f $@ new-$(DLL_NAME) # Rule to build libcygwin.a diff --git a/winsup/cygwin/configure b/winsup/cygwin/configure index 9f778b846..e2e87da3d 100755 --- a/winsup/cygwin/configure +++ b/winsup/cygwin/configure @@ -1147,70 +1147,70 @@ else fi fi -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1154: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" break fi done IFS="$ac_save_ifs" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 else echo "$ac_t""no" 1>&6 fi -if test -z "$ac_cv_prog_RANLIB"; then +if test -z "$ac_cv_prog_DLLTOOL"; then if test -n "$ac_tool_prefix"; then - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1186: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" + ac_cv_prog_DLLTOOL="dlltool" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB="ranlib" + test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="dlltool" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +DLLTOOL="$ac_cv_prog_DLLTOOL" +if test -n "$DLLTOOL"; then + echo "$ac_t""$DLLTOOL" 1>&6 else echo "$ac_t""no" 1>&6 fi else - RANLIB="ranlib" + DLLTOOL="dlltool" fi fi @@ -1348,77 +1348,278 @@ else fi fi -# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +# Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. +set dummy ${ac_tool_prefix}objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1355: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then +if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. + if test -n "$OBJCOPY"; then + ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + ac_cv_prog_OBJCOPY="${ac_tool_prefix}objcopy" break fi done IFS="$ac_save_ifs" fi fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 +OBJCOPY="$ac_cv_prog_OBJCOPY" +if test -n "$OBJCOPY"; then + echo "$ac_t""$OBJCOPY" 1>&6 else echo "$ac_t""no" 1>&6 fi -if test -z "$ac_cv_prog_DLLTOOL"; then +if test -z "$ac_cv_prog_OBJCOPY"; then if test -n "$ac_tool_prefix"; then - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 + # Extract the first word of "objcopy", so it can be a program name with args. +set dummy objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1387: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then +if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. + if test -n "$OBJCOPY"; then + ac_cv_prog_OBJCOPY="$OBJCOPY" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_DLLTOOL="dlltool" + ac_cv_prog_OBJCOPY="objcopy" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="dlltool" + test -z "$ac_cv_prog_OBJCOPY" && ac_cv_prog_OBJCOPY="objcopy" fi fi -DLLTOOL="$ac_cv_prog_DLLTOOL" -if test -n "$DLLTOOL"; then - echo "$ac_t""$DLLTOOL" 1>&6 +OBJCOPY="$ac_cv_prog_OBJCOPY" +if test -n "$OBJCOPY"; then + echo "$ac_t""$OBJCOPY" 1>&6 else echo "$ac_t""no" 1>&6 fi else - DLLTOOL="dlltool" + OBJCOPY="objcopy" +fi +fi + +# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1422: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_OBJDUMP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1454: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_OBJDUMP="objdump" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_OBJDUMP" && ac_cv_prog_OBJDUMP="objdump" +fi +fi +OBJDUMP="$ac_cv_prog_OBJDUMP" +if test -n "$OBJDUMP"; then + echo "$ac_t""$OBJDUMP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + OBJDUMP="objdump" +fi +fi + +# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1489: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1521: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB="ranlib" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB="ranlib" +fi +fi + +# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1556: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_STRIP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1588: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_STRIP="strip" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP="strip" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + STRIP="strip" fi fi # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1422: checking for $ac_word" >&5 +echo "configure:1623: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1450,7 +1651,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1454: checking for $ac_word" >&5 +echo "configure:1655: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1484,7 +1685,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1488: checking how to run the C preprocessor" >&5 +echo "configure:1689: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1499,13 +1700,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1710: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1516,13 +1717,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1727: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1533,13 +1734,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1543: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1744: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1566,19 +1767,19 @@ echo "$ac_t""$CPP" 1>&6 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1570: checking for working alloca.h" >&5 +echo "configure:1771: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1599,12 +1800,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1603: checking for alloca" >&5 +echo "configure:1804: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1664,12 +1865,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1668: checking whether alloca needs Cray hooks" >&5 +echo "configure:1869: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1698: checking for $ac_func" >&5 +echo "configure:1899: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1749,7 +1950,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1753: checking stack direction for C alloca" >&5 +echo "configure:1954: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1757,7 +1958,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1798,7 +1999,7 @@ EOF fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1802: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:2003: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1835,7 +2036,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext < @@ -1848,7 +2049,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* use_builtin_memset=yes else @@ -2103,10 +2304,13 @@ s%@all_host@%$all_host%g s%@install_host@%$install_host%g s%@AR@%$AR%g s%@AS@%$AS%g -s%@RANLIB@%$RANLIB%g +s%@DLLTOOL@%$DLLTOOL%g s%@LD@%$LD%g s%@NM@%$NM%g -s%@DLLTOOL@%$DLLTOOL%g +s%@OBJCOPY@%$OBJCOPY%g +s%@OBJDUMP@%$OBJDUMP%g +s%@RANLIB@%$RANLIB%g +s%@STRIP@%$STRIP%g s%@WINDRES@%$WINDRES%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g diff --git a/winsup/cygwin/configure.in b/winsup/cygwin/configure.in index db7dc454c..2b0d867dc 100644 --- a/winsup/cygwin/configure.in +++ b/winsup/cygwin/configure.in @@ -91,10 +91,13 @@ AC_SUBST(install_host) AC_CHECK_TOOL(AR, ar, ar) AC_CHECK_TOOL(AS, as, as) -AC_CHECK_TOOL(RANLIB, ranlib, ranlib) +AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool) AC_CHECK_TOOL(LD, ld, ld) AC_CHECK_TOOL(NM, nm, nm) -AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool) +AC_CHECK_TOOL(OBJCOPY, objcopy, objcopy) +AC_CHECK_TOOL(OBJDUMP, objdump, objdump) +AC_CHECK_TOOL(RANLIB, ranlib, ranlib) +AC_CHECK_TOOL(STRIP, strip, strip) AC_CHECK_TOOL(WINDRES, windres, windres) AC_ALLOCA diff --git a/winsup/cygwin/cygwin.sc b/winsup/cygwin/cygwin.sc index e2a83d05d..1bfbd794a 100644 --- a/winsup/cygwin/cygwin.sc +++ b/winsup/cygwin/cygwin.sc @@ -70,6 +70,47 @@ SECTIONS { *(.cygwin_dll_common) } + .gnu_debuglink_overlay ALIGN(__section_alignment__) (NOLOAD): + { + BYTE(0) /* c */ + BYTE(0) /* y */ + BYTE(0) /* g */ + BYTE(0) /* w */ + BYTE(0) /* i */ + BYTE(0) /* n */ + BYTE(0) /* 1 */ + BYTE(0) /* . */ + BYTE(0) /* d */ + BYTE(0) /* b */ + BYTE(0) /* g */ + BYTE(0) /* \0 */ + LONG(0) /* checksum */ + } + .idata ALIGN(__section_alignment__) : + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + . = ALIGN(16); + __cygheap_start = ABSOLUTE(.); + . = ALIGN(0x10000); + } + .cygheap ALIGN(__section_alignment__) : + { + __cygheap_mid = .; + *(.cygheap) + . = ALIGN(512 * 1024, 0x10000); + } + __cygheap_end = ABSOLUTE(.); + __cygheap_end1 = __cygheap_mid + SIZEOF(.cygheap); + __cygwin_debug_size = SIZEOF(.gnu_debuglink); /DISCARD/ : { *(.debug$S) @@ -98,28 +139,4 @@ SECTIONS .debug_macinfo ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_macinfo) } .debug_macinfo ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_macinfo) } .debug_ranges ALIGN(__section_alignment__) (NOLOAD) : { *(.debug_ranges) } - .idata ALIGN(__section_alignment__) : - { - /* This cannot currently be handled with grouped sections. - See pe.em:sort_sections. */ - SORT(*)(.idata$2) - SORT(*)(.idata$3) - /* These zeroes mark the end of the import list. */ - LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); - SORT(*)(.idata$4) - SORT(*)(.idata$5) - SORT(*)(.idata$6) - SORT(*)(.idata$7) - . = ALIGN(16); - __cygheap_start = ABSOLUTE(.); - . = ALIGN(0x10000); - } - .cygheap ALIGN(__section_alignment__) : - { - __cygheap_mid = .; - *(.cygheap) - . = ALIGN(512 * 1024, 0x10000); - } - __cygheap_end = ABSOLUTE(.); - __cygheap_end1 = __cygheap_mid + SIZEOF(.cygheap); } diff --git a/winsup/cygwin/dllfixdbg b/winsup/cygwin/dllfixdbg new file mode 100755 index 000000000..1e467d37c --- /dev/null +++ b/winsup/cygwin/dllfixdbg @@ -0,0 +1,65 @@ +#!/usr/bin/perl +use integer; +use strict; +sub xit($@); +my $strip = $ARGV[0] eq '-s'; +shift if $strip; +my $objdump = shift; +my @objcopy = ((shift)); +my $dll = shift; +my $dbg = shift; +xit 0, @objcopy, '--only-keep-debug', $dll, $dbg; +xit 0, @objcopy, '-g', '--add-gnu-debuglink=' . $dbg, $dll; +open(OBJDUMP, '-|', "$objdump --headers $dll"); +my %section; +while () { + my ($idx, $name, $size, $vma, $lma, $fileoff, $algn) = /^\s*(\d+)\s+(\.\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*$/; + if ($name eq '.gnu_debuglink') { + push(@objcopy, '--set-section-flag', '.gnu_debuglink=contents,readonly,debug,noload'); + } elsif ($name eq '.gnu_debuglink_overlay') { + push (@objcopy, '-R', '.gnu_debuglink_overlay'); + $section{'.gnu_debuglink'}{-idx} = $idx if $section{'.gnu_debuglink'}; + next; + } + defined($idx) and + $section{$name} = {-idx=>int($idx), -size=>hex($size), -vma=>hex($vma), -lma=>hex($lma), -fileoff=>hex($fileoff), + -algn=>0x00001000}; +} +close OBJDUMP; +my $vma; +for my $k (sort {$section{$a}{-idx} <=> $section{$b}{-idx}} keys %section) { + if ($strip && $k =~ /\.(?:stab|debug)/o) { + push(@objcopy, '-R', $k); + next; + } + if (!defined($vma)) { + $vma = $section{$k}{-vma}; + } + if ($vma != $section{$k}{-vma}) { + my $newvma = align($vma, $section{$k}{-algn}); + if ($newvma != $vma) { + printf STDERR "$0: ERROR $k VMA 0x%08x != 0x%08x\n", $vma, $newvma; + exit 1; + } + push(@objcopy, '--change-section-address', sprintf "$k=0x%08x", $vma); + } + $vma = align($vma + $section{$k}{-size}, $section{$k}{-algn}); +} +warn "$0: ERROR final VMA (" . sprintf("0x%08x", $vma) . ") not on 64K boundary\n" if $vma != align($vma, 64 * 1024); +push(@objcopy, $dll, @ARGV); +xit 1, @objcopy; +sub align { + my $n = $_[0]; + my $align = $_[1] - 1; + return ($n + $align) & ~$align; +} + +sub xit($@) { + my $execit = shift; + print "+ @_\n"; + if ($execit) { + exec @_ or die "$0: couldn't exec $_[0] - $!\n"; + } else { + system @_ and die "$0: couldn't exec $_[0] - $!\n"; + } +}