Patch for relocatable GCC package on mingw32

Christopher Faylor cgf@redhat.com
Wed Oct 10 05:55:00 GMT 2001


On Wed, Oct 10, 2001 at 06:34:52PM +1000, Danny Smith wrote:
>Hello
>
>GCC for mingw needs to build a relocatable package (ie search paths
>relative to gcc driver).  Currently the information needed to do that
>is overriden by undefines in i386/cygwin.h,which is included by
>i386/mingw32.h. Appended patch protects aginst these undefines.
>
>It also changes a few additional macros to be consistent with current
>mingw usage and reformats a comment that keeps wrapping lines.
>
>Please apply to branch and trunk.

Hmm.  I'm sorry, Danny, but now that I've had a second chance to see this
patch, I have a minor nit that didn't occur to me at first.

I'm sorry to say that I don't like the name
WIN32_BUILD_RELOCATABLE_PACKAGE as a name.  The word "RELOCATABLE" is
ambiguous in this case since it usually refers to object code not
file location.

Can I suggest something like WIN32_NO_ABSOLUTE_INST_DIRS maybe?

If you agree to this name, I'll apply the patch with this change.

cgf


>Thanks
>
>ChangeLog
>
>	2001-10-10  Danny Smith  <danny_r_smith_2001@yahoo.co.nz>
>	
>	* config/i386/mingw32.h (WIN32_BUILD_RELOCATABLE_PACKAGE): New
>	define.	(Thanks to Mumit Khan for suggesting macro name).
>	(CPP_PREDEFINES): Define __MINGW32__ but don't set value; add
>	more WIN32 defines.
>	(STANDARD_INCLUDE_DIR): Remove i386- from directory name.
>	(STANDARD_INCLUDE_COMPONENT): Change to MINGW.
>	(MATH_LIBRARY): Undef before definition.
>	(OUTPUT_QUOTED_STRING): Likewise.
>	* config/i386/cygwin.h: Use WIN32_BUILD_RELOCATABLE_PACKAGE.
>
>
>Index: gcc/gcc/config/i386/cygwin.h
>===================================================================
>RCS file: /cvs/gcc/gcc/gcc/config/i386/cygwin.h,v
>retrieving revision 1.51
>diff -u -p -r1.51 cygwin.h
>--- cygwin.h	2001/09/21 01:27:04	1.51
>+++ cygwin.h	2001/10/10 03:03:55
>@@ -461,6 +461,9 @@ extern int i386_pe_dllimport_name_p PARA
> #define SET_ASM_OP "\t.set\t"
> #endif
> 
>+/* Override GCC's relative pathname lookup (ie., relocatability) unless
>+   otherwise told by other subtargets.  */
>+#ifndef WIN32_BUILD_RELOCATABLE_PACKAGE
> #undef MD_STARTFILE_PREFIX
> #define MD_STARTFILE_PREFIX     "/usr/lib/"
> 
>@@ -473,7 +476,8 @@ extern int i386_pe_dllimport_name_p PARA
> #undef SYSTEM_INCLUDE_DIR
> #undef STANDARD_INCLUDE_DIR
> #define STANDARD_INCLUDE_DIR 0
>-#endif
>+#endif /* not CROSS_COMPILE */
>+#endif /* not WIN32_BUILD_RELOCATABLE_PACKAGE */
> 
> #undef TREE
>Index: gcc/gcc/config/i386/mingw32.h
>===================================================================
>RCS file: /cvs/gcc/gcc/gcc/config/i386/mingw32.h,v
>retrieving revision 1.20
>diff -u -p -r1.20 mingw32.h
>--- mingw32.h	2001/04/19 20:28:05	1.20
>+++ mingw32.h	2001/10/10 03:05:13
>@@ -22,6 +22,12 @@ Boston, MA 02111-1307, USA. */
> /* Most of this is the same as for cygwin, except for changing some
>    specs.  */
> 
>+/* Mingw GCC, unlike Cygwin's, must be relocatable. This macro must 
>+   be defined before any other files are included. */
>+#ifndef WIN32_BUILD_RELOCATABLE_PACKAGE
>+#define WIN32_BUILD_RELOCATABLE_PACKAGE 1
>+#endif
>+
> #include "i386/cygwin.h"
> 
> #define TARGET_EXECUTABLE_SUFFIX ".exe"
>@@ -30,15 +36,15 @@ Boston, MA 02111-1307, USA. */
>    only difference between the two should be __MSVCRT__ needed to 
>    distinguish MSVC from CRTDLL runtime in mingw headers. */
> #undef CPP_PREDEFINES
>-#define CPP_PREDEFINES "-D_WIN32 -DWIN32 \
>-  -D__MINGW32__=0.2 -D__MSVCRT__ -DWINNT -D_X86_=1 \
>+#define CPP_PREDEFINES "-D_WIN32 -D__WIN32 -D__WIN32__ -DWIN32 \
>+  -D__MINGW32__ -D__MSVCRT__ -DWINNT -D_X86_=1 \
>   -Asystem=winnt"
> 
> /* Specific a different directory for the standard include files.  */
> #undef STANDARD_INCLUDE_DIR
>-#define STANDARD_INCLUDE_DIR "/usr/local/i386-mingw32/include"
>-
>-#define STANDARD_INCLUDE_COMPONENT "MINGW32"
>+#define STANDARD_INCLUDE_DIR "/usr/local/mingw32/include"
>+#undef STANDARD_INCLUDE_COMPONENT
>+#define STANDARD_INCLUDE_COMPONENT "MINGW"
> 
> #undef CPP_SPEC
> #define CPP_SPEC \
>@@ -75,10 +81,12 @@ Boston, MA 02111-1307, USA. */
>   %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
> 
> /* MS runtime does not need a separate math library. */
>+#undef MATH_LIBRARY
> #define MATH_LIBRARY ""
> 
>-/* Output STRING, a string representing a filename, to FILE.  We
>canonicalize
>-   it to be in MS-DOS format.  */
>+/* Output STRING, a string representing a filename, to FILE.
>+   We canonicalize it to be in MS-DOS format.  */
>+#undef OUTPUT_QUOTED_STRING
> #define OUTPUT_QUOTED_STRING(FILE, STRING) \
> do {						\
>   char c;					\
>
>
> http://travel.yahoo.com.au - Yahoo! Travel
>- Got Itchy feet? Get inspired!

-- 
cgf@cygnus.com                        Red Hat, Inc.
http://sources.redhat.com/            http://www.redhat.com/



More information about the Gcc-patches mailing list