Re: [PATCH] Add -D_FORTIFY_SOURCE=2 to CFLAGS if possible.

2017-02-14 Thread Mark Wielaard
On Thu, 2017-02-09 at 21:13 +0100, Mark Wielaard wrote:
> Some distros now add -D_FORTIFY_SOURCE=2 by default and we have missed
> some issues in the past caught by it. Add it to CFLAGS if possible.
> The configure check will make sure that it doesn't conflict with any
> other CFLAGS already defined.

I pushed this to master now.


Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-14 Thread Mark Wielaard
On Mon, 2017-02-13 at 11:01 +0100, Ulf Hermann wrote:
> Thanks for pointing out the issues. I will track down the white space problem.
> 
> > I could reconstruct it from that pastebin. But it was a bit of a
> > struggle, some parts didn't apply as is because tabs seemed to be turned
> > into spaces. I tried to repost it to the list. But the first time it was
> > bounced as "spam" and the second time after removing the git-bin-diffs
> > sourceware seemed to accept it, but then it never showed up on the list.
> > (See below for the logs on my end.)
> 
> I have the same frame pointer unwinding fallbacks for arm and arm64 in
> the elfutils bundled with perfparser. I just need to write test cases
> for them, then I will post them, too. So, it's probably a good idea to
> either have the mailing list accept patches with inline binaries or
> allow some other channel of patch submission.

I didn't know about perfparse. I assume that is this code base:
http://code.qt.io/cgit/qt-creator/perfparser.git/
Very nice.

Please feel free to sent the commit (with git send-email) to me and I
can add them to a review branch in elfutils.git so others can review
them easily. Or if you already have them in your own git tree feel free
to sent the commits to review/pull to the list. And we can pull them
from there. I assume this must be the patch that adds the arm64 support:
http://code.qt.io/cgit/qt-creator/perfparser.git/commit/3rdparty/elfutils?id=17ad3b57d613fede17a01b6cdd2d894850364f81

I'll ask overseers if something can be done about the sourceware list
being a little bit too strict on blocking these emails as spam.

Thanks,

Mark


Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-14 Thread Ulf Hermann



I didn't know about perfparse. I assume that is this code base:
http://code.qt.io/cgit/qt-creator/perfparser.git/
Very nice.


Yes. I'm also trying to port this to windows. So, I have lots of changes to 
make the code more portable: https://codereview.qt-project.org/#/c/184401/ and 
the 50 changes depending on that. I will try to get those into an acceptable 
form and post them here.


Please feel free to sent the commit (with git send-email) to me and I
can add them to a review branch in elfutils.git so others can review
them easily. Or if you already have them in your own git tree feel free
to sent the commits to review/pull to the list. And we can pull them
from there. I assume this must be the patch that adds the arm64 support:
http://code.qt.io/cgit/qt-creator/perfparser.git/commit/3rdparty/elfutils?id=17ad3b57d613fede17a01b6cdd2d894850364f81


In principle yes. However, perfparser doesn't include elfutils' test framework 
and writing the tests I've found some problems with the frame pointer 
unwinders. So don't just take that commit ... I'll send the new versions to you 
personally.

regards,
Ulf


[PATCH] Move color handling into a separate header

2017-02-14 Thread Ulf Hermann

We only need it in nm.c and objdump.c, but it pulls in argp as
dependency. By dropping it from libeu.h, the libraries can be
compiled without argp.

Signed-off-by: Ulf Hermann 
---
 lib/ChangeLog   |  7 +++
 lib/Makefile.am |  2 +-
 lib/color.c |  2 +-
 lib/color.h | 63 +
 lib/libeu.h | 32 -
 src/ChangeLog   |  5 +
 src/nm.c|  1 +
 src/objdump.c   |  1 +
 8 files changed, 79 insertions(+), 34 deletions(-)
 create mode 100644 lib/color.h

diff --git a/lib/ChangeLog b/lib/ChangeLog
index fcf5b10..5ccf4d6 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,10 @@
+2017-02-14  Ulf Hermann  
+
+   * color.h: New file.
+   * color.c: Include color.h.
+   * libeu.h: Remove color handling.
+   * Makefile.am (noinst_HEADERS): Add color.h.
+
 2016-12-29  Luiz Angelo Daros de Luca  
 
 	* crc32_file.c: Include system.h.

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1ad9ce8..3e0c601 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -38,7 +38,7 @@ libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c 
\
  color.c version.c
 
 noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \

-md5.h sha1.h eu-config.h
+md5.h sha1.h eu-config.h color.h
 EXTRA_DIST = dynamicsizehash.c
 
 if !GPROF

