From: Alan Modra <amodra@gmail.com>
To: liuzhensong <liuzhensong@loongson.cn>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] objcopy: Add elf header e_flags option in objcopy.
Date: Fri, 15 Apr 2022 11:33:33 +0930 [thread overview]
Message-ID: <YljSdWJH9kkkKePS@squeak.grove.modra.org> (raw)
In-Reply-To: <20220414112906.2684102-1-liuzhensong@loongson.cn>
On Thu, Apr 14, 2022 at 07:29:06PM +0800, liuzhensong wrote:
> @@ -660,6 +666,7 @@ copy_usage (FILE *stream, int exit_status)
> --weaken-symbols <file> -W for all symbols listed in <file>\n\
> --add-symbol <name>=[<section>:]<value>[,<flags>] Add a symbol\n\
> --alt-machine-code <index> Use the target's <index>'th alternative machine\n\
> + --alt-elf-eflags=<value> Use the alternative elf header e_flags\n\
Don't use tabs in help messages.
> --writable-text Mark the output text as writable\n\
> --readonly-text Make the output text write protected\n\
> --pure Mark the output file as demand paged\n\
> @@ -3496,6 +3503,11 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
> }
> }
>
> + if (alt_elf_eflags_set)
> + {
> + elf_elfheader (obfd)->e_flags = alt_elf_eflags;
> + }
> +
Needs a check bfd_get_flavour (obfd) == bfd_target_elf_flavour before
writing a field only in ELF bfd, and no need for braces.
Also, please update binutils/doc.texi with the new objcopy option.
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2022-04-15 2:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 11:29 liuzhensong
2022-04-15 2:03 ` Alan Modra [this message]
2022-04-15 7:24 ` liuzhensong
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=YljSdWJH9kkkKePS@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=liuzhensong@loongson.cn \
/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).