PATCH: ld/2411: ELF linker fails to create executable with more than 64k sections
H. J. Lu
hjl@lucon.org
Thu Mar 2 23:21:00 GMT 2006
More information about the Binutils mailing list
Thu Mar 2 23:21:00 GMT 2006
- Previous message (by thread): using BFD to load and reloc a simple file
- Next message (by thread): PATCH: ld/2411: ELF linker fails to create executable with more than 64k sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The ELF gABI doesn't support more than 64k sections in DSO and executable when there are dynamic symbols. This patch checks that. H.J. --- 2006-03-02 H.J. Lu <hongjiu.lu@intel.com> PR ld/2411 * elflink.c (map_sections_to_segments): Check if the number of output sections are allowed. (assign_file_positions_for_segments): Updated. --- bfd/elf.c.64k 2006-03-01 06:19:54.000000000 -0800 +++ bfd/elf.c 2006-03-02 15:17:19.000000000 -0800 @@ -3585,7 +3585,7 @@ _bfd_elf_make_dynamic_segment (bfd *abfd /* Set up a mapping from BFD sections to program segments. */ static bfd_boolean -map_sections_to_segments (bfd *abfd) +map_sections_to_segments (bfd *abfd, struct bfd_link_info *info) { asection **sections = NULL; asection *s; @@ -3612,6 +3612,18 @@ map_sections_to_segments (bfd *abfd) if (bfd_count_sections (abfd) == 0) return TRUE; + if (elf_hash_table (info)->dynsymcount != 0 + && bfd_count_sections (abfd) >= SHN_LORESERVE) + { + /* The gABI doesn't support dynamic symbols and more than 64K + output sections at the same time. */ + (*_bfd_error_handler) + (_("%B: Too many sections: %d (< %d)"), + abfd, bfd_count_sections (abfd), SHN_LORESERVE); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } + /* Select the allocated sections, and sort them. */ sections = bfd_malloc2 (bfd_count_sections (abfd), sizeof (asection *)); @@ -4085,7 +4097,7 @@ assign_file_positions_for_segments (bfd if (elf_tdata (abfd)->segment_map == NULL) { - if (! map_sections_to_segments (abfd)) + if (! map_sections_to_segments (abfd, link_info)) return FALSE; } else
- Previous message (by thread): using BFD to load and reloc a simple file
- Next message (by thread): PATCH: ld/2411: ELF linker fails to create executable with more than 64k sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list