From patchwork Fri Apr 26 15:12:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 16441 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 137F72397A for ; Fri, 26 Apr 2013 15:13:31 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id e49sf2197752eek.9 for ; Fri, 26 Apr 2013 08:12:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=dtRYcrgTDVtUNAYY3wgTrpZHoDsVZDf84anaeN6oGtg=; b=g+iP7CcB/VM10goXiGgxI/SF10GsDRHaWolJVl/KLU4E5R1l94C3LVItGfrQ5DulJl TtuWvWTdOje4L8hcGCJnqq4O/PwVdRXh3vz4Y0hTZNMjIqpn0qZBrx8EyGqKDRX8wh+g /6c7oC5Y5B9lBmqnu70XFzRahnxLvd66CZgIXyAxWW6b9pxQWTG6yIdyLObTnXNR29i8 uqIbnCAO8iTHvIx6y8MoRCqNXRyefxjwh0SGM3uaD2e6r9HBDrX01ww0UJXcnm3XH/nt /sQrH+WNQ/xgKxs0hrJvh719umcbfEvb15OBGNyx41dLa1dJayn/IQum7H9gMF7YmAtK HZWw== X-Received: by 10.180.106.161 with SMTP id gv1mr1777604wib.4.1366989155297; Fri, 26 Apr 2013 08:12:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.74.52 with SMTP id q20ls183345wiv.53.canary; Fri, 26 Apr 2013 08:12:35 -0700 (PDT) X-Received: by 10.180.79.69 with SMTP id h5mr4677216wix.14.1366989155149; Fri, 26 Apr 2013 08:12:35 -0700 (PDT) Received: from mail-ve0-x22a.google.com (mail-ve0-x22a.google.com [2607:f8b0:400c:c01::22a]) by mx.google.com with ESMTPS id 9si3983643wjo.220.2013.04.26.08.12.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 08:12:35 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22a; Received: by mail-ve0-f170.google.com with SMTP id 15so1940177vea.29 for ; Fri, 26 Apr 2013 08:12:34 -0700 (PDT) X-Received: by 10.221.0.199 with SMTP id nn7mr29440696vcb.14.1366989154041; Fri, 26 Apr 2013 08:12:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp73416veb; Fri, 26 Apr 2013 08:12:33 -0700 (PDT) X-Received: by 10.180.94.196 with SMTP id de4mr4664792wib.23.1366989152958; Fri, 26 Apr 2013 08:12:32 -0700 (PDT) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [2a00:1450:400c:c00::233]) by mx.google.com with ESMTPS id gi18si870719wic.92.2013.04.26.08.12.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 08:12:32 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::233 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=2a00:1450:400c:c00::233; Received: by mail-wg0-f51.google.com with SMTP id b12so2178117wgh.6 for ; Fri, 26 Apr 2013 08:12:32 -0700 (PDT) X-Received: by 10.180.93.134 with SMTP id cu6mr4706839wib.8.1366989152471; Fri, 26 Apr 2013 08:12:32 -0700 (PDT) Received: from localhost.localdomain (cpc11-seac20-2-0-cust84.7-2.cable.virginmedia.com. [81.108.156.85]) by mx.google.com with ESMTPSA id k5sm4492753wiy.5.2013.04.26.08.12.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 26 Apr 2013 08:12:31 -0700 (PDT) Message-ID: <517A995C.8090002@linaro.org> Date: Fri, 26 Apr 2013 16:12:28 +0100 From: Will Newton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: binutils@sourceware.org CC: patches@linaro.org Subject: [PATCH, AArch64] Improve relocation error check in elf64_aarch64_check_relocs. X-Gm-Message-State: ALoCoQmlFAKQCAizOnnvI285TJJG9wjiigyhYRfakNURfMlkIBBZmQCmWaJzUuMyrsehZw9BU/hP X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There doesn't seem to be a good reason why this check should only be applied to local symbols. Move the check up and add an error message similar to the x86_64 port. Take advantage of the fact that elf64_aarch64_howto_from_type does error checking for us - if it returns NULL then the relocation was not recognized. bfd/ChangeLog: 2013-04-26 Will Newton * elf64-aarch64.c (elf64_aarch64_check_relocs): Move relocation error check up and add error message. --- bfd/elf64-aarch64.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c index 9a6d8b4..e3cae95 100644 --- a/bfd/elf64-aarch64.c +++ b/bfd/elf64-aarch64.c @@ -4306,6 +4306,14 @@ elf64_aarch64_relocate_section (bfd *output_bfd, bfd_reloc.howto = elf64_aarch64_howto_from_type (r_type); howto = bfd_reloc.howto; + if (howto == NULL) + { + (*_bfd_error_handler) + (_("%B: unrecognized relocation (0x%x) in section `%A'"), + input_bfd, input_section, r_type); + return FALSE; + } + h = NULL; sym = NULL; sec = NULL; @@ -4330,12 +4338,6 @@ elf64_aarch64_relocate_section (bfd *output_bfd, return FALSE; } - if (r_type >= R_AARCH64_dyn_max) - { - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); } else