[PATCH] objcopy: Add elf header e_flags option in objcopy.

liuzhensong liuzhensong@loongson.cn
Fri Apr 15 07:24:12 GMT 2022


On 2022/4/15 上午10:03, Alan Modra wrote:
> 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.
>

I will send a v2 with the requested changes.
Thanks for the review.

--
liuzhensong



More information about the Binutils mailing list