[PATCH] fix FTBFS with --target=i686-pc-cygwin
There is a syntax error in r213009 causing a FTBFS in trunk with --target=i686-pc-cygwin. Patch attached, with which trunk now builds for said target. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-12 Yaakov Selkowitz * config/i386/cygming-crtbegin.c (deregister_frame_fn): Fix declaration syntax. Index: libgcc/config/i386/cygming-crtbegin.c === --- libgcc/config/i386/cygming-crtbegin.c (revision 213759) +++ libgcc/config/i386/cygming-crtbegin.c (working copy) @@ -102,7 +102,7 @@ /* Handle of libgcc's DLL reference. */ HANDLE hmod_libgcc; -static void * (*deregister_frame_fn) (const void *) == NULL; +static void * (*deregister_frame_fn) (const void *) = NULL; #endif #if TARGET_USE_JCR_SECTION
[Patch] Enable libatomic for cygwin targets
The attached patch enabled libatomic for Cygwin targets. check-target-libatomic for i686-pc-cygwin: Running gcc/libatomic/testsuite/libatomic.c/c.exp ... === libatomic Summary === # of expected passes44 # of unsupported tests 5 check-target-libatomic results x86_64-unknown-cygwin: Running gnu/gcc/libatomic/testsuite/libatomic.c/c.exp ... === libatomic Summary === # of expected passes54 -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-12 Yaakov Selkowitz * configure.tgt: Add cygwin to supported targets. Index: libatomic/configure.tgt === --- libatomic/configure.tgt (revision 213759) +++ libatomic/configure.tgt (working copy) @@ -107,7 +107,7 @@ *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu \ | *-*-netbsd* | *-*-freebsd* | *-*-openbsd* \ | *-*-solaris2* | *-*-sysv4* | *-*-irix6* | *-*-osf* | *-*-hpux11* \ - | *-*-darwin* | *-*-aix*) + | *-*-darwin* | *-*-aix* | *-*-cygwin*) # POSIX system. The OS is supported. config_path="${config_path} posix" ;;
[PATCH] Fix cygwin-stdint.h
This patch fixes an error in r197168 where type definitions were made dependent on the host architecture instead of the target. This causes cross-compilation issues, particularly in a --host=x86_64-* --target=i686-pc-cygwin configuration. Attached patch was tested by comparing output of './gcc/xgcc -B ./gcc -dM -E - Cygwin targets. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-12 Yaakov Selkowitz * config/i386/cygwin-stdint.h: Throughout, make type definitions dependent on target architecture, not host. Index: gcc/config/i386/cygwin-stdint.h === --- gcc/config/i386/cygwin-stdint.h (revision 213874) +++ gcc/config/i386/cygwin-stdint.h (working copy) @@ -24,20 +24,12 @@ #define INT8_TYPE "signed char" #define INT16_TYPE "short int" #define INT32_TYPE "int" -#ifdef __x86_64__ -#define INT64_TYPE "long int" -#else -#define INT64_TYPE "long long int" -#endif +#define INT64_TYPE (TARGET_64BIT ? "long int" : "long long int") #define UINT8_TYPE "unsigned char" #define UINT16_TYPE "short unsigned int" #define UINT32_TYPE "unsigned int" -#ifdef __x86_64__ -#define UINT64_TYPE "long unsigned int" -#else -#define UINT64_TYPE "long long unsigned int" -#endif +#define UINT64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long unsigned int") /* Minimum-width integer types */ @@ -44,51 +36,26 @@ #define INT_LEAST8_TYPE "signed char" #define INT_LEAST16_TYPE "short int" #define INT_LEAST32_TYPE "int" -#ifdef __x86_64__ -#define INT_LEAST64_TYPE "long int" -#else -#define INT_LEAST64_TYPE "long long int" -#endif +#define INT_LEAST64_TYPE (TARGET_64BIT ? "long int" : "long long int") #define UINT_LEAST8_TYPE "unsigned char" #define UINT_LEAST16_TYPE "short unsigned int" #define UINT_LEAST32_TYPE "unsigned int" -#ifdef __x86_64__ -#define UINT_LEAST64_TYPE "long unsigned int" -#else -#define UINT_LEAST64_TYPE "long long unsigned int" -#endif +#define UINT_LEAST64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long unsigned int") /* Fastest minimum-width integer types */ #define INT_FAST8_TYPE "signed char" -#ifdef __x86_64__ -#define INT_FAST16_TYPE "long int" -#define INT_FAST32_TYPE "long int" -#define INT_FAST64_TYPE "long int" -#else -#define INT_FAST16_TYPE "int" -#define INT_FAST32_TYPE "int" -#define INT_FAST64_TYPE "long long int" -#endif +#define INT_FAST16_TYPE (TARGET_64BIT ? "long int" : "int") +#define INT_FAST32_TYPE (TARGET_64BIT ? "long int" : "int") +#define INT_FAST64_TYPE (TARGET_64BIT ? "long int" : "long long int") #define UINT_FAST8_TYPE "unsigned char" -#ifdef __x86_64__ -#define UINT_FAST16_TYPE "long unsigned int" -#define UINT_FAST32_TYPE "long unsigned int" -#define UINT_FAST64_TYPE "long unsigned int" -#else -#define UINT_FAST16_TYPE "unsigned int" -#define UINT_FAST32_TYPE "unsigned int" -#define UINT_FAST64_TYPE "long long unsigned int" -#endif +#define UINT_FAST16_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") +#define UINT_FAST32_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") +#define UINT_FAST64_TYPE (TARGET_64BIT ? "long unsigned int" : "long long unsigned int") /* Integer types capable of holding object pointers */ -#ifdef __x86_64__ -#define INTPTR_TYPE "long int" -#define UINTPTR_TYPE "long unsigned int" -#else -#define INTPTR_TYPE "int" -#define UINTPTR_TYPE "unsigned int" -#endif +#define INTPTR_TYPE (TARGET_64BIT ? "long int" : "int") +#define UINTPTR_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
[PATCH] cygwin: fix --tsaware, add --large-address-aware
This patch fixes two issues with LINK_SPEC on Cygwin targets: 1) --tsaware makes sense only for EXEs, not DLLs. 2) Under WoW64 (32-bit Cygwin on 64-bit Windows), Cygwin applications can access up to 4 GiB of address space (for DLLs, Cygwin heap, mmap()s, etc.) if they are linked with --large-address-aware. Because of how Cygwin implements fork(), the ability to use this extra space is a huge benefit. This flag too is only for EXEs, not DLLs. Patch attached. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-12 Yaakov Selkowitz * config/i386/cygwin.h (LINK_SPEC): Pass --tsaware flag only when building executables, not DLLs. Add --large-address-aware under the same conditions. * config/i386/cygwin-w64.h (LINK_SPEC): Pass --tsaware flag only when building executables, not DLLs. Add --large-address-aware under the same conditions when using -m32. Index: gcc/config/i386/cygwin-w64.h === --- gcc/config/i386/cygwin-w64.h(revision 213759) +++ gcc/config/i386/cygwin-w64.h(working copy) @@ -66,7 +66,8 @@ %{static:-Bstatic} %{!static:-Bdynamic} \ %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ %(shared_libgcc_undefs) \ - --dll-search-prefix=cyg -tsaware" + --dll-search-prefix=cyg \ + %{!shared: %{!mdll: %{" SPEC_32 ":--large-address-aware} --tsaware}}" /* Cygwin64 will have a 64-bit long type. */ #undef LONG_TYPE_SIZE Index: gcc/config/i386/cygwin.h === --- gcc/config/i386/cygwin.h(revision 213759) +++ gcc/config/i386/cygwin.h(working copy) @@ -120,7 +120,8 @@ %{shared: --shared} %{mdll:--dll} \ %{static:-Bstatic} %{!static:-Bdynamic} \ %{shared|mdll: --enable-auto-image-base -e __cygwin_dll_entry@12} \ - --dll-search-prefix=cyg -tsaware" + --dll-search-prefix=cyg \ + %{!shared: %{!mdll: --large-address-aware --tsaware}}" /* Binutils does not handle weak symbols from dlls correctly. For now, do not use them unnecessarily in gthr-posix.h. */
[PATCH] cygwin: __cxa_atexit support
This patch implements __cxa_atexit support for Cygwin targets. This requires Cygwin 1.7.32 and binutils master. Net difference in check-c++ results on i686-pc-cygwin: # of unexpected failures-11 # of unexpected successes -3 # of expected failures -61 # of unsupported tests -46 -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-12 Yaakov Selkowitz gcc/ * config/i386/cygwin.h (STARTFILE_SPEC): Use crtbeginS.o if shared. * config.gcc (*-*-cygwin*): Use __cxa_atexit by default. libgcc/ * config/i386/cygming-crtend.c (register_frame_ctor): Move atexit call from here... * config/i386/cygming-crtbegin.c (__gcc_register_frame): to here. (__dso_handle): Define on Cygwin. * config/i386/t-cygming (crtbeginS.o): New rule. * config.host (*-*-cygwin*): Add crtbeginS.o to extra_parts. Index: gcc/config/i386/cygwin.h === --- gcc/config/i386/cygwin.h(revision 213759) +++ gcc/config/i386/cygwin.h(working copy) @@ -40,7 +40,7 @@ #define STARTFILE_SPEC "\ %{!shared: %{!mdll: crt0%O%s \ %{pg:gcrt0%O%s}}}\ - crtbegin.o%s" + %{shared:crtbeginS.o%s;:crtbegin.o%s}" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ Index: gcc/config.gcc === --- gcc/config.gcc (revision 213759) +++ gcc/config.gcc (working copy) @@ -1575,6 +1575,7 @@ if test x$enable_threads = xyes; then thread_file='posix' fi + default_use_cxa_atexit=yes use_gcc_stdint=wrap ;; x86_64-*-cygwin*) @@ -1590,6 +1591,7 @@ if test x$enable_threads = xyes; then thread_file='posix' fi + default_use_cxa_atexit=yes use_gcc_stdint=wrap tm_defines="${tm_defines} TARGET_CYGWIN64=1" ;; Index: libgcc/config/i386/cygming-crtbegin.c === --- libgcc/config/i386/cygming-crtbegin.c (revision 213759) +++ libgcc/config/i386/cygming-crtbegin.c (working copy) @@ -111,6 +111,23 @@ = { }; #endif +#ifdef __CYGWIN__ +/* Declare the __dso_handle variable. It should have a unique value + in every shared-object; in a main program its value is zero. The + object should in any case be protected. This means the instance + in one DSO or the main program is not used in another object. The + dynamic linker takes care of this. */ + +#ifdef CRTSTUFFS_O +extern void *__ImageBase; +void *__dso_handle = &__ImageBase; +#else +void *__dso_handle = 0; +#endif + +#endif /* __CYGWIN__ */ + + /* Pull in references from libgcc.a(unwind-dw2-fde.o) in the startfile. These are referenced by a ctor and dtor in crtend.o. */ extern void __gcc_register_frame (void); @@ -161,6 +178,13 @@ register_class_fn (__JCR_LIST__); } #endif + +#if DEFAULT_USE_CXA_ATEXIT + /* If we use the __cxa_atexit method to register C++ dtors + at object construction, also use atexit to register eh frame + info cleanup. */ + atexit(__gcc_deregister_frame); +#endif /* DEFAULT_USE_CXA_ATEXIT */ } void Index: libgcc/config/i386/cygming-crtend.c === --- libgcc/config/i386/cygming-crtend.c (revision 213759) +++ libgcc/config/i386/cygming-crtend.c (working copy) @@ -70,12 +70,6 @@ register_frame_ctor (void) { __gcc_register_frame (); -#if DEFAULT_USE_CXA_ATEXIT - /* If we use the __cxa_atexit method to register C++ dtors - at object construction, also use atexit to register eh frame - info cleanup. */ - atexit (__gcc_deregister_frame); -#endif } #if !DEFAULT_USE_CXA_ATEXIT Index: libgcc/config/i386/t-cygming === --- libgcc/config/i386/t-cygming(revision 213759) +++ libgcc/config/i386/t-cygming(working copy) @@ -8,6 +8,9 @@ crtbegin.o: $(srcdir)/config/i386/cygming-crtbegin.c $(crt_compile) -fno-omit-frame-pointer -c $< +crtbeginS.o: $(srcdir)/config/i386/cygming-crtbegin.c + $(crt_compile) -fno-omit-frame-pointer -c $< -DCRTSTUFFS_O + # We intentionally use a implementation-reserved init priority of 0, # so allow the warning. crtend.o: $(srcdir)/config/i386/cygming-crtend.c Index: libgcc/config.host === --- libgcc/config.host (revision 213759) +++ libgcc/config.host (working copy) @@ -614,7 +614,7 @@ i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae) ;; i[34567]86-*-cygwin*) - extra_parts="crtbegin.o crtend.o crtfastmath.o" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtfastmath.o" # This has to match the logic for DWARF2_UNWIND_INFO in gcc/
[PATCH] _cxa_thread_atexit fixes for Cygwin/MinGW-w64
The attached patch implements premature DLL unloading prevention in __cxa_thread_atexit for Cygwin and MinGW-w64 targets. The mingw.org target is welcome to do the same in their os_defines.h, but this code does require Windows XP/2003, and they have historically catered to older platforms. MinGW cannot practically implement __cxa_thread_atexit_impl because it has no control over the contents of its libc (msvcrt), and implementing this in the (static) mingw32 support library would be of little benefit because it would still end up statically linked into libstdc++. Also, the GPL-with-exceptions libstdc++ implementation cannot be copied as a basis of our own __cxa_thread_atexit_impl due to licensing conflicts with both Cygwin (copyright assignment) and MinGW (public domain). The testsuite shows no regressions with this patch. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-13 Yaakov Selkowitz libstdc++-v3/ * config/os/mingw32-w64/os_defines.h (_GLIBCXX_THREAD_ATEXIT_WIN32): Define. * config/os/newlib/os_defines.h (_GLIBCXX_THREAD_ATEXIT_WIN32): Ditto. * libsupc++/atexit_thread.cc [_GLIBCXX_THREAD_ATEXIT_WIN32]: #include . (struct elt): Add dll member. (run): Decrement dll refcount. (__cxxabiv1::__cxa_thread_atexit): Increment dll refcount. Index: libstdc++-v3/config/os/mingw32-w64/os_defines.h === --- libstdc++-v3/config/os/mingw32-w64/os_defines.h (revision 213759) +++ libstdc++-v3/config/os/mingw32-w64/os_defines.h (working copy) @@ -78,4 +78,9 @@ #define _GLIBCXX_LLP64 1 #endif +// Enable use of GetModuleHandleEx (requires Windows XP/2003) in +// __cxa_thread_atexit to prevent modules from being unloaded before +// their dtors are called +#define _GLIBCXX_THREAD_ATEXIT_WIN32 1 + #endif Index: libstdc++-v3/config/os/newlib/os_defines.h === --- libstdc++-v3/config/os/newlib/os_defines.h (revision 213759) +++ libstdc++-v3/config/os/newlib/os_defines.h (working copy) @@ -47,6 +47,12 @@ // See libstdc++/20806. #define _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM 1 + +// Enable use of GetModuleHandleEx (requires Windows XP/2003) in +// __cxa_thread_atexit to prevent modules from being unloaded before +// their dtors are called +#define _GLIBCXX_THREAD_ATEXIT_WIN32 1 + #endif #endif Index: libstdc++-v3/libsupc++/atexit_thread.cc === --- libstdc++-v3/libsupc++/atexit_thread.cc (revision 213759) +++ libstdc++-v3/libsupc++/atexit_thread.cc (working copy) @@ -25,6 +25,10 @@ #include #include #include "bits/gthr.h" +#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif #if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL @@ -47,6 +51,9 @@ void (*destructor)(void *); void *object; elt *next; +#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32 +HMODULE dll; +#endif }; // Keep a per-thread list of cleanups in gthread_key storage. @@ -62,6 +69,11 @@ { elt *old_e = e; e->destructor (e->object); +#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32 + /* Decrement DLL count */ + if (e->dll) + FreeLibrary (e->dll); +#endif e = e->next; delete (old_e); } @@ -133,6 +145,14 @@ new_elt->destructor = dtor; new_elt->object = obj; new_elt->next = first; +#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32 + /* Store the DLL address for a later call to FreeLibrary in new_elt and + increment DLL load count. This blocks the unloading of the DLL + before the thread-local dtors have been called. This does NOT help + if FreeLibrary/dlclose is called in excess. */ + GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + (LPCWSTR) dtor, &new_elt->dll); +#endif if (__gthread_active_p ()) __gthread_setspecific (key, new_elt);
[PATCH] cygwin: accept -pthread
The attached patch enables the -pthread flag for cygwin targets. While not strictly necessary for compiling or linking with pthread or _r functions on Cygwin, accepting it allows for better compatibility with other platforms. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2014-08-14 Yaakov Selkowitz gcc/ * config.gcc (*-*-cygwin*): Add i386/cygwin.opt to extra_options. * config/i386/cygwin.h (CPP_SPEC): Accept -pthread. (LINK_SPEC): Ditto. (GOMP_SELF_SPECS): Update comment. * config/i386/cygwin.opt: New file for -pthread flag. Index: gcc/config.gcc === --- gcc/config.gcc (revision 213759) +++ gcc/config.gcc (working copy) @@ -1568,7 +1568,7 @@ xm_file=i386/xm-cygwin.h tmake_file="${tmake_file} i386/t-cygming t-slibgcc" target_gtfiles="\$(srcdir)/config/i386/winnt.c" - extra_options="${extra_options} i386/cygming.opt" + extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt" extra_objs="winnt.o winnt-stubs.o" c_target_objs="${c_target_objs} msformat-c.o" cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" @@ -1584,7 +1584,7 @@ xm_file=i386/xm-cygwin.h tmake_file="${tmake_file} i386/t-cygming t-slibgcc i386/t-cygwin-w64" target_gtfiles="\$(srcdir)/config/i386/winnt.c" - extra_options="${extra_options} i386/cygming.opt" + extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt" extra_objs="winnt.o winnt-stubs.o" c_target_objs="${c_target_objs} msformat-c.o" cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o" Index: gcc/config/i386/cygwin.h === --- gcc/config/i386/cygwin.h(revision 213759) +++ gcc/config/i386/cygwin.h(working copy) @@ -32,6 +32,7 @@ #undef CPP_SPEC #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ %{!ansi:-Dunix} \ + %{pthread:-D_REENTRANT} \ %{mwin32:-DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ %{!ansi:-DWINNT}} \ %{!nostdinc:%{!mno-win32:-idirafter ../include/w32api%s -idirafter ../../include/w32api%s}}\ " @@ -77,6 +77,7 @@ #undef LIB_SPEC #define LIB_SPEC "\ %{pg:-lgmon} \ + %{pthread: } \ -lcygwin \ %{mwindows:-lgdi32 -lcomdlg32} \ -ladvapi32 -lshell32 -luser32 -lkernel32" @@ -129,7 +131,7 @@ /* Every program on cygwin links against cygwin1.dll which contains the pthread routines. There is no need to explicitly link them - and the -pthread flag is not recognized. */ + and the -pthread flag is accepted only for compatibility. */ #undef GOMP_SELF_SPECS #define GOMP_SELF_SPECS "" #undef GTM_SELF_SPECS Index: gcc/config/i386/cygwin.opt === --- gcc/config/i386/cygwin.opt (revision 0) +++ gcc/config/i386/cygwin.opt (working copy) @@ -0,0 +1,24 @@ +; Cygwin-specific options. + +; Copyright (C) 2013-2014 Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; GCC is free software; you can redistribute it and/or modify it under +; the terms of the GNU General Public License as published by the Free +; Software Foundation; either version 3, or (at your option) any later +; version. +; +; GCC is distributed in the hope that it will be useful, but WITHOUT ANY +; WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +; for more details. +; +; You should have received a copy of the GNU General Public License +; along with GCC; see the file COPYING3. If not see +; <http://www.gnu.org/licenses/>. + +pthread +Driver + +; Retain blank line above
[PATCH] toplevel: fixes for in-tree libiconv
This is the first in a series of patches to make a build with an in-tree GNU libiconv work as designed. This patch fixes dependencies for parallel make, and avoids failures with make targets not supported by GNU libiconv. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2015-05-29 Yaakov Selkowitz * Makefile.def (libiconv): Mark pdf/html/info as missing. (configure-gcc): Depend on all-libiconv. (all-gcc): Ditto. (configure-libcpp): Ditto. (all-libcpp): Ditto. (configure-intl): Ditto. * Makefile.in: Regenerate. Index: Makefile.def === --- Makefile.def (revision 223875) +++ Makefile.def (working copy) @@ -95,7 +95,9 @@ host_modules= { module= libiconv; extra_configure_flags='--disable-shared'; no_install= true; - missing= install-info; + missing= pdf; + missing= html; + missing= info; missing= install-pdf; missing= install-html; missing= install-info; }; @@ -322,6 +324,7 @@ dependencies = { module=configure-gcc; on=all-ld; }; dependencies = { module=configure-gcc; on=all-gold; }; dependencies = { module=configure-gcc; on=all-libelf; }; +dependencies = { module=configure-gcc; on=all-libiconv; }; dependencies = { module=all-gcc; on=all-libiberty; hard=true; }; dependencies = { module=all-gcc; on=all-intl; }; dependencies = { module=all-gcc; on=all-mpfr; }; @@ -340,6 +343,7 @@ dependencies = { module=all-gcc; on=all-libiberty; }; dependencies = { module=all-gcc; on=all-fixincludes; }; dependencies = { module=all-gcc; on=all-lto-plugin; }; +dependencies = { module=all-gcc; on=all-libiconv; }; dependencies = { module=info-gcc; on=all-build-libiberty; }; dependencies = { module=dvi-gcc; on=all-build-libiberty; }; dependencies = { module=pdf-gcc; on=all-build-libiberty; }; @@ -351,8 +355,10 @@ dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; }; dependencies = { module=configure-libcpp; on=configure-intl; }; +dependencies = { module=configure-libcpp; on=all-libiconv; }; dependencies = { module=all-libcpp; on=all-libiberty; hard=true; }; dependencies = { module=all-libcpp; on=all-intl; }; +dependencies = { module=all-libcpp; on=all-libiconv; }; dependencies = { module=all-fixincludes; on=all-libiberty; }; @@ -371,6 +377,7 @@ dependencies = { module=all-utils; on=all-libiberty; }; +dependencies = { module=configure-intl; on=all-libiconv; }; dependencies = { module=configure-mpfr; on=all-gmp; }; dependencies = { module=configure-mpc; on=all-mpfr; }; dependencies = { module=configure-isl; on=all-gmp; }; Index: Makefile.in === --- Makefile.in (revision 223875) +++ Makefile.in (working copy) @@ -24221,24 +24221,8 @@ @if libiconv maybe-info-libiconv: info-libiconv -info-libiconv: \ -configure-libiconv - @: $(MAKE); $(unstage) - @[ -f ./libiconv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing info in libiconv"; \ - (cd $(HOST_SUBDIR)/libiconv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ - info) \ - || exit 1 +# libiconv doesn't support info. +info-libiconv: @endif libiconv @@ -24273,24 +24257,8 @@ @if libiconv maybe-pdf-libiconv: pdf-libiconv -pdf-libiconv: \ -configure-libiconv - @: $(MAKE); $(unstage) - @[ -f ./libiconv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ - eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ - done; \ - echo "Doing pdf in libiconv"; \ - (cd $(HOST_SUBDIR)/libiconv && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ - "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ - "RANLIB=$${RANLIB}" \ - "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ - pdf) \ - || exit 1 +# libiconv doesn't support pdf. +pdf-libiconv: @endif libiconv @@ -24299,24 +24267,8 @@ @if libiconv maybe-html-libiconv: html-libiconv -html-libiconv: \ -configure-libiconv - @: $(MAKE); $(unstage) - @[ -f ./libiconv/Makefile ] || exit 0; \ - r=`${PWD_COMMAND}`; export r; \ - s=`cd $(srcdir); ${PWD_COMMAND}`; expo
[PATCH] config: fix AM_ICONV for in-tree libiconv
This is the second in a series of patches to make a build with an in-tree GNU libiconv work as designed. Currently GDB is the only toolchain component which actually uses an in-tree libiconv. This patch modifies the common AM_ICONV to use an in-tree libiconv when present and not already provided by libc. (GDB's workaround uses an in-tree libiconv even when libc provides iconv(3); I'm not sure when or why that would be desirable.) Once these two patches are merged in to each tree, I will follow with patches to regenerate the various configure scripts and a few other minor corresponding changes. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc.
Re: [PATCH] toplevel: fixes for in-tree libiconv
On Tue, 2015-06-16 at 00:08 -0400, DJ Delorie wrote: > > This is the first in a series of patches to make a build with an in-tree > > GNU libiconv work as designed. > > > > This patch fixes dependencies for parallel make, and avoids failures > > with make targets not supported by GNU libiconv. > > This is OK. Thanks! Thanks. I don't have write access, could a toplevel maintainer please commit? -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc.
Re: [PATCH] toplevel: fixes for in-tree libiconv
On Fri, 2015-05-29 at 16:14 -0500, Yaakov Selkowitz wrote: > This is the first in a series of patches to make a build with an in-tree > GNU libiconv work as designed. > > This patch fixes dependencies for parallel make, and avoids failures > with make targets not supported by GNU libiconv. Thanks Jeff and DJ for reviewing. Further testing exposed an insufficiency in my patch in the case of the 3-stage bootstrap. Revised patch attached, bootstrapped on x86_64-cygwin both with and without a libiconv directory, and also with a directory and configured --disable-libiconv. I don't have write permissions to either gcc SVN nor binutils-gdb.git, so please apply once approved. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2015-07-01 Yaakov Selkowitz * Makefile.def (libiconv): Define bootstrap=true. Mark pdf/html/info as missing. (configure-gcc): Depend on all-libiconv. (all-gcc): Ditto. (configure-libcpp): Ditto. (all-libcpp): Ditto. (configure-intl): Ditto. (all-intl): Ditto. * Makefile.in: Regenerate. Index: Makefile.def === --- Makefile.def (revision 225215) +++ Makefile.def (working copy) @@ -93,9 +93,12 @@ extra_make_flags='@extra_linker_plugin_flags@'; }; // We abuse missing to avoid installing anything for libiconv. host_modules= { module= libiconv; + bootstrap=true; extra_configure_flags='--disable-shared'; no_install= true; - missing= install-info; + missing= pdf; + missing= html; + missing= info; missing= install-pdf; missing= install-html; missing= install-info; }; @@ -322,6 +325,7 @@ dependencies = { module=configure-gcc; on=all-ld; }; dependencies = { module=configure-gcc; on=all-gold; }; dependencies = { module=configure-gcc; on=all-libelf; }; +dependencies = { module=configure-gcc; on=all-libiconv; }; dependencies = { module=all-gcc; on=all-libiberty; hard=true; }; dependencies = { module=all-gcc; on=all-intl; }; dependencies = { module=all-gcc; on=all-mpfr; }; @@ -340,6 +344,7 @@ dependencies = { module=all-gcc; on=all-libiberty; }; dependencies = { module=all-gcc; on=all-fixincludes; }; dependencies = { module=all-gcc; on=all-lto-plugin; }; +dependencies = { module=all-gcc; on=all-libiconv; }; dependencies = { module=info-gcc; on=all-build-libiberty; }; dependencies = { module=dvi-gcc; on=all-build-libiberty; }; dependencies = { module=pdf-gcc; on=all-build-libiberty; }; @@ -351,8 +356,10 @@ dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; }; dependencies = { module=configure-libcpp; on=configure-intl; }; +dependencies = { module=configure-libcpp; on=all-libiconv; }; dependencies = { module=all-libcpp; on=all-libiberty; hard=true; }; dependencies = { module=all-libcpp; on=all-intl; }; +dependencies = { module=all-libcpp; on=all-libiconv; }; dependencies = { module=all-fixincludes; on=all-libiberty; }; @@ -371,9 +378,11 @@ dependencies = { module=all-utils; on=all-libiberty; }; +dependencies = { module=configure-intl; on=all-libiconv; }; dependencies = { module=configure-mpfr; on=all-gmp; }; dependencies = { module=configure-mpc; on=all-mpfr; }; dependencies = { module=configure-isl; on=all-gmp; }; +dependencies = { module=all-intl; on=all-libiconv; }; // Host modules specific to gdb. dependencies = { module=configure-gdb; on=all-intl; }; Index: Makefile.in === --- Makefile.in (revision 225215) +++ Makefile.in (working copy) @@ -1079,7 +1079,9 @@ @if libiberty-linker-plugin-no-bootstrap all-host: maybe-all-libiberty-linker-plugin @endif libiberty-linker-plugin-no-bootstrap +@if libiconv-no-bootstrap all-host: maybe-all-libiconv +@endif libiconv-no-bootstrap all-host: maybe-all-m4 all-host: maybe-all-readline all-host: maybe-all-sid @@ -24134,7 +24136,6 @@ @if libiconv maybe-configure-libiconv: configure-libiconv configure-libiconv: - @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ test ! -f $(HOST_SUBDIR)/libiconv/Makefile || exit 0; \ @@ -24158,8 +24159,213 @@ +.PHONY: configure-stage1-libiconv maybe-configure-stage1-libiconv +maybe-configure-stage1-libiconv: +@if libiconv-bootstrap +maybe-configure-stage1-libiconv: configure-stage1-libiconv +configure-stage1-libiconv: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiconv + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE1_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libiconv/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 1 in $(HOST_SUBDIR)/libiconv; \ + $(SHELL)
Re: [PATCH] toplevel: fixes for in-tree libiconv
On Fri, 2015-05-29 at 16:14 -0500, Yaakov Selkowitz wrote: > This is the first in a series of patches to make a build with an in-tree > GNU libiconv work as designed. > > This patch fixes dependencies for parallel make, and avoids failures > with make targets not supported by GNU libiconv. Thanks Jeff and DJ for reviewing. Further testing exposed an insufficiency in my patch in the case of the 3-stage bootstrap. Revised patch attached, bootstrapped on x86_64-cygwin both with and without a libiconv directory, and also with a directory and configured --disable-libiconv. I don't have write permissions to either gcc SVN nor binutils-gdb.git, so please apply once approved. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2015-07-01 Yaakov Selkowitz * Makefile.def (libiconv): Define bootstrap=true. Mark pdf/html/info as missing. (configure-gcc): Depend on all-libiconv. (all-gcc): Ditto. (configure-libcpp): Ditto. (all-libcpp): Ditto. (configure-intl): Ditto. (all-intl): Ditto. * Makefile.in: Regenerate. Index: Makefile.def === --- Makefile.def (revision 225215) +++ Makefile.def (working copy) @@ -93,9 +93,12 @@ extra_make_flags='@extra_linker_plugin_flags@'; }; // We abuse missing to avoid installing anything for libiconv. host_modules= { module= libiconv; + bootstrap=true; extra_configure_flags='--disable-shared'; no_install= true; - missing= install-info; + missing= pdf; + missing= html; + missing= info; missing= install-pdf; missing= install-html; missing= install-info; }; @@ -322,6 +325,7 @@ dependencies = { module=configure-gcc; on=all-ld; }; dependencies = { module=configure-gcc; on=all-gold; }; dependencies = { module=configure-gcc; on=all-libelf; }; +dependencies = { module=configure-gcc; on=all-libiconv; }; dependencies = { module=all-gcc; on=all-libiberty; hard=true; }; dependencies = { module=all-gcc; on=all-intl; }; dependencies = { module=all-gcc; on=all-mpfr; }; @@ -340,6 +344,7 @@ dependencies = { module=all-gcc; on=all-libiberty; }; dependencies = { module=all-gcc; on=all-fixincludes; }; dependencies = { module=all-gcc; on=all-lto-plugin; }; +dependencies = { module=all-gcc; on=all-libiconv; }; dependencies = { module=info-gcc; on=all-build-libiberty; }; dependencies = { module=dvi-gcc; on=all-build-libiberty; }; dependencies = { module=pdf-gcc; on=all-build-libiberty; }; @@ -351,8 +356,10 @@ dependencies = { module=configure-libcpp; on=configure-libiberty; hard=true; }; dependencies = { module=configure-libcpp; on=configure-intl; }; +dependencies = { module=configure-libcpp; on=all-libiconv; }; dependencies = { module=all-libcpp; on=all-libiberty; hard=true; }; dependencies = { module=all-libcpp; on=all-intl; }; +dependencies = { module=all-libcpp; on=all-libiconv; }; dependencies = { module=all-fixincludes; on=all-libiberty; }; @@ -371,9 +378,11 @@ dependencies = { module=all-utils; on=all-libiberty; }; +dependencies = { module=configure-intl; on=all-libiconv; }; dependencies = { module=configure-mpfr; on=all-gmp; }; dependencies = { module=configure-mpc; on=all-mpfr; }; dependencies = { module=configure-isl; on=all-gmp; }; +dependencies = { module=all-intl; on=all-libiconv; }; // Host modules specific to gdb. dependencies = { module=configure-gdb; on=all-intl; }; Index: Makefile.in === --- Makefile.in (revision 225215) +++ Makefile.in (working copy) @@ -1079,7 +1079,9 @@ @if libiberty-linker-plugin-no-bootstrap all-host: maybe-all-libiberty-linker-plugin @endif libiberty-linker-plugin-no-bootstrap +@if libiconv-no-bootstrap all-host: maybe-all-libiconv +@endif libiconv-no-bootstrap all-host: maybe-all-m4 all-host: maybe-all-readline all-host: maybe-all-sid @@ -24134,7 +24136,6 @@ @if libiconv maybe-configure-libiconv: configure-libiconv configure-libiconv: - @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ test ! -f $(HOST_SUBDIR)/libiconv/Makefile || exit 0; \ @@ -24158,8 +24159,213 @@ +.PHONY: configure-stage1-libiconv maybe-configure-stage1-libiconv +maybe-configure-stage1-libiconv: +@if libiconv-bootstrap +maybe-configure-stage1-libiconv: configure-stage1-libiconv +configure-stage1-libiconv: + @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libiconv + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + TFLAGS="$(STAGE1_TFLAGS)"; \ + test ! -f $(HOST_SUBDIR)/libiconv/Makefile || exit 0; \ + $(HOST_EXPORTS) \ + CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \ + CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \ + LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; \ + echo Configuring stage 1 in $(HOST_SUBDIR)/libiconv; \ + $(SHELL)
Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
On Fri, 2015-05-29 at 16:25 -0500, Yaakov Selkowitz wrote: > This is the second in a series of patches to make a build with an > in-tree GNU libiconv work as designed. > > Currently GDB is the only toolchain component which actually uses an > in-tree libiconv. This patch modifies the common AM_ICONV to use an > in-tree libiconv when present and not already provided by libc. (GDB's > workaround uses an in-tree libiconv even when libc provides iconv(3); > I'm not sure when or why that would be desirable.) > > Once these two patches are merged in to each tree, I will follow with > patches to regenerate the various configure scripts and a few other > minor corresponding changes. This patch was bootstrapped in conjunction with the toplevel libiconv patch. I don't have write permissions to either repository, so please apply once approved. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc.
Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
On Wed, 2015-07-01 at 15:46 -0500, Yaakov Selkowitz wrote: > On Fri, 2015-05-29 at 16:25 -0500, Yaakov Selkowitz wrote: > > This is the second in a series of patches to make a build with an > > in-tree GNU libiconv work as designed. > > > > Currently GDB is the only toolchain component which actually uses an > > in-tree libiconv. This patch modifies the common AM_ICONV to use an > > in-tree libiconv when present and not already provided by libc. (GDB's > > workaround uses an in-tree libiconv even when libc provides iconv(3); > > I'm not sure when or why that would be desirable.) > > > > Once these two patches are merged in to each tree, I will follow with > > patches to regenerate the various configure scripts and a few other > > minor corresponding changes. > > This patch was bootstrapped in conjunction with the toplevel libiconv > patch. I don't have write permissions to either repository, so please > apply once approved. Ditto for this patch, which regenerates intl/configure for the changes in config/iconv.m4. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc.
Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
On Wed, 2015-07-01 at 15:46 -0500, Yaakov Selkowitz wrote: > On Fri, 2015-05-29 at 16:25 -0500, Yaakov Selkowitz wrote: > > This is the second in a series of patches to make a build with an > > in-tree GNU libiconv work as designed. > > > > Currently GDB is the only toolchain component which actually uses an > > in-tree libiconv. This patch modifies the common AM_ICONV to use an > > in-tree libiconv when present and not already provided by libc. (GDB's > > workaround uses an in-tree libiconv even when libc provides iconv(3); > > I'm not sure when or why that would be desirable.) > > > > Once these two patches are merged in to each tree, I will follow with > > patches to regenerate the various configure scripts and a few other > > minor corresponding changes. > > This patch was bootstrapped in conjunction with the toplevel libiconv > patch. I don't have write permissions to either repository, so please > apply once approved. This patch includes the relevant changes for libcpp/configure and gcc/configure{.ac,}. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2015-07-01 Yaakov Selkowitz libcpp/ * configure: Regenerate. gcc/ * configure.ac: Define LIBICONV_DEP with in-tree libiconv. * configure: Regenerate. Index: libcpp/configure === --- libcpp/configure (revision 225215) +++ libcpp/configure (working copy) @@ -4733,6 +4733,12 @@ # Figure out what compiler warnings we can enable. # See config/warnings.m4 for details. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + warn= save_CFLAGS="$CFLAGS" for real_option in -W -Wall -Wno-narrowing -Wwrite-strings \ @@ -4778,7 +4784,19 @@ fi done CFLAGS="$save_CFLAGS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + c_warn= save_CFLAGS="$CFLAGS" for real_option in -Wstrict-prototypes -Wmissing-prototypes \ @@ -4824,7 +4842,19 @@ fi done CFLAGS="$save_CFLAGS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + WARN_PEDANTIC= # Do the check with the no- prefix removed from the warning options # since gcc silently accepts any -Wno-* option on purpose @@ -4862,9 +4892,21 @@ fi fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Disable exceptions and RTTI if building with g++ +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + noexception_flags= save_CFLAGS="$CFLAGS" for real_option in -fno-exceptions -fno-rtti; do @@ -4909,10 +4951,22 @@ fi done CFLAGS="$save_CFLAGS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Only enable with --enable-werror-always until existing warnings are # corrected. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + WERROR= # Check whether --enable-werror-always was given. if test &
Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
On Wed, 2015-07-01 at 15:52 -0500, Yaakov Selkowitz wrote: > On Wed, 2015-07-01 at 15:46 -0500, Yaakov Selkowitz wrote: > > On Fri, 2015-05-29 at 16:25 -0500, Yaakov Selkowitz wrote: > > > This is the second in a series of patches to make a build with an > > > in-tree GNU libiconv work as designed. > > > > > > Currently GDB is the only toolchain component which actually uses an > > > in-tree libiconv. This patch modifies the common AM_ICONV to use an > > > in-tree libiconv when present and not already provided by libc. (GDB's > > > workaround uses an in-tree libiconv even when libc provides iconv(3); > > > I'm not sure when or why that would be desirable.) > > > > > > Once these two patches are merged in to each tree, I will follow with > > > patches to regenerate the various configure scripts and a few other > > > minor corresponding changes. > > > > This patch was bootstrapped in conjunction with the toplevel libiconv > > patch. I don't have write permissions to either repository, so please > > apply once approved. > > Ditto for this patch, which regenerates intl/configure for the changes > in config/iconv.m4. With the patch attached this time. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. Index: intl/configure === --- intl/configure (revision 225215) +++ intl/configure (working copy) @@ -609,8 +609,6 @@ USE_INCLUDED_LIBINTL BUILD_INCLUDED_LIBINTL INTLBISON -LTLIBICONV -LIBICONV GLIBC21 ALLOCA EGREP @@ -684,9 +682,9 @@ ac_user_opts=' enable_option_checking enable_nls +with_libiconv_prefix with_gnu_ld enable_rpath -with_libiconv_prefix with_included_gettext with_libintl_prefix enable_maintainer_mode @@ -1319,9 +1317,9 @@ Optional Packages: --with-PACKAGE[=ARG]use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-libiconv-prefix=DIR + search for libiconv in DIR/include and DIR/lib --with-gnu-ld assume the C compiler uses GNU ld default=no - --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib - --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-included-gettext use the GNU gettext library included here --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir @@ -4849,548 +4847,7 @@ fi - if test "X$prefix" = "XNONE"; then -acl_final_prefix="$ac_default_prefix" - else -acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then -acl_final_exec_prefix='${prefix}' - else -acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then -PATH_SEPARATOR=';' - else -PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 -$as_echo_n "checking for ld used by GCC... " >&6; } - case $host in - *-*-mingw*) -# gcc leaves a trailing carriage return which upsets mingw -ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) -ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in -# Accept absolute paths. -[\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") -# If it fails, then pretend we aren't using GCC. -ac_prog=ld -;; - *) -# If it is relative, then search for the first ld in PATH. -with_gnu_ld=unknown
Re: [PATCH] config: fix AM_ICONV for in-tree libiconv
On Sat, 2015-08-22 at 18:04 +0100, Pedro Alves wrote: > I noticed that regenerating binutils/configure or gdb/configure > undoes the libiconv changes done here: [snip] > However, that commit does not include any config/iconv.m4/AM_ICONV > change. Looks like you forgot to attach the config/iconv.m4 patch, and > then only the regeneration bits were pushed (both binutils-gdb git > and gcc svn)? Looks like I forgot to repost that part of the patchset; attached. -- Yaakov Selkowitz Associate Software Engineer, ARM Red Hat, Inc. 2015-07-01 Yaakov Selkowitz config/ * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present. Index: config/iconv.m4 === --- config/iconv.m4 (revision 223875) +++ config/iconv.m4 (working copy) @@ -7,6 +7,7 @@ dnl the same distribution terms as the rest of that program. dnl From Bruno Haible. +dnl with modifications to support building with in-tree libiconv AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ @@ -28,16 +29,15 @@ dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no +dnl Add $INCICONV to CPPFLAGS before performing the first check, +dnl because if the user has installed libiconv and not disabled its use +dnl via --without-libiconv-prefix, he wants to use it. This first +dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. +am_save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $INCICONV" AC_TRY_LINK([#include #include ], [iconv_t cd = iconv_open("",""); @@ -44,8 +44,36 @@ iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);], am_cv_func_iconv=yes) +CPPFLAGS="$am_save_CPPFLAGS" + +if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then + for _libs in .libs _libs; do +am_save_CPPFLAGS="$CPPFLAGS" +am_save_LIBS="$LIBS" +CPPFLAGS="$CPPFLAGS -I../libiconv/include" +LIBS="$LIBS ../libiconv/lib/$_libs/libiconv.a" +AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + INCICONV="-I../libiconv/include" + LIBICONV='${top_builddir}'/../libiconv/lib/$_libs/libiconv.a + LTLIBICONV='${top_builddir}'/../libiconv/lib/libiconv.la + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) +CPPFLAGS="$am_save_CPPFLAGS" +LIBS="$am_save_LIBS" +if test "$am_cv_func_iconv" = "yes"; then + break +fi + done +fi + if test "$am_cv_func_iconv" != yes; then + am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" + CPPFLAGS="$LIBS $INCICONV" LIBS="$LIBS $LIBICONV" AC_TRY_LINK([#include #include ], @@ -54,6 +82,7 @@ iconv_close(cd);], am_cv_lib_iconv=yes am_cv_func_iconv=yes) + CPPFLAGS="$am_save_CPPFLAGS" LIBS="$am_save_LIBS" fi ]) @@ -61,12 +90,10 @@ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) fi if test "$am_cv_lib_iconv" = yes; then +AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else -dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV -dnl either. -CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi