[PATCH v2] readelf: Handle 0 sh_entsize of GOT sections for x86
Jan Beulich
jbeulich@suse.com
Thu Sep 4 06:04:59 GMT 2025
On 04.09.2025 03:02, H.J. Lu wrote:
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -21150,6 +21150,30 @@ process_got_section_contents (Filedata * filedata)
> }
>
> uint32_t entsz = section->sh_entsize;
> + /* NB: Some linker sets sh_entsize to 0 on .got and .got.plt
> + sections, for example x86-64 Google chrome browser. */
Didn't you say you would adjust this comment, as per Alan's remark?
> + if (entsz == 0)
> + switch (filedata->file_header.e_machine)
> + {
> + default:
> + if (is_32bit_elf)
> + {
> + /* NB: ELFCLASS32 may use 8 byte GOT sh_entsize,
> + like x32. */
The comment contradicts ...
> + warn (_("Can't determine section '%s' sh_entsize\n"),
> + name);
> + res = false;
> + goto out;
> + }
> + /* Fall through. */
> + case EM_X86_64:
... this case label, as x32 will land here afaict. I'm also unconvinced
of penalizing all non-x86 32-bit architectures, just because of the x32
special case. I'd rather see it done the other way around: Go from
EI_CLASS generally and add a special case for x32. More special casing
can be added as needed.
Jan
More information about the Binutils
mailing list