Re: [PATCH 2/2] run-strip-reloc.sh: Skip debug file check for riscv

2018-07-17 Thread Andreas Schwab
On Jul 17 2018, Mark Wielaard  wrote:

> On Mon, Jul 16, 2018 at 12:02:17PM +0200, Ulf Hermann wrote:
>> strip does not produce debug files for riscv binaries. If this is a bug
>> it needs to be fixed in strip, but for now, we disable the tests.
>
> The issue is that hello_riscv64.ko doesn't contain any debug sections.
> So strip doesn't produce a separate debug file.
>
> Andreas, could you provide an updated hello_riscv64.ko that is compiled
> with -g and does contain debuginfo?

What is the issue?  The test worksforme.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH 2/2] run-strip-reloc.sh: Skip debug file check for riscv

2018-07-17 Thread Mark Wielaard
On Tue, 2018-07-17 at 11:29 +0200, Andreas Schwab wrote:
> On Jul 17 2018, Mark Wielaard  wrote:
> > The issue is that hello_riscv64.ko doesn't contain any debug
> > sections.
> > So strip doesn't produce a separate debug file.
> > 
> > Andreas, could you provide an updated hello_riscv64.ko that is
> > compiled
> > with -g and does contain debuginfo?
> 
> What is the issue?  The test worksforme.

The problem is that the test is designed to see that strip works to
properly to remove the .debug sections and remove relocations against
.debug sections for a .ko file. But the hello_riscv64.ko file doesn't
contain any .debug sections so it trivially succeeds. Ulf fixed the
test to make sure strip actually does any work by removing the old
debug files. This shows the current hello_riscv64.ko failing.

If you could regenerate the file with -g so that it does contain .debug
sections that would help us fix the testcase.

Thanks,

Mark


Re: [PATCH 2/2] run-strip-reloc.sh: Skip debug file check for riscv

2018-07-17 Thread Andreas Schwab
On Jul 17 2018, Ulf Hermann  wrote:

> My first patch removes all temporary files at the beginning of runtest()
> which exposes this.

Thanks, I see the failure now.  Here is the updated module:



hello_riscv64.ko.bz2
Description: BZip2 compressed data

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH 2/2] run-strip-reloc.sh: Skip debug file check for riscv

2018-07-17 Thread Andreas Schwab
On Jul 17 2018, Mark Wielaard  wrote:

> If you could regenerate the file with -g so that it does contain .debug
> sections that would help us fix the testcase.

It would probably help to update the build instructions to force debug
builds by adding CONFIG_DEBUG_INFO=y.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH 2/2] run-strip-reloc.sh: Skip debug file check for riscv

2018-07-17 Thread Mark Wielaard
On Tue, 2018-07-17 at 12:09 +0200, Andreas Schwab wrote:
> It would probably help to update the build instructions to force
> debug
> builds by adding CONFIG_DEBUG_INFO=y.

Yes, good idea, added that and updated the test file.

Thanks,

MarkFrom c1d7a08c990a13472b64281dbf79b13fb74f9e5a Mon Sep 17 00:00:00 2001
From: Mark Wielaard 
Date: Tue, 17 Jul 2018 12:27:51 +0200
Subject: [PATCH] tests: Update hello_riscv64.ko test file with debuginfo.

Also document CONFIG_DEBUG_INFO=y.

Updated test file provided by Andreas Schwab .

Signed-off-by: Mark Wielaard 
---
 tests/ChangeLog|   5 +
 tests/hello_riscv64.ko.bz2 | Bin 1166 -> 39548 bytes
 tests/run-strip-reloc.sh   |   4 +++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0677b9f..5a9dc33 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-17  Mark Wielaard  
+
+	* hello_riscv64.ko.bz2: Updated with debuginfo.
+	* run-strip-reloc.sh: Add documentation on CONFIG_DEBUG_INFO=y.
+
 2018-07-05  Mark Wielaard  
 
 	* next_cfi.c (handle_section): Take a new argument name. Check
