Patchwork [windows,i386] : Make sure that really-external functions aren't dllexported

login
register
mail settings
Submitter Kai Tietz
Date Sept. 11, 2013, 8:33 a.m.
Message ID <CAEwic4b8kh8E8K6H8OiRUG=nS5PEETgsA1ocixTnGyEjzUthVA@mail.gmail.com>
Download mbox | patch
Permalink /patch/274197/
State New
Headers show

Comments

Kai Tietz - Sept. 11, 2013, 8:33 a.m.
Hi,

this patch takes care that for C/C++ inlines aren't dll-exported.

ChangeLog

2013-09-11  Kai Tietz  <ktietz@redhat.com>

    * config/i386/winnt-cxx.c (i386_pe_type_dllexport_p): Don't
    dll-export inline-functions.
    * config/i386/winnt.c (i386_pe_determine_dllexport_p): Likewise.

Tested for x86_64-w64-mingw32 and i686-w64-mingw32.  I will apply this in
a couple of hours, if there are no objections.

Regards,
Kai

Patch

Index: winnt-cxx.c
===================================================================
--- winnt-cxx.c    (Revision 202491)
+++ winnt-cxx.c    (Arbeitskopie)
@@ -65,6 +65,13 @@  i386_pe_type_dllexport_p (tree decl)
   if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE
       && DECL_ARTIFICIAL (decl) && !DECL_THUNK_P (decl))
     return false;
+  if (TREE_CODE (decl) == FUNCTION_DECL
+      && DECL_DECLARED_INLINE_P (decl))
+    {
+      if (DECL_REALLY_EXTERN (decl)
+      || !flag_keep_inline_dllexport)
+    return false;
+    }
   return true;
 }

Index: winnt.c
===================================================================
--- winnt.c    (Revision 202491)
+++ winnt.c    (Arbeitskopie)
@@ -110,6 +110,11 @@  i386_pe_determine_dllexport_p (tree decl)
   if (!TREE_PUBLIC (decl))
     return false;

+  if (TREE_CODE (decl) == FUNCTION_DECL
+      && DECL_DECLARED_INLINE_P (decl)
+      && !flag_keep_inline_dllexport)
+    return false;
+
   if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
     return true;