configure: Keep the old mingw pseudo-relocation behaviour for mingw32ce

Message ID 20170825103206.37730-1-martin@martin.st
State Rejected
Headers show

Commit Message

Martin Storsjö Aug. 25, 2017, 10:32 a.m.
Using proper dllexport/dllimport seems to fail with the mingw32ce
compiler (causing internal compiler errors). This toolchain is
unmaintained since quite some time so there's no point in hoping
for fixes.
---
This is to be squashed into patch 4/5.

Alternatively, we could just drop mingw32ce from fate and get rid of
the extra mingw32ce references in the code (surprisingly few though).
---
 configure             | 13 +++++++++----
 libavcodec/internal.h |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

Comments

Luca Barbato Aug. 25, 2017, 4:59 p.m. | #1
On 25/08/2017 12:32, Martin Storsjö wrote:
> Alternatively, we could just drop mingw32ce from fate and get rid of
> the extra mingw32ce references in the code (surprisingly few though).

If you think that target is unneeded, I'm all for it.

lu

Patch

diff --git a/configure b/configure
index 6f7af32bab..a644e7f52c 100755
--- a/configure
+++ b/configure
@@ -4032,7 +4032,7 @@  case $target_os in
         elif enabled arm; then
             LIBTARGET=arm-wince
         fi
-        if enabled shared; then
+        if enabled shared && test $target_os = "mingw32ce"; then
             # Cannot build both shared and static libs when using dllexport.
             disable static
         fi
@@ -4043,13 +4043,18 @@  case $target_os in
         SLIBSUF=".dll"
         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
-        SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_LINKS=
         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
         SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
-        SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
-        SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)'
+        if test $target_os = "mingw32ce"; then
+            SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
+            SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+        else
+            SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
+            SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
+            SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)'
+        fi
         enabled x86_64 && objformat="win64" || objformat="win32"
         dlltool="${cross_prefix}dlltool"
         ranlib=:
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index da1b2fa7d1..268c745940 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -285,7 +285,7 @@  int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
  */
 AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx);
 
-#if defined(_WIN32) && CONFIG_SHARED
+#if defined(_WIN32) && CONFIG_SHARED && !defined(__MINGW32CE__)
 #ifdef BUILDING_avcodec
 #    define av_export_avcodec __declspec(dllexport)
 #else