[Python-Dev] Should Cygwin Python use --enable-runtime-pseudo-reloc?

Jason Tishler jason@tishler.net
Thu, 30 Jan 2003 09:16:09 -0500


--Boundary_(ID_XZCmAK2yWpu7xHRwjUCNuA)
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline

The attached will obviate need for patches like the following forever:

    http://sf.net/tracker/?func=detail&aid=676837&group_id=5470&atid=305470
    http://sf.net/tracker/?func=detail&aid=676839&group_id=5470&atid=305470

Unfortunately, this is a slippery slope.  Unlike auto-importing
functions which has been around for a while, auto-importing data is
very new (and kind of scary).  Additionally, it requires a special
linker option, --enable-runtime-pseudo-reloc, to work in all cases.
Hence, Cygwin Python shared extensions and embedded interpreters will
need to modify their build process unless they are using distutils.

I'm looking for advice.  Should I use the latest, greatest Cygwin
functionality that makes building as similar as possible to Unix?  Most
likely at the expense of breaking some dependent packages.  Or, are
patches like the above considered acceptable and the preferred way to
go?

Thanks,
Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

--Boundary_(ID_XZCmAK2yWpu7xHRwjUCNuA)
Content-type: text/plain; charset=us-ascii; NAME=configure.in.diff
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=configure.in.diff

Index: configure.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure.in,v
retrieving revision 1.387
diff -u -p -r1.387 configure.in
--- configure.in	21 Jan 2003 10:14:40 -0000	1.387
+++ configure.in	30 Jan 2003 13:47:57 -0000
@@ -1101,7 +1101,7 @@ then
 		fi;;
 	SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
 	Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
-	CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
+	CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base,--enable-auto-import,--enable-runtime-pseudo-reloc";;
 	atheos*) LDSHARED="gcc -shared";;
 	*)	LDSHARED="ld";;
 	esac

--Boundary_(ID_XZCmAK2yWpu7xHRwjUCNuA)
Content-type: text/plain; charset=us-ascii; NAME=pyport.h.diff
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=pyport.h.diff

Index: pyport.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v
retrieving revision 2.58
diff -u -p -r2.58 pyport.h
--- pyport.h	6 Jan 2003 12:41:24 -0000	2.58
+++ pyport.h	30 Jan 2003 13:03:27 -0000
@@ -429,12 +429,12 @@ and both these use __declspec()
 #		else /* Py_BUILD_CORE */
 			/* Building an extension module, or an embedded situation */
 			/* public Python functions and data are imported */
-			/* Under Cygwin, auto-import functions to prevent compilation */
-			/* failures similar to http://python.org/doc/FAQ.html#3.24 */
+			/* Under Cygwin, use auto-import to prevent compilation errors */
+			/* similar to http://python.org/doc/FAQ.html#3.24 */
 #			if !defined(__CYGWIN__)
 #				define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE
+#				define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
 #			endif /* !__CYGWIN__ */
-#			define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE
 			/* module init functions outside the core must be exported */
 #			if defined(__cplusplus)
 #				define PyMODINIT_FUNC extern "C" __declspec(dllexport) void

--Boundary_(ID_XZCmAK2yWpu7xHRwjUCNuA)--