From patchwork Mon May 9 23:02:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Wilson X-Patchwork-Id: 67382 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1829908qge; Mon, 9 May 2016 16:02:32 -0700 (PDT) X-Received: by 10.98.26.130 with SMTP id a124mr54675865pfa.39.1462834952542; Mon, 09 May 2016 16:02:32 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id f77si18773195pfd.122.2016.05.09.16.02.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 May 2016 16:02:32 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-return-92088-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of binutils-return-92088-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=binutils-return-92088-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=K93J1S2qcd3Zo3jaO5jPZ9YRFk5y+ 10QK6g+mgmjJSJeexXCQkGtIwCSxkrwX+7TD1MagyDcUvHJ1d/Gu6PYWCx2mhlJ6 FUDrhN6ClTMu77HbtFkxjXbvBSWOYXbd6qeR5SoL0zicdKyyseAxDKEF5xa8ZnwK CgB2zWEjH5+M5E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=oWtmFLTRfJZf/RnMYxaE9QmGDLQ=; b=e8I Po1PRAbGizmx3SuK88hNR8SJR7AQEIajxXOWnusmIYsVFBiryFZZLmBbcgR4/uJk 69YYvbbNXJQSXrPHhmPaPvf46uV6ps8KxzZyzvJsa36J/HHk5eKSo8d3+GlPsMbx Zt4tn0MzwfB5LSRvn9V5KpCAIrpIfAfQtJ2K6vhs= Received: (qmail 61676 invoked by alias); 9 May 2016 23:02:16 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 61658 invoked by uid 89); 9 May 2016 23:02:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=3666, 366, 6, curiously, Wilson X-HELO: mail-ob0-f174.google.com Received: from mail-ob0-f174.google.com (HELO mail-ob0-f174.google.com) (209.85.214.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 09 May 2016 23:02:03 +0000 Received: by mail-ob0-f174.google.com with SMTP id aq1so85383855obc.3 for ; Mon, 09 May 2016 16:02:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=1pk/MCUpjWH6Ypj8OoFM2wYLKcxt4xpRkOjfJAC55BA=; b=KfI++AcvYtmELXHjKqGVHkd7qEH1b9iWt7tbYNtspOGsYfhqIb9+PESv5LKxvDms/e CiPvDY6lemMH9Es6jSvddF5IL0MGaFlyyxZAZM4TTnIEKA2st8JwQFj/mqUosL/UUFFD L2Vm/ra8HVsUszRMEidkzxqTNZxfK243/G6+GLn0b7gLn+eIvun9FBU6rRujhIIGBmqZ 9A4izSToffD81pDz22RjqTMM4UDkruKWFgnSqFqbZ1i/8BbAcw5OA+pb1COJVjZ/17Co bGoWPvdpTo0jMCayKEkJ9T7SJyHy4/6L+llcuEgGnWUpCwlI2koZh12SpfdFCCGAB56L YhdA== X-Gm-Message-State: AOPr4FU6fe2QtRc+94OtFoE0u7LLHph86vLhi610+sICjgvULGIVHROwlas9kACeKCy7YcttrRz5D433jC/WM3K7 MIME-Version: 1.0 X-Received: by 10.182.78.68 with SMTP id z4mr17275494obw.80.1462834921725; Mon, 09 May 2016 16:02:01 -0700 (PDT) Received: by 10.157.34.201 with HTTP; Mon, 9 May 2016 16:02:01 -0700 (PDT) Date: Mon, 9 May 2016 16:02:01 -0700 Message-ID: Subject: [PATCH, AARCH64] support R_AARCH64_NONE as gas input for 64-bit code From: Jim Wilson To: Binutils The aarch64 assembler accepts the deprecated R_AARCH64_NULL reloc, but not the preferred R_AARCH64_NONE reloc. palantir:2134$ cat tmp.s .text .reloc 0, R_AARCH64_NULL, 0 palantir:2135$ ./as-new tmp.s palantir:2136$ cat tmp2.s .text .reloc 0, R_AARCH64_NONE, 0 palantir:2137$ ./as-new tmp2.s tmp2.s: Assembler messages: tmp2.s:2: Error: unrecognized reloc type palantir:2138$ Curiously, looking at the code, I see that the aarch64 port accepts only R_AARCH64_NULL for 64-bit code and only R_AARCH64_NONE for 32-bit code. I don't know the history of R_AARCH64_NULL, but assuming we still need to support it for backwards compatibilty, then we need to accept both for 64-bit code. We can still only accept R_AARCH64_NONE for 32-bit code. The attached patch does this. This was tested with an aarch64-linux cross build and make check. There were no regressions. Jim 2016-05-09 Jim Wilson bfd/ * elfnn-aarch64.c: Unconditionally enable R_AARCH64_NULL and R_AARCH64_NONE. Use HOWTO64 for R_AARCH64_NULL. * relocs.c: Add BFD_RELOC_AARCH64_NULL. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index f68c1076..7f7c008 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -5716,6 +5716,9 @@ important as several tables in the AArch64 bfd backend are indexed by these enumerators; make sure they are all synced. */ BFD_RELOC_AARCH64_RELOC_START, +/* Deprecated AArch64 null relocation code. */ + BFD_RELOC_AARCH64_NULL, + /* AArch64 null relocation code. */ BFD_RELOC_AARCH64_NONE, diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index eecbf87..4194765 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -339,8 +339,8 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = /* Basic data relocations. */ -#if ARCH_SIZE == 64 - HOWTO (R_AARCH64_NULL, /* type */ + /* Deprecated, but retained for backwards compatibility. */ + HOWTO64 (R_AARCH64_NULL, /* type */ 0, /* rightshift */ 3, /* size (0 = byte, 1 = short, 2 = long) */ 0, /* bitsize */ @@ -353,7 +353,6 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = 0, /* src_mask */ 0, /* dst_mask */ FALSE), /* pcrel_offset */ -#else HOWTO (R_AARCH64_NONE, /* type */ 0, /* rightshift */ 3, /* size (0 = byte, 1 = short, 2 = long) */ @@ -367,7 +366,6 @@ static reloc_howto_type elfNN_aarch64_howto_table[] = 0, /* src_mask */ 0, /* dst_mask */ FALSE), /* pcrel_offset */ -#endif /* .xword: (S+A) */ HOWTO64 (AARCH64_R (ABS64), /* type */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 5fe45ec..33490c0 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -2792,6 +2792,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL", "BFD_RELOC_MICROBLAZE_64_TLSTPREL", "BFD_RELOC_AARCH64_RELOC_START", + "BFD_RELOC_AARCH64_NULL", "BFD_RELOC_AARCH64_NONE", "BFD_RELOC_AARCH64_64", "BFD_RELOC_AARCH64_32", diff --git a/bfd/reloc.c b/bfd/reloc.c index c3b713b..1f21037 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -6776,6 +6776,10 @@ ENUMDOC important as several tables in the AArch64 bfd backend are indexed by these enumerators; make sure they are all synced. ENUM + BFD_RELOC_AARCH64_NULL +ENUMDOC + Deprecated AArch64 null relocation code. +ENUM BFD_RELOC_AARCH64_NONE ENUMDOC AArch64 null relocation code.