public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>
To: Nick Clifton <nickc@redhat.com>, Jeff Law <jeffreyalaw@gmail.com>,
	binutils@sourceware.org
Subject: Re: RFC: readelf: Explain why LLVM bitcode files cannot be read
Date: Tue, 23 Aug 2022 16:26:33 +0100	[thread overview]
Message-ID: <85771955-10ad-9c4d-cc29-2da39ceef5a2@foss.arm.com> (raw)
In-Reply-To: <182cb64a-b37f-4157-2fa2-bd725d5cff26@redhat.com>



On 22/08/2022 11:18, Nick Clifton via Binutils wrote:
> Hi Jeff,
> 
>> I think the same issue arises with golang -- its .o files are not ELF, 
>> but can be read by the golang variants of objdump, nm, etc. So you 
>> might want to look at doing something similar for golang as well.
> 
> A great idea.  I have recoded the patch to create a new function
> which checks the magic number, and if it is not ELF then it tests
> for LLVM bitcode files and golang object files.  This time I have
> put the magic numbers into a static array, so it should be easy to
> add more sequences should we wish to do so.
> 
> Cheers
>    Nick
> 
> 

This fails to build on ubuntu (which defaults to -Werror=format-security):

/home/rearnsha/gnusrc/gcc-cross/master/binutils/readelf.c: In function 
‘check_magic_number’:
/home/rearnsha/gnusrc/gcc-cross/master/binutils/readelf.c:5738:6: error: 
format not a string literal and no format arguments 
[-Werror=format-security]
  5738 |      error (known_magic[i].ar_message);
       |      ^~~~~
/home/rearnsha/gnusrc/gcc-cross/master/binutils/readelf.c:5740:6: error: 
format not a string literal and no format arguments 
[-Werror=format-security]
  5740 |      error (known_magic[i].obj_message);
       |      ^~~~~

You need to pass the output of those strings as a parameter to "%s".

  reply	other threads:[~2022-08-23 15:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 14:20 Nick Clifton
2022-08-19 16:06 ` Jeff Law
2022-08-22 10:18   ` Nick Clifton
2022-08-23 15:26     ` Richard Earnshaw [this message]
2022-08-23 15:30       ` Nick Clifton
2022-08-23 20:35         ` Luis Machado
2022-08-24  9:24           ` Nick Clifton
2022-08-24 10:18             ` Luis Machado

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=85771955-10ad-9c4d-cc29-2da39ceef5a2@foss.arm.com \
    --to=richard.earnshaw@foss.arm.com \
    --cc=binutils@sourceware.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=nickc@redhat.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).