* Re: [PATCH] Allow to build for non-ELF target
@ 2016-10-12 14:58 Mark Wielaard
0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2016-10-12 14:58 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
Hi,
On which platforms have you tested this? What about the testsuite?
We have various self-tests that depend on the binaries/libraries being
ELF file. We should probably skip those as unsupported then?
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Allow to build for non-ELF target
@ 2016-10-14 1:56 Akihiko Odaki
0 siblings, 0 replies; 3+ messages in thread
From: Akihiko Odaki @ 2016-10-14 1:56 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
Hi,
I used it on x86_64-pc-msys and x86_64-w64-mingw32. The testsuite
doesn't work because it doesn't have shared libraries, tools, and ELF
binary, as you said. I can add code to skip tests if you want.
Regards,
Akihiko Odaki
On 2016-10-12 23:58, Mark Wielaard wrote:
> Hi,
>
> On which platforms have you tested this? What about the testsuite?
> We have various self-tests that depend on the binaries/libraries being
> ELF file. We should probably skip those as unsupported then?
>
> Thanks,
>
> Mark
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Allow to build for non-ELF target
@ 2016-10-11 14:10 Akihiko Odaki
0 siblings, 0 replies; 3+ messages in thread
From: Akihiko Odaki @ 2016-10-11 14:10 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 4430 bytes --]
Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
---
backends/Makefile.am | 5 ++++-
configure.ac | 13 ++++++++++++-
lib/eu-config.h | 4 ++++
libdw/Makefile.am | 5 ++++-
libelf/Makefile.am | 5 ++++-
5 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/backends/Makefile.am b/backends/Makefile.am
index b553ec3..eed46d7 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -31,6 +31,9 @@ include $(top_srcdir)/config/eu.am
AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
-I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
+if ELF
+AM_LDFLAGS = -Wl,-z,defs
+endif
modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
tilegx m68k bpf
@@ -136,7 +139,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
$(AM_V_CCLD)$(LINK) -shared -o $(@:.map=.so) \
-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
-Wl,--version-script,$(@:.so=.map) \
- -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
+ -Wl,--as-needed $(libelf) $(libdw)
@$(textrel_check)
libebl_i386.so: $(cpu_i386)
diff --git a/configure.ac b/configure.ac
index e5503f1..fa731c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,13 +121,24 @@ CFLAGS="$old_CFLAGS"])
AS_IF([test "x$ac_cv_c99" != xyes],
AC_MSG_ERROR([gcc with GNU99 support required]))
+AC_CACHE_CHECK([the output format of the linker is ELF], ac_cv_elf,[dnl
+case `$CC -Wl,-print-output-format -nodefaultlibs -nostartfiles` in
+ elf*) ac_cv_elf=yes ;;
+ *) ac_cv_elf=no ;;
+esac])
+AM_CONDITIONAL(ELF, test "$ac_cv_elf" = yes)
+AS_IF(test "$ac_cv_elf" = yes, elf_val=0, elf_val=1)
+AC_SUBST(ELF, $elf_val)
+AH_TEMPLATE([ELF], [whether the output format of the linker is ELF])
+
AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
# Use the same flags that we use for our DSOs, so the test is representative.
# Some old compiler/linker/libc combinations fail some ways and not others.
save_CFLAGS="$CFLAGS"
save_LDFLAGS="$LDFLAGS"
CFLAGS="-fPIC $CFLAGS"
-LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS"
+LDFLAGS="-shared $LDFLAGS"
+AS_IF([test "$ac_cv_elf" = yes], [LDFLAGS="-Wl,-z,defs,-z,relro $LDFLAGS"])
AC_LINK_IFELSE([dnl
AC_LANG_PROGRAM([[#include <stdlib.h>
#undef __thread
diff --git a/lib/eu-config.h b/lib/eu-config.h
index 400cdc6..5f1dda3 100644
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -68,8 +68,12 @@
#define internal_strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
+#ifdef ELF
#define attribute_hidden \
__attribute__ ((visibility ("hidden")))
+#else
+#define attribute_hidden
+#endif
/* Define ALLOW_UNALIGNED if the architecture allows operations on
unaligned memory locations. */
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 082d96c..a637e18 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -102,13 +102,16 @@ endif
libdw_pic_a_SOURCES =
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
+if ELF
+libdw_so_LDFLAGS = -Wl,-z,defs
+endif
libdw_so_SOURCES =
libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
../libelf/libelf.so
# The rpath is necessary for libebl because its $ORIGIN use will
# not fly in a setuid executable that links in libdw.
- $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
+ $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION) \
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 167a832..41302c3 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -100,11 +100,14 @@ if USE_LOCKS
libelf_so_LDLIBS += -lpthread
endif
+if ELF
+libelf_so_LDFLAGS = -Wl,-z,defs,-z,relro
+endif
libelf_so_SOURCES =
libelf.so$(EXEEXT): libelf_pic.a libelf.map
$(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
-Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
- -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
+ -Wl,--soname,$@.$(VERSION) $(libelf_so_LDLIBS)
@$(textrel_check)
$(AM_V_at)ln -fs $@ $@.$(VERSION)
--
2.10.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-14 1:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12 14:58 [PATCH] Allow to build for non-ELF target Mark Wielaard
-- strict thread matches above, loose matches on Subject: below --
2016-10-14 1:56 Akihiko Odaki
2016-10-11 14:10 Akihiko Odaki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).