summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-04-19 12:06:56 +0200
committerUlf Hermann <[email protected]>2017-05-08 10:11:55 +0000
commit709d36789f4465b4e7a4948b98e0d7c5c66fac2f (patch)
tree18abf54b27adfd370e41c82067a3520dbf2ab82a /lib
parent90fc7851b5f1f5dac88d5b822c12b1f4764e3d86 (diff)
Provide build rules for a compatibility library
We need to export open(), close(), malloc(), and free() from the C library we are using so that we can handle resources passed to and from elfutils correctly. For example, on Windows, calling free() on memory malloc()'d with a different C library will not work. In addition, having __cxa_demangle from the GNU libstdc++ available is very helpful, so we include that, too. Change-Id: I8e47e8f313fb3ffcc18309dadabf24acf36465f0 Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog6
-rw-r--r--lib/Makefile.am35
-rw-r--r--lib/eu_compat.def.in7
3 files changed, 46 insertions, 2 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 0433f023..ceb6ac25 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,11 @@
2017-05-04 Ulf Hermann <[email protected]>
+ * Makefile.am: On windows, build an eu_compat.dll to forward symbols
+ from the C and std C++ libraries elfutils links against.
+ * eu_compat.def.in: New file.
+
+2017-05-04 Ulf Hermann <[email protected]>
+
* printversion.h: Define ARGP_PROGRAM_VERSION_HOOK_DEF and
ARGP_BUG_ADDRESS_DEF to be non-const and drop the asm tricks.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index afff7176..48947c64 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -57,5 +57,36 @@ install-headers:
uninstall-headers:
endif
-install: install-am install-headers
-uninstall: uninstall-am uninstall-headers
+EXTRA_DIST += eu_compat.def.in
+if NATIVE_PE
+eu_compat.def: eu_compat.def.in
+ cp $< $@
+
+$(libeu_compat_BARE): eu_compat.def
+ $(CCLD) $(dso_LDFLAGS) $(LDFLAGS) -o $@ $< -lstdc++
+
+noinst_DATA = $(eu_compat_BARE)
+
+install-lib: $(libeu_compat_BARE) $(libeu_compat_BARE:.dll=.lib)
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) $(libeu_compat_BARE) $(DESTDIR)$(libdir)/$(libeu_compat_VERSIONED)
+ ln -fs $(libeu_compat_VERSIONED) $(DESTDIR)$(libdir)/$(libeu_compat_SONAME)
+ ln -fs $(libeu_compat_SONAME) $(DESTDIR)$(libdir)/$(libeu_compat_BARE)
+ $(INSTALL_PROGRAM) $(libeu_compat_BARE:.dll=.lib) $(DESTDIR)$(libdir)/$(libeu_compat_VERSIONED:.dll=.lib)
+ ln -fs $(libeu_compat_VERSIONED:.dll=.lib) $(DESTDIR)$(libdir)/$(libeu_compat_SONAME:.dll=.lib)
+ ln -fs $(libeu_compat_SONAME:.dll=.lib) $(DESTDIR)$(libdir)/$(libeu_compat_BARE:.dll=.lib)
+uninstall-lib:
+ rm -f $(DESTDIR)$(libdir)/$(libeu_compat_VERSIONED)
+ rm -f $(DESTDIR)$(libdir)/$(libeu_compat_SONAME)
+ rm -f $(DESTDIR)$(libdir)/$(libeu_compat_BARE)
+ rm -f $(DESTDIR)$(libdir)/$(libeu_compat_VERSIONED:.dll=.lib)
+ rm -f $(DESTDIR)$(libdir)/$(libeu_compat_SONAME:.dll=.lib)
+ rm -f $(DESTDIR)$(libdir)/$(libeu_compat_BARE:.dll=.lib)
+CLEANFILES += $(libeu_compat_BARE:.dll=.lib) $(libeu_compat_BARE:.dll=.exp)
+else
+install-lib:
+uninstall-lib:
+endif
+
+install: install-am install-headers install-lib
+uninstall: uninstall-am uninstall-headers install-lib
diff --git a/lib/eu_compat.def.in b/lib/eu_compat.def.in
new file mode 100644
index 00000000..c2aa88ff
--- /dev/null
+++ b/lib/eu_compat.def.in
@@ -0,0 +1,7 @@
+LIBRARY "eu_compat.dll"
+EXPORTS
+eu_compat_demangle=__cxa_demangle
+eu_compat_open=msvcrt._open
+eu_compat_close=msvcrt._close
+eu_compat_malloc=msvcrt.malloc
+eu_compat_free=msvcrt.free