[PATCH] x86: Add x86_is_elf to optimize out the ELF check

H.J. Lu hjl.tools@gmail.com
Tue Sep 24 09:10:04 GMT 2024


 On Tue, Sep 24, 2024 at 4:19 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 24.09.2024 00:56, H.J. Lu wrote:
> > Add x86_is_elf and replace IS_ELF with x86_is_elf () so that compiler
> > can optimize out the ELF check when OBJ_ELF is defined and OBJ_MAYBE_ELF
> > isn't defined.
> >
> > * config/tc-i386.c (x86_is_elf): New function.
> > (check_cpu_arch_compatible): Replace IS_ELF with x86_is_elf ().
> > (i386_arch): Likewise.
> > (i386_mach): Likewise.
> > (tc_i386_fix_adjustable): Likewise.
> > (i386_assemble): Likewise.
> > (need_plt32_p): Likewise.
> > (x86_cleanup): Likewise.
> > (output_insn): Likewise.
> > (lex_got): Likewise.
> > (s_insn): Likewise.
> > (md_estimate_size_before_relax): Likewise.
> > (md_apply_fix): Likewise.
> > (md_parse_option): Likewise.
> > (i386_target_format): Likewise.
> > (i386_validate_fix): Likewise.
> > (tc_gen_reloc): Likewise.
> >
>
> Sadly there's no actual patch, so I can only guess what it does. I think
> we don't need this anymore, with the plan to do away with OBJ_MAYBE_ELF

OBJ_MAYBE_ELF is used by the configure option like,

--enable-targets=x86_64-mingw64

I don't think we should remove it unless there is a very good reason.

> for x86 anyway. All places you touch now would then need touching again.
> And I expect to get to this within the next few weeks.
>
> Jan

Oops.  Here is the patch.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Add-x86_is_elf-to-optimize-out-the-ELF-check.patch
Type: text/x-patch
Size: 7415 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240924/3f68ff47/attachment.bin>


More information about the Binutils mailing list