From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100653 invoked by alias); 9 May 2017 15:47:04 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 100479 invoked by uid 89); 9 May 2017 15:47:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=nickc, guessing, Hx-languages-length:2562, Tel X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-it0-f47.google.com Received: from mail-it0-f47.google.com (HELO mail-it0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 May 2017 15:47:01 +0000 Received: by mail-it0-f47.google.com with SMTP id e65so4104796ita.1; Tue, 09 May 2017 08:47:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=frKfhg8tYb+RUN8OnPr9WwYlLiU30ifqTtZBvRSxmrU=; b=XKwszY6tkbFP23CNZI8qrNybjB4Ad7Tj/XGN7qWNiazonMzRhEuAPGmrPV47lGRMzT 3Rco1elAAinK8n4TYGbiX/ZggOUBt4MBEgA7soSuj7cWJ1tGbOnc57LC26AQLnOt4Gh5 Y0y54fA/d5u8gE1iRirRj6TUp65Po2YOcoSGTfyZSJyaf3xblSq3LoBWCwHV94vSmRJ8 WLJd9J6KM9Xskcaue/cioXg0/4emiCRhXTqCQZZLpjlUHUMx+g4jetx0dCTOUD8GPkSi rYZZtk7Lkbcmo5a27FoS2HWnS6i5mDueYUogssL9FuYYtKF3GC2hshT4bijfqPAoAqXw f5lQ== X-Gm-Message-State: AODbwcDM0R/E4d7NphyLkjM/BiBAomHPQvyr6NiBCDyJ980RRHgWxm+i ofGbooQ8wDZm1mdA5x58hYNWMCna4XkyPTg= X-Received: by 10.36.218.195 with SMTP id z186mr1832353itg.118.1494344822412; Tue, 09 May 2017 08:47:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.181.17 with HTTP; Tue, 9 May 2017 08:47:01 -0700 (PDT) In-Reply-To: References: From: Andrew Goedhart Date: Tue, 09 May 2017 15:47:00 -0000 Message-ID: Subject: Re: [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault. To: nickc at redhat dot com Cc: binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2017-05/txt/msg00107.txt.bz2 Hi Nick Thanks for the merge. I can't generate a test case because using gas, the ADR instruction insists that the label be in the same section and file. So no relocation is generated because the only code the assembler generates is PC relative and therefore does not require relocation. I am guessing this is why the problem was hidden for so long. Unfortunately we may potentially have another problem. When trying to generate a test case I came across the following. The test case below generates incorrect code for the ADR instruction in conjunction with a thumb_func target.. ------------------------ .syntax unified .thumb .text .align 2 .global __testFnPtr .type __testFnPtr, %function .thumb_func __testFnPtr: bx lr .global __testArmThmAluPre .type __testArmThmAluPre, %function .thumb_func __testArmThmAluPre: Push {LR} ADR R0,__testFnPtr BLX R0 Pop {PC} ------------------------- this results in the following disassembly __testFnPtr: 000098e8: 0x00007047 bx lr __testArmThmAluPre: 000098ea: 0x000000b5 push {lr} 000098ec: 0xaff20800 subw r0, pc, #8 000098f0: 0x00008047 blx r0 000098f2: 0x000000bd pop {pc} The problem is that the thumb bit is not set ( subw r0, pc, #8 results in an even address) and that this code causes a hard fault. Now I don't know my assembly as well as I should so there might be wrong/missing directives in the above file. Comment welcome regards Andrew Goedhart On Tue, May 9, 2017 at 1:21 PM, nickc at redhat dot com wrote: > https://sourceware.org/bugzilla/show_bug.cgi?id=21458 > > Nick Clifton changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|UNCONFIRMED |RESOLVED > CC| |nickc at redhat dot com > Resolution|--- |FIXED > > --- Comment #5 from Nick Clifton --- > Hi Andrew, > > I am very sorry for dropping the ball on this PR and not reviewing it until > now. > > I have gone ahead and checked in your patch. One thing extra that I would > like to do is to add a new testcase to the linker testsuite, to make sure that > this problem stays fixed. Do you have some (small) assembler sources that can > be used to trigger this bug ? > > Cheers > Nick > > -- > You are receiving this mail because: > You are on the CC list for the bug. > You reported the bug. -- Andrew Goedhart Tel: +27 84 924 5225 Simple Power Solutions, 14 Heron Way, Pinelands, 7405