[PATCH v4] PR30592 objcopy: allow --set-section-flags to add or remove SHF_X86_64_LARGE
Jan Beulich
jbeulich@suse.com
Mon Jul 10 06:37:26 GMT 2023
On 08.07.2023 07:30, Fangrui Song via Binutils wrote:
> --- a/bfd/section.c
> +++ b/bfd/section.c
> @@ -359,6 +359,9 @@ CODE_FRAGMENT
> . TMS320C54X only. *}
> .#define SEC_TIC54X_BLOCK 0x10000000
> .
> +. {* This section has the SHF_X86_64_LARGE flag. This is ELF x86-64 only. *}
> +.#define SEC_ELF_LARGE 0x10000000
> +.
> . {* Conditionally link this section; do not link if there are no
> . references found to any symbol in the section. This is for TI
> . TMS320C54X only. *}
> @@ -2618,7 +2621,7 @@ merge_gnu_build_notes (bfd * abfd,
> }
>
> static flagword
> -check_new_section_flags (flagword flags, bfd * abfd, const char * secname)
> +check_new_section_flags (flagword flags, bfd *abfd, const char * secname)
Nit: Stray (and inconsistent) change?
> @@ -2631,6 +2634,19 @@ check_new_section_flags (flagword flags, bfd * abfd, const char * secname)
> bfd_get_filename (abfd), secname);
> flags &= ~ SEC_COFF_SHARED;
> }
> +
> + /* Report a fatal error if 'large' is used with a non-x86-64 ELF target.
> + Suppress the error for non-ELF targets to allow -O binary and formats that
> + use the bit value SEC_ELF_LARGE for other purposes. */
> + if ((flags & SEC_ELF_LARGE) != 0
> + && bfd_get_flavour (abfd) == bfd_target_elf_flavour
> + && get_elf_backend_data (abfd)->elf_machine_code != EM_X86_64)
DYM
if ((flags & SEC_ELF_LARGE) != 0
&& (bfd_get_flavour (abfd) != bfd_target_elf_flavour
|| get_elf_backend_data (abfd)->elf_machine_code != EM_X86_64))
?
Jan
> + {
> + fatal (_ ("%s[%s]: 'large' flag is ELF x86-64 specific"),
> + bfd_get_filename (abfd), secname);
> + flags &= ~SEC_ELF_LARGE;
> + }
> +
> return flags;
> }
>
More information about the Binutils
mailing list