diff --git a/tests/hello_riscv64.ko.bz2 b/tests/hello_riscv64.ko.bz2
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v8Pw-hKHbJ2A?UIeXo{TVF9c{h|{AABqk8|0Wb)am&UH0EG?!?$5{I
zjlHw>UyD&(Hf-y@3XxZNQ2zk|C=oCb{|5j-?0vytH#~kh33C5R<*q7=5=ZXLTTYmH
z5zZcLTV9QATZj)@-ZrOf>mW|MCIA4g4cpf3*7IJx+Xk7O%+kV|^h2p9T?#W}o>+pT
zPUX3;`BQk3TQKt9KzcR-JiBYtUvtj7YGc>d)^0lOHd-#aN6c-Rm&ch2o=0;pet_L>
zxO{o|HM#Zy5M8z{|LK99^zj^jJ-v3h{U-bY#A~l~uUEC+`O>F}J*7}_F
zHHs(#8@5jdp0ZzG9kvZ$8;Apf7oXEv{@C7;Pm=VU$O=hjo+=(7INOE|00rjvJ7R()
zpfkg=B*U^eMK9fnE5|zdkc{Z^^Ttf%%z0l?L?IS0hC?OpKq?dr85Q3?v5=}{Bh^pw
z7H>%jNHUCGN9zzV8M$Eve3WhP9(0La8D7dRt?!mPxMIA1okEf)D;?97%```*45Q$3togY#vRhJkJ+_)F(=wQ!WGvV*@{}k!h?~D
z+c$8Ka4I5Mn(=3nS40prFWsO#@uM)LVHkxhGMzw7C_tt&ciW+n^V$x4rWuO1*IvdwStynkU0z=PecFDQpuN}H(Ye08)v;SD7NJt

Re: [PATCH 1/2] Remove previous test files before running the next round

2018-07-17 Thread Mark Wielaard
On Mon, 2018-07-16 at 23:57 +0200, Mark Wielaard wrote:
> On Mon, Jul 16, 2018 at 12:01:21PM +0200, Ulf Hermann wrote:
> > strip explicitly creates the new files. This will not work on
> > windows if
> > the files already exist.
> > 
> > Also, if strip fails to create the files for any reason, we would
> > check
> > the previous run's files and succeed. However, the test should fail
> > then.
> 
> This makes sense and does uncover a bug as your second patch shows.
> I want to fix that first and only then commit this fix. That way we
> don't have the testsuite failing between commits.

Pushed now that we have an updated hello_riscv64.ko test file.

Thanks,

Mark


[PATCH] backends: add core_note callback for RISC-V

2018-07-17 Thread Andreas Schwab
Signed-off-by: Andreas Schwab 
---
 backends/ChangeLog|  6 
 backends/Makefile.am  |  2 +-
 backends/riscv_corenote.c | 60 +++
 backends/riscv_init.c |  1 +
 4 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 backends/riscv_corenote.c

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 0532760046..bf31072e3a 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-17  Andreas Schwab  
+
+   * Makefile.am (riscv_SRCS): Add riscv_corenote.c.
+   * riscv_corenote.c: New file.
+   * riscv_init.c (riscv_init): Hook core_note.
+
 2018-07-11  Andreas Schwab  
 
* Makefile.am (riscv_SRCS): Add riscv_initreg.c.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index f782e8828b..50507c7966 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -132,7 +132,7 @@ libebl_bpf_pic_a_SOURCES = $(bpf_SRCS)
 am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os)
 
 riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
-riscv_initreg.c
+riscv_initreg.c riscv_corenote.c
 libebl_riscv_pic_a_SOURCES = $(riscv_SRCS)
 am_libebl_riscv_pic_a_OBJECTS = $(riscv_SRCS:.c=.os)
 
diff --git a/backends/riscv_corenote.c b/backends/riscv_corenote.c
new file mode 100644
index 00..37cce7e3d3
--- /dev/null
+++ b/backends/riscv_corenote.c
@@ -0,0 +1,60 @@
+/* RISC-V specific core note handling.
+   This file is part of elfutils.
+
+   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 .  */
+
+#ifdef HAVE_CONFIG_H
+# include 
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BACKENDriscv_
+#include "libebl_CPU.h"
+
+#defineULONG   uint64_t
+#define PID_T  int32_t
+#defineUID_T   uint32_t
+#defineGID_T   uint32_t
+#define ALIGN_ULONG8
+#define ALIGN_PID_T4
+#define ALIGN_UID_T4
+#define ALIGN_GID_T4
+#define TYPE_ULONG ELF_T_XWORD
+#define TYPE_PID_T ELF_T_SWORD
+#define TYPE_UID_T ELF_T_WORD
+#define TYPE_GID_T ELF_T_WORD
+
+static const Ebl_Register_Location prstatus_regs[] =
+  {
+{ .offset = 1, .regno = 1, .count = 31, .bits = 64 } /* x1..x31 */
+  };
+#define PRSTATUS_REGS_SIZE (32 * 8)
+
+#include "linux-core-note.c"
diff --git a/backends/riscv_init.c b/backends/riscv_init.c
index c74c6af50f..8b7ce8b5d9 100644
--- a/backends/riscv_init.c
+++ b/backends/riscv_init.c
@@ -58,6 +58,7 @@ riscv_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, check_special_symbol);
   HOOK (eh, machine_flag_check);
   HOOK (eh, set_initial_registers_tid);
+  HOOK (eh, core_note);
 
   return MODVERSION;
 }
-- 
2.18.0


-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Re: [PATCH] backends: add core_note callback for RISC-V

2018-07-17 Thread Mark Wielaard
Looks good as far as I can tell.
Pushed to master. But it would be really nice to have a testcase.
Could you look at tests/run-readelf-mixed-corenote.sh and add something
similar for RISC-V?

Thanks,

Mark


Re: [PATCH] Don't include sys/uio.h if we don't need it

2018-07-17 Thread Mark Wielaard
On Tue, Jul 17, 2018 at 01:40:26PM +0200, Ulf Hermann wrote:
> 
> The PID attaching only works on linux.
> 
> Change-Id: I00428a711b64cb490429363ef28a867b1347956e

Thanks applied to master.
I did remove the Change-Id tag.
And normally we do require a Signed-off-by line.

Cheers,

Mark