diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2023-11-16 19:19:14 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2023-11-17 16:38:55 +0800 |
commit | 4f2469d0cdd0f3bd1d9040521e002e8df0a63a98 (patch) | |
tree | dd88ea57179d38d16e7a164e7d6295eaf4ba5840 /ld | |
parent | b130a0849a1b3e174210903cf5370092decc62d6 (diff) | |
download | gdb-4f2469d0cdd0f3bd1d9040521e002e8df0a63a98.zip gdb-4f2469d0cdd0f3bd1d9040521e002e8df0a63a98.tar.gz gdb-4f2469d0cdd0f3bd1d9040521e002e8df0a63a98.tar.bz2 |
LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition
Previously the condition prevented shared objects from being relaxed.
To remove the limitation, we need to update program header size and
.eh_frame_hdr size before relaxation.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/emultempl/loongarchelf.em | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ld/emultempl/loongarchelf.em b/ld/emultempl/loongarchelf.em index 4850feb..d81c99d 100644 --- a/ld/emultempl/loongarchelf.em +++ b/ld/emultempl/loongarchelf.em @@ -62,6 +62,24 @@ gld${EMULATION_NAME}_after_allocation (void) } } + /* The program header size of executable file may increase. */ + if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour + && !bfd_link_relocatable (&link_info)) + { + if (lang_phdr_list == NULL) + elf_seg_map (link_info.output_bfd) = NULL; + if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd, + &link_info, + NULL)) + einfo (_("%F%P: map sections to segments failed: %E\n")); + } + + /* Adjust program header size and .eh_frame_hdr size before + lang_relax_sections. Without it, the vma of data segment may increase. */ + lang_do_assignments (lang_allocating_phase_enum); + lang_reset_memory_regions (); + lang_size_sections (NULL, true); + enum phase_enum *phase = &(expld.dataseg.phase); bfd_elf${ELFSIZE}_loongarch_set_data_segment_info (&link_info, (int *) phase); /* gld${EMULATION_NAME}_map_segments (need_layout); */ |