lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5957] Force linking despite overly-aggressive linker "opt


From: Greg Chicares
Subject: [lmi-commits] [5957] Force linking despite overly-aggressive linker "optimization"
Date: Sat, 04 Oct 2014 13:20:22 +0000

Revision: 5957
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5957
Author:   chicares
Date:     2014-10-04 13:20:21 +0000 (Sat, 04 Oct 2014)
Log Message:
-----------
Force linking despite overly-aggressive linker "optimization"

Modified Paths:
--------------
    lmi/trunk/ChangeLog

Added Paths:
-----------
    lmi/trunk/force_linking.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-10-04 13:18:25 UTC (rev 5956)
+++ lmi/trunk/ChangeLog 2014-10-04 13:20:21 UTC (rev 5957)
@@ -34188,3 +34188,15 @@
   http://lists.nongnu.org/archive/html/lmi/2014-09/msg00002.html
   http://lists.nongnu.org/archive/html/lmi/2014-10/msg00004.html
 
+20141004T1318Z <address@hidden> [533]
+
+  objects.make
+Improve documentation.
+
+20141004T1320Z <address@hidden> [533]
+
+  force_linking.hpp [new file]
+Force linking despite overly-aggressive linker "optimization". See:
+  http://lists.nongnu.org/archive/html/lmi/2014-08/msg00000.html
+  http://lists.nongnu.org/archive/html/lmi/2014-10/msg00006.html
+

Added: lmi/trunk/force_linking.hpp
===================================================================
--- lmi/trunk/force_linking.hpp                         (rev 0)
+++ lmi/trunk/force_linking.hpp 2014-10-04 13:20:21 UTC (rev 5957)
@@ -0,0 +1,64 @@
+// Force linking despite overly-aggressive linker "optimization".
+//
+// Copyright (C) 2014 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// http://savannah.nongnu.org/projects/lmi
+// email: <address@hidden>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+// $Id$
+
+// This is a derived work based on wxWidgets file
+//   include/wx/link.h (C) 2005 Vaclav Slavik
+// which is covered by the wxWidgets license.
+//
+// The original was trivially modified by GWC in 2014 to make all
+// identifiers specific to lmi; and in any later years given in the
+// copyright notice above.
+
+#ifndef force_linking_hpp
+#define force_linking_hpp
+
+#include "config.hpp"
+
+/// Immunize the present TU against an "optimizing" linker.
+///
+/// To immunize 'foo.o', when 'main.o' is sure to be linked, write:
+///   LMI_FORCE_LINKING_IN_SITU(foo) // in 'foo.cpp'
+///   LMI_FORCE_LINKING_EX_SITU(foo) // in 'main.cpp'
+
+#define LMI_FORCE_LINKING_IN_SITU(translation_unit_name)       \
+    extern void lmi_link_dummy_func_##translation_unit_name(); \
+    void lmi_link_dummy_func_##translation_unit_name() {}
+
+/// Immunize a different TU against an "optimizing" linker.
+///
+/// To immunize 'foo.o', when 'main.o' is sure to be linked, write:
+///   LMI_FORCE_LINKING_IN_SITU(foo) // in 'foo.cpp'
+///   LMI_FORCE_LINKING_EX_SITU(foo) // in 'main.cpp'
+
+#define LMI_FORCE_LINKING_EX_SITU(translation_unit_name)       \
+    extern void lmi_link_dummy_func_##translation_unit_name(); \
+    static struct lmi_force_link##translation_unit_name        \
+    {                                                          \
+        lmi_force_link##translation_unit_name()                \
+        {                                                      \
+            lmi_link_dummy_func_##translation_unit_name();     \
+        }                                                      \
+    } lmi_link_dummy_var_##translation_unit_name;
+
+#endif // force_linking_hpp
+


Property changes on: lmi/trunk/force_linking.hpp
___________________________________________________________________
Added: svn:keywords
   + Id




reply via email to

[Prev in Thread] Current Thread [Next in Thread]