diff --git a/lib/color.c b/lib/color.c
index fde2d9d..f62389d 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -38,7 +38,7 @@
 #include 
 #include 
 #include "libeu.h"
-
+#include "color.h"
 
 /* Prototype for option handler.  */

 static error_t parse_opt (int key, char *arg, struct argp_state *state);
diff --git a/lib/color.h b/lib/color.h
new file mode 100644
index 000..3872eb0
--- /dev/null
+++ b/lib/color.h
@@ -0,0 +1,63 @@
+/* Handling of color output.
+   Copyright (C) 2017 The Qt Company
+   This file is part of elfutils.
+   Written by Ulrich Drepper , 2011.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+   Software Foundation; either version 3 of the License, or (at
+   your option) any later version
+
+   or
+
+ * the GNU General Public License as published by the Free
+   Software Foundation; either version 2 of the License, or (at
+   your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils 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 copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see .  */
+
+
+#ifndef COLOR_H
+#define COLOR_H 1
+
+/* Command line parser.  */
+extern const struct argp color_argp;
+
+/* Coloring mode.  */
+enum color_enum
+  {
+color_never = 0,
+color_always,
+color_auto
+  } __attribute__ ((packed));
+extern enum color_enum color_mode;
+
+/* Colors to use for the various components.  */
+extern char *color_address;
+extern char *color_bytes;
+extern char *color_mnemonic;
+extern char *color_operand1;
+extern char *color_operand2;
+extern char *color_operand3;
+extern char *color_label;
+extern char *color_undef;
+extern char *color_undef_tls;
+extern char *color_undef_weak;
+extern char *color_symbol;
+extern char *color_tls;
+extern char *color_weak;
+
+extern const char color_off[];
+
+#endif /* color.h */
diff --git a/lib/libeu.h b/lib/libeu.h
index 69fe3d7..ecb4d01 100644
--- a/lib/libeu.h
+++ b/lib/libeu.h
@@ -43,36 +43,4 @@ extern char *xstrndup (const char *, size_t) __attribute__ 
((__malloc__));
 extern uint32_t crc32 (uint32_t crc, unsigned char *buf, size_t len);
 extern int crc32_file (int fd, uint32_t *resp);
 
-

-/* Color handling.  */
-
-/* Command line parser.  */
-extern const struct argp color_argp;
-
-/* Coloring mode.  */
-enum color_enum
-  {
-color_never = 0,
-color_always,
-color_auto
-  } __attribute__ ((packed));
-extern enum color_enum color_mode;
-
-/* Colors to use for the various components.  */
-extern char *color_address;
-extern char *color_bytes;
-extern char *color_mnemonic;
-extern char *color_operand1;
-extern char *color_operand2;
-extern char *color_operand3;
-extern char *color_label;
-extern char *color_undef;
-extern char *color_undef_tls;
-extern char *color_undef_weak;
-extern char *color_symbol;
-extern char *color_tls;
-extern char *color_weak;
-
-extern const char color_off[];
-
 #endif
diff --git a/src/ChangeLog b/src/ChangeLog
index 2a6d93e..19c7dbb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-14  Ulf Hermann  
+
+   * nm.c: Include color.h.
+   * objdump.c: Likewise.
+
 2016-12-24  Mark

Re: [PATCH] Add -D_FORTIFY_SOURCE=2 to CFLAGS if possible.

2017-02-14 Thread Mike Frysinger
On 09 Feb 2017 21:13, Mark Wielaard wrote:
> +# See if we can add -D_FORTIFY_SOURCE=2. Don't do it if it is already
> +# (differently) defined or if it generates warnings/errors because we
> +# don't use the right optimisation level (string.h will warn about that).
> +AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CFLAGS])

-D flags should be in CPPFLAGS ...

> +case "$CFLAGS" in
> +  *-D_FORTIFY_SOURCE=2*)
> +AC_MSG_RESULT([no, already there])
> +;;
> +  *)
> +save_CFLAGS="$CFLAGS"
> +CFLAGS="-D_FORTIFY_SOURCE=2 -Werror $CFLAGS"
> +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
> +  #include 
> +  int main() { return 0; }
> +]])], [ AC_MSG_RESULT([yes])
> +CFLAGS="-D_FORTIFY_SOURCE=2 $save_CFLAGS" ],
> +  [ AC_MSG_RESULT([no])
> +CFLAGS="$save_CFLAGS"])
> +  ;;

why not AC_PREPROC_IFELSE and check if _FORTIFY_SOURCE is defined ?
-mike


signature.asc
Description: Digital signature