[PATCH] x86-64: Allocate input section memory if needed
Alan Modra
amodra@gmail.com
Wed Dec 28 22:06:58 GMT 2022
More information about the Binutils mailing list
Wed Dec 28 22:06:58 GMT 2022
- Previous message (by thread): [PATCH] x86-64: Allocate input section memory if needed
- Next message (by thread): [PATCH] x86-64: Allocate input section memory if needed
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Dec 28, 2022 at 09:23:21AM -0800, H.J. Lu wrote: > On Tue, Dec 27, 2022 at 5:16 PM Alan Modra <amodra@gmail.com> wrote: > > > > On Tue, Dec 27, 2022 at 11:47:56AM -0800, H.J. Lu via Binutils wrote: > > > + /* Cache the section contents for > > > + elf_link_input_bfd. */ > > > + elf_section_data (sec)->this_hdr.contents > > > + = contents; > > > > You shouldn't really be caching unaltered section contents when > > !info->keep_memory. I'm not saying the patch is wrong, but please fix > > this when you have some time. > > > > -- > > Alan Modra > > Australia Development Lab, IBM > > elf_x86_64_scan_relocs has > > if (elf_section_data (sec)->this_hdr.contents != contents) > { > if (!converted && !_bfd_link_keep_memory (info)) > free (contents); > else > { > /* Cache the section contents for elf_link_input_bfd if any > load is converted or --no-keep-memory isn't used. */ > elf_section_data (sec)->this_hdr.contents = contents; > info->cache_size += sec->size; > } > } > > Are you suggesting that it should be No, the code above is correct and how it should be in elf_x86_size_or_finish_relative_reloc. Of course it is a little more complicated there due to handling multiple sections. > > if (elf_section_data (sec)->this_hdr.contents != contents) > { > if (!converted) > free (contents); > else > { > /* Cache the section contents for elf_link_input_bfd if any > load is converted. */ > elf_section_data (sec)->this_hdr.contents = contents; > info->cache_size += sec->size; > } > } This would be wrong as it ignores info->keep_memory. -- Alan Modra Australia Development Lab, IBM
- Previous message (by thread): [PATCH] x86-64: Allocate input section memory if needed
- Next message (by thread): [PATCH] x86-64: Allocate input section memory if needed
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list