From patchwork Tue Aug 28 23:04:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 29099 Received: (qmail 21011 invoked by alias); 28 Aug 2018 23:04:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20990 invoked by uid 89); 28 Aug 2018 23:04:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.210.194, H*RU:209.85.210.194, HX-HELO:sk:mail-pf, H*r:sk:mail-pf X-HELO: mail-pf1-f194.google.com Received: from mail-pf1-f194.google.com (HELO mail-pf1-f194.google.com) (209.85.210.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Aug 2018 23:04:50 +0000 Received: by mail-pf1-f194.google.com with SMTP id k21-v6so1329978pff.11 for ; Tue, 28 Aug 2018 16:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id; bh=g1khLVXURMJRaiQO5oM/27rZu0DJBlz8WBG9+q3ycao=; b=JK7kf5wlf4v1LMOrIwqyFJLqfXBGL6WAp8igRbc0kw55mmLqrmJ4DUW21GzopRaFfN kbf1oDEhnC4A0Mrdi7hkV4Xgc6RBMa7fsCENWeqs6aBGPR1u4I4lwQvbwc0PvH0A4DY0 rJDpJpQxe2jgW+pVZfWoN+h7lmQ9xeWp0Ihfm38dqtcqsNlxzLAfo0DD93Zb503n13H6 26mGQGOK/BFa+U1UN5pZTSbM+nc6fyXQaEFtrTSHG/9E8N5bIbSRbZUlqyoLdq3XoZWB eg+K6kHOiY0/FCnqa2ebaZyAOuBp1EhaXu7Vs4ky/nb4d2bNg8jcgkI/XNEFzrGosvFm GBhA== Return-Path: Received: from rohan.internal.sifive.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id l3-v6sm3305630pff.8.2018.08.28.16.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 16:04:47 -0700 (PDT) From: Jim Wilson To: gdb-patches@sourceware.org Cc: Jim Wilson Subject: [PATCH] Fix riscv-linux native gdb build failure. Date: Tue, 28 Aug 2018 16:04:40 -0700 Message-Id: <20180828230440.485-1-jimw@sifive.com> The linux kernel uses NT_PRFPREG. Glibc before BZ 14890 defines NT_FPREGSET. After it defines both. Avoid glibc version dependency by using the gdb header file instead of the glibc header file, and the macro name that gdb defines which is NT_FPREGSET. Tested with riscv-linux make and make check with no regressions. OK to commit? Jim gdb/ * riscv-linux-nat.c: Include elf/common.h instead of elf.h. (riscv_linux_nat_target::fetch_registers): Use NT_FPREGSET instead of NT_PRFPREG. (riscv_linux_nat_target::store_registers): Likewise. --- gdb/riscv-linux-nat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/riscv-linux-nat.c b/gdb/riscv-linux-nat.c index 3faa9f9c1f..7dbfe651f2 100644 --- a/gdb/riscv-linux-nat.c +++ b/gdb/riscv-linux-nat.c @@ -20,9 +20,10 @@ #include "regcache.h" #include "gregset.h" #include "linux-nat.h" -#include "elf.h" #include "riscv-tdep.h" +#include "elf/common.h" + #include /* RISC-V Linux native additions to the default linux support. */ @@ -191,7 +192,7 @@ riscv_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum) iov.iov_base = ®s; iov.iov_len = sizeof (regs); - if (ptrace (PTRACE_GETREGSET, tid, NT_PRFPREG, + if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (PTRACE_TYPE_ARG3) &iov) == -1) perror_with_name (_("Couldn't get registers")); else @@ -252,14 +253,14 @@ riscv_linux_nat_target::store_registers (struct regcache *regcache, int regnum) iov.iov_base = ®s; iov.iov_len = sizeof (regs); - if (ptrace (PTRACE_GETREGSET, tid, NT_PRFPREG, + if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (PTRACE_TYPE_ARG3) &iov) == -1) perror_with_name (_("Couldn't get registers")); else { fill_fpregset (regcache, ®s, regnum); - if (ptrace (PTRACE_SETREGSET, tid, NT_PRFPREG, + if (ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET, (PTRACE_TYPE_ARG3) &iov) == -1) perror_with_name (_("Couldn't set registers")); }