public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Christophe Lyon <christophe.lyon@linaro.org>
To: Thomas Preudhomme <thomas.preudhomme@foss.arm.com>
Cc: binutils@sourceware.org
Subject: Re: [RFC PATCH, binutils, ARM 11/11, ping] Add support for stable secure gateway veneers addresses
Date: Tue, 30 Aug 2016 08:56:00 -0000	[thread overview]
Message-ID: <CAKdteOZF3-04fTPhyGsjKH=5UosJn051i6-1Pr7Wdnpm8x1Gvw@mail.gmail.com> (raw)
In-Reply-To: <e5d3d203-b51c-a3b4-0eef-cbe8c2c51ab7@foss.arm.com>

On 30 August 2016 at 10:10, Thomas Preudhomme
<thomas.preudhomme@foss.arm.com> wrote:
> Hi Christophe,
>
>
> On 29/08/16 15:56, Christophe Lyon wrote:
>>
>> On 26 August 2016 at 16:18, Thomas Preudhomme
>> <thomas.preudhomme@foss.arm.com> wrote:
>>>
>>> On 26/08/16 13:36, Thomas Preudhomme wrote:
>>>>
>>>>
>>>> Hi Christophe,
>>>>
>>>> On 26/08/16 12:55, Christophe Lyon wrote:
>>>>>
>>>>>
>>>>>
>>>>> I've noticed that the new tests fail on armeb. I didn't look at the
>>>>> detailed logs yet, but I guess you can a look?
>>>>>
>>>>> ./ld/ld.sum:FAIL: Input secure gateway import library
>>>>> ./ld/ld.sum:FAIL: Input secure gateway import library: no output import
>>>>> library
>>>>> ./ld/ld.sum:FAIL: Input secure gateway import library: earlier stub
>>>>> section base
>>>>> ./ld/ld.sum:FAIL: Input secure gateway import library: later stub
>>>>> section
>>>>> base
>>>>> ./ld/ld.sum:FAIL: Input secure gateway import library: veneer comeback
>>>>> ./ld/ld.sum:FAIL: Input secure gateway import library: entry function
>>>>> change
>>>>
>>>>
>>>>
>>>> I can reproduce indeed. I'll have a look, thanks for the notice. Note
>>>> that
>>>> Monday is a bank holidays here so might only answer after that if I'm
>>>> too
>>>> slow
>>>> to find the root cause.
>>>
>>>
>>>
>>> Doh, the code checks for a SG instruction by comparing the 4 bytes in the
>>> code against its litteral value. The problem of course is that the read
>>> puts
>>> the 4 bytes of the instruction in memory order but these will then be
>>> interpreted according to the endianness.
>>>
>>> The fix should be easy.
>>>
>>
>> Indeed, thanks to your analysis it was quick enough.
>>
>> Here is a patch, maybe there is a simpler way?
>
>
> diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
> index 9ff418a..5c04b9b 100644
> --- a/bfd/elf32-arm.c
> +++ b/bfd/elf32-arm.c
> @@ -5791,11 +5791,19 @@ cmse_entry_fct_p (struct elf32_arm_link_hash_entry
> *hash)
>    section = hash->root.root.u.def.section;
>    abfd = section->owner;
>    offset = hash->root.root.u.def.value - section->vma;
> -  if (!bfd_get_section_contents (abfd, section, &first_insn, offset,
> -                                sizeof (first_insn)))
> -    return FALSE;
>
>    /* Start by SG instruction.  */
> +  bfd_byte * contents;
> +  /* Get cached copy if it exists.  */
> +  if (elf_section_data (section)->this_hdr.contents != NULL)
> +    contents = elf_section_data (section)->this_hdr.contents;
> +  else
> +    {
> +      /* Go get them off disk.  */
> +      if (! bfd_malloc_and_get_section (abfd, section, &contents))
> +       return FALSE;
> +    }
> +  first_insn = bfd_get_32 (abfd, contents + offset);
>    return first_insn == 0xe97fe97f;
>  }
>
> I have a similar patch but I'm still using bfd_get_section_contents with a
> 4byte buffer named contents. It avoids reading the entire section to just
> analyze 4 bytes. I did it on Friday so wanted to test it a bit more today.
>

OK that's fine, it sounds better than mine. I posted mine because
I wasn't sure you were actually working on a fix.

Thanks

Christophe

> Best regards,
>
> Thomas

  reply	other threads:[~2016-08-30  8:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23  8:02 [RFC PATCH, binutils, ARM 9/9] " Thomas Preud'homme
2016-04-04 14:23 ` [RFC PATCH, binutils, ARM 11/11] " Thomas Preudhomme
2016-05-18 16:41   ` [PATCH, " Thomas Preudhomme
2016-07-07 12:52   ` [RFC PATCH, " Richard Earnshaw (lists)
     [not found]     ` <1735561.4TLJhTojVK@e108577-lin>
2016-07-15  8:43       ` Thomas Preudhomme
     [not found]     ` <4163700.8nzTNaTl0I@e108577-lin>
     [not found]       ` <f4e62f04-bebc-135d-372a-d29bdb4efcf0@foss.arm.com>
2016-08-17 15:23         ` [RFC PATCH, binutils, ARM 11/11, ping] " Thomas Preudhomme
2016-08-25 16:14           ` Richard Earnshaw (lists)
2016-08-25 16:35             ` Thomas Preudhomme
2016-08-26  9:21               ` Richard Earnshaw (lists)
     [not found]                 ` <CAKdteOZ4uC=dOKO5WoysePRT1is9rvX4etjgj1iK5Hj23TSdLw@mail.gmail.com>
2016-08-26 12:37                   ` Thomas Preudhomme
2016-08-26 14:18                     ` Thomas Preudhomme
2016-08-29 14:56                       ` Christophe Lyon
2016-08-30  8:10                         ` Thomas Preudhomme
2016-08-30  8:56                           ` Christophe Lyon [this message]
2016-08-30  9:49                             ` Thomas Preudhomme

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKdteOZF3-04fTPhyGsjKH=5UosJn051i6-1Pr7Wdnpm8x1Gvw@mail.gmail.com' \
    --to=christophe.lyon@linaro.org \
    --cc=binutils@sourceware.org \
    --cc=thomas.preudhomme@foss.arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).