[PATCH v3] Check for -z,defs, -z,relro, -fPIC, -fPIE before using them

2017-08-18 Thread Ulf Hermann
Those flags are not available on all platforms, and omitting them when not available will not cause any harm. In particular: -z,defs disallows undefined symbols in object files. This option is unsupported if the target binary format enforces the same condition already. Furthermore it is only a com

[PATCH v2] Check if gcc complains about __attribute__ (visibility(..))

2017-08-18 Thread Ulf Hermann
If so, define attribute_hidden to be empty. Also, use attribute_hidden in all places where we hide symbols. If this attribute is missing, it simply means that we cannot hide private symbols in the binary using attributes. This disables some optimizations and may increase the risk of symbol name cl

[PATCH v2] Make sure packed structs follow the gcc memory layout

2017-08-18 Thread Ulf Hermann
gcc defaults to using struct layouts that follow the native conventions, even if __attribute__((packed)) is given. In order to get the layout we expect, we need to tell gcc to always use the gcc struct layout, at least for packed structs. To do this, we can use the gcc_struct attribute. This is im

[PATCH] Drop -rdynamic from deleted-lib.so link step

2017-08-18 Thread Ulf Hermann
-rdynamic is meant for ELF objects that need to export internal symbols to libraries they link to, but deleted-lib.so does not link to anything else and doesn't have any internal symbols. Note that the "deleted" test program does link to deleted-lib.so, but deleted-lib.so being a shared object, wi

[PATCH] Drop *_so_SOURCES from libasm, libdw, libelf Makefile.am

2017-08-18 Thread Ulf Hermann
They aren't used and cause warnings from autoconf. Signed-off-by: Ulf Hermann --- libasm/ChangeLog | 4 libasm/Makefile.am | 1 - libdw/ChangeLog| 4 libdw/Makefile.am | 1 - libelf/ChangeLog | 4 libelf/Makefile.am | 1 - 6 files changed, 12 insertions(+), 3 deletions(-)

[PATCH v3] Detect if symbol versioning is supported

2017-08-18 Thread Ulf Hermann
If not, throw an error unless symbol versioning was explicitly disabled. (Reposting rebased patch, as v2 apparently slipped) Signed-off-by: Ulf Hermann --- ChangeLog| 4 configure.ac | 15 +++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index d269

[PATCH v3] Check if rpath is supported and throw an error if not

2017-08-18 Thread Ulf Hermann
Some systems don't have rpath. In that case the backends need to be made available by some external mechanism. Provide a configure switch to explicitly turn off the setting of rpaths. Throw an error if that is not set and rpath is not supported. (Reposting rebased patch, as v2 was never reviewed.)

[PATCH v2] On non-linux systems, don't use native signal numbers

2017-08-18 Thread Ulf Hermann
We assume core files from linux systems, so we should use the linux version of the signals when reading them. Other OS might have different signal numbers. (v1 was a malformed patch) Signed-off-by: Ulf Hermann --- src/ChangeLog | 4 src/readelf.c | 24 +++- 2 files cha

[PATCH v3] Cast pid_t to long long when printing

2017-08-18 Thread Ulf Hermann
We don't know sizeof(pid_t) as it's not specified in any standard. In order to still print it, we cast to long long, the largest integer type we can easily print. (Rebased, and rephrased message: This is not a windows quirk, but rather a standards problem.) Signed-off-by: Ulf Hermann --- src/Ch