[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/21458] ld generates none ARM elf ABI compliant code that causes
From: |
Andrewgoedhart at gmail dot com |
Subject: |
[Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault. |
Date: |
Tue, 09 May 2017 15:47:35 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=21458
--- Comment #6 from Andrew Goedhart <Andrewgoedhart at gmail dot com> ---
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
<address@hidden> wrote:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21458
>
> Nick Clifton <nickc at redhat dot com> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|UNCONFIRMED |RESOLVED
> CC| |nickc at redhat dot com
> Resolution|--- |FIXED
>
> --- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
> 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.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/21458] New: ld generates none ARM elf ABI compliant code that causes a hard fault., Andrewgoedhart at gmail dot com, 2017/05/03
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., Andrewgoedhart at gmail dot com, 2017/05/03
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., Andrewgoedhart at gmail dot com, 2017/05/03
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., Andrewgoedhart at gmail dot com, 2017/05/04
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., Andrewgoedhart at gmail dot com, 2017/05/07
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., cvs-commit at gcc dot gnu.org, 2017/05/09
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., nickc at redhat dot com, 2017/05/09
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault.,
Andrewgoedhart at gmail dot com <=
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., nickc at redhat dot com, 2017/05/10
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., Andrewgoedhart at gmail dot com, 2017/05/10
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., cvs-commit at gcc dot gnu.org, 2017/05/15
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., nickc at redhat dot com, 2017/05/15
- [Bug ld/21458] ld generates none ARM elf ABI compliant code that causes a hard fault., Andrew.goedhart at simplepowersolutions dot co.za, 2017/05/15