Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

FYI: GCC 4.5.0 on Mingw.org

<< < (16/17) > >>

reckless:
thanks leo :)

a14331990:
Also packed all dlls in dir /mingw/bin as dlls-7z465.7z, available at downloads column of a1mingwgcc googlecode page.

cobines:
The solution posted here seems to work, which is not using __declspec(dllexport) but rather --enable-auto-import in the linker. Defined WXEXPORT as empty and added --enable-auto-import to LDFLAGS, using MinGW's GCC 4.5.0-1 with MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release, DLL is about 9MB.

wangdong1226:

--- Quote from: cobines on October 15, 2010, 12:06:06 am ---The solution posted here seems to work, which is not using __declspec(dllexport) but rather --enable-auto-import in the linker. Defined WXEXPORT as empty and added --enable-auto-import to LDFLAGS, using MinGW's GCC 4.5.0-1 with MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release, DLL is about 9MB.


--- End quote ---

I've tried several times, my config file (Laoden's copyright  :) ):

--- Quote ---mingw32-make -f makefile.gcc CXXFLAGS="-enable-auto-import -O2 -pipe -mthreads -fvisibility=hidden -fvisibility-inlines-hidden" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries -Wl,-enable-auto-import -s" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_STC=0 USE_PROPGRID=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=static

--- End quote ---

but every time, I got error (ld returns 1 or ld returns 5 or out of memory ...) and can not produce wxmsw28u_gcc.dll file.

I use GCC4.6 with 'auto-import.diff' and gcc patch 'pr43601-try.diff' (this patch was applied by GCC4.6 officially, no need to apply by myself):

'auto-import.diff' file:

--- Quote ---
--- ld/emultempl/pe.em   2009-09-14 19:43:30 +0800
+++ ld/emultempl/pe.em   2010-01-29 10:49:20 +0800
@@ -155,7 +155,7 @@
     default_auto_import=1
     ;;
   *)
-    default_auto_import=-1
+    default_auto_import=1
     ;;
 esac
 
@@ -946,7 +946,8 @@
 
       if (pe_enable_stdcall_fixup == -1)
         {
-          einfo (_("Warning: resolving %s by linking to %s\n"),
+          if (link_info.pei386_auto_import == -1)
+               info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
             undef->root.string, cname);
           if (! gave_warning_message)
             {
@@ -973,7 +974,8 @@
 
       if (pe_enable_stdcall_fixup == -1)
         {
-          einfo (_("Warning: resolving %s by linking to %s\n"),
+          if (link_info.pei386_auto_import == -1)
+               info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
             undef->root.string, sym->root.string);
           if (! gave_warning_message)
             {

--- End quote ---

'pr43601-try.diff' file:

--- Quote ---
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt   (revision 168608)
+++ gcc/c-family/c.opt   (working copy)
@@ -814,6 +814,10 @@ ffriend-injection
 C++ ObjC++ Var(flag_friend_injection)
 Inject friend functions into enclosing namespace
 
+fkeep-inline-dllexport
+C C++ ObjC ObjC++ Var(flag_keep_inline_dllexport) Init(1) Report Condition(TARGET_DLLIMPORT_DECL_ATTRIBUTES)
+Don't emit dllexported inline functions unless needed
+
 flabels-ok
 C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
 
Index: gcc/tree.c
===================================================================
--- gcc/tree.c   (revision 168608)
+++ gcc/tree.c   (working copy)
@@ -5509,7 +5509,8 @@ handle_dll_attribute (tree * pnode, tree name, tre
         DECL_DLLIMPORT_P (node) = 1;
     }
   else if (TREE_CODE (node) == FUNCTION_DECL
-      && DECL_DECLARED_INLINE_P (node))
+      && DECL_DECLARED_INLINE_P (node)
+      && flag_keep_inline_dllexport)
     /* An exported function, even if inline, must be emitted.  */
     DECL_EXTERNAL (node) = 0;
 
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c   (revision 168608)
+++ gcc/cp/semantics.c   (working copy)
@@ -3446,7 +3446,8 @@ expand_or_defer_fn_1 (tree fn)
       if ((flag_keep_inline_functions
       && DECL_DECLARED_INLINE_P (fn)
       && !DECL_REALLY_EXTERN (fn))
-     || lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn)))
+     || (flag_keep_inline_dllexport
+         && lookup_attribute ("dllexport", DECL_ATTRIBUTES (fn))))
    mark_needed (fn);
     }
 
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c   (revision 168608)
+++ gcc/cp/decl2.c   (working copy)
@@ -1780,7 +1780,8 @@ decl_needed_p (tree decl)
       return true;
   /* Functions marked "dllexport" must be emitted so that they are
      visible to other DLLs.  */
-  if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
+  if (flag_keep_inline_dllexport
+      && lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
     return true;
   /* Otherwise, DECL does not need to be emitted -- yet.  A subsequent
      reference to DECL might cause it to be emitted later.  */

--- End quote ---

my gcc (officially with 'pr43601-try.diff' patch applied) info:

--- Quote ---
C:\Documents and Settings\David>gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=d:/program/mingw/bin/../libexec/gcc/mingw32/4.6.0/lto-wrappe
r.exe
Target: mingw32
Configured with: ../source/GCC46/configure --prefix=/mingw --build=mingw32 --hos
t=mingw32 --target=mingw32 --enable-languages=c,c++ --enable-libgomp --enable-li
biconv --disable-werror --enable-threads=win32 --disable-nls --disable-win32-reg
istry --disable-sjlj-exceptions --with-dwarf2 --enable-lto --enable-fully-dynami
c-string --with-system-zlib --with-host-libstdcxx=-lstdc++ --enable-libstdcxx-de
bug --enable-cxx-flags='-fno-function-sections -fno-data-sections' --disable-lib
stdcxx-pch --disable-symvers --enable-version-specific-runtime-libs --enable-boo
tstrap --enable-static --disable-shared --with-pkgversion=pcx32
Thread model: win32
gcc version 4.6.0 20110318 (prerelease) (pcx32)

--- End quote ---

my ld (with 'auto-import.diff' patch applied by myself) info:

--- Quote ---
C:\Documents and Settings\David>ld -v
GNU ld (pcx32) 2.21.51.20110313

--- End quote ---

Could someone be kindly to tell me what's the reason or any solution?

And I also want to know, if I want to use LTO of GCC4.6 to build wxWidgets, how to modify the config file?
like this ?

--- Quote ---mingw32-make -f makefile.gcc CXXFLAGS="-enable-auto-import -O2 -pipe -mthreads -fvisibility=hidden -fvisibility-inlines-hidden -flto" LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--copy-dt-needed-entries -Wl,-enable-auto-import -Wl,-flto -s" SHARED=1 BUILD=release UNICODE=1 DEBUG_INFO=0 DEBUG_FLAG=0 MONOLITHIC=1 USE_STC=0 USE_PROPGRID=1 USE_EXCEPTIONS=0 USE_RTTI=0 OFFICIAL_BUILD=1 RUNTIME_LIBS=static

--- End quote ---

waiting for kindly help.

Best regards.
David.

reckless:
hmm the dll inline patch you use seems to be a backport of the gcc-4.6 branch while its supposedly fixed i found that dll's still grow to huge proportions with the 4.6 version of gcc, so it seems its not totally fixed yet.

lto is btw broken with the 32 bit mingw version of gcc-4.6.0 but its still not released so i hope they iron it out before it hits release.

stage 1 bootstrap seems to be broken with the 64 bit mingw version also if you try to build it with freshly built version of the gcc-4.6.0 release candidate (collect2 ld returns 116 exit status) it builds fine with older gcc but it should be able to bootstrap itself which it cant.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version