diff options
author | Jojo R <rjiejie@linux.alibaba.com> | 2022-07-14 00:28:09 +0800 |
---|---|---|
committer | Jojo R <rjiejie@linux.alibaba.com> | 2022-11-04 10:30:18 +0800 |
commit | 853ba67882805f415c9816ca13d738295cf54f48 (patch) | |
tree | a6b9c55e2d4d7a40c4c904e395a84d3d4cbef98b /bfd | |
parent | a494349e806417d4dc7d217500225e515a777811 (diff) | |
download | gdb-853ba67882805f415c9816ca13d738295cf54f48.zip gdb-853ba67882805f415c9816ca13d738295cf54f48.tar.gz gdb-853ba67882805f415c9816ca13d738295cf54f48.tar.bz2 |
Support multiple .eh_frame sections
This patch is based on MULTIPLE_FRAME_SECTIONS and EH_FRAME_LINKONCE,
it allows backend to enable this feature and use '--gc-sections' simply.
* gas/dw2gencfi.h (TARGET_MULTIPLE_EH_FRAME_SECTIONS): New.
(MULTIPLE_FRAME_SECTIONS): Add TARGET_MULTIPLE_EH_FRAME_SECTIONS.
* gas/dw2gencfi.c (EH_FRAME_LINKONCE): Add TARGET_MULTIPLE_EH_FRAME_SECTIONS.
(is_now_linkonce_segment): Likewise.
(get_cfi_seg): Create relocation info between .eh_frame.* and .text.* section.
* bfd/elf-bfd.h (elf_backend_can_make_multiple_eh_frame): New.
* bfd/elfxx-target.h (elf_backend_can_make_multiple_eh_frame): Likewise.
* bfd/elflink.c (_bfd_elf_default_action_discarded): Add checking for
elf_backend_can_make_multiple_eh_frame.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf-bfd.h | 3 | ||||
-rw-r--r-- | bfd/elflink.c | 7 | ||||
-rw-r--r-- | bfd/elfxx-target.h | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index f00f87b..fa4b9bc 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1432,6 +1432,9 @@ struct elf_backend_data bool (*elf_backend_can_make_lsda_relative_eh_frame) (bfd *, struct bfd_link_info *, asection *); + /* Tell linker to support multiple eh_frame sections. */ + bool elf_backend_can_make_multiple_eh_frame; + /* This function returns an encoding after computing the encoded value (and storing it in ENCODED) for the given OFFSET into OSEC, to be stored in at LOC_OFFSET into the LOC_SEC input section. diff --git a/bfd/elflink.c b/bfd/elflink.c index 89dcf26..019ac30 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -10924,12 +10924,19 @@ elf_section_ignore_discarded_relocs (asection *sec) unsigned int _bfd_elf_default_action_discarded (asection *sec) { + const struct elf_backend_data *bed; + bed = get_elf_backend_data (sec->owner); + if (sec->flags & SEC_DEBUGGING) return PRETEND; if (strcmp (".eh_frame", sec->name) == 0) return 0; + if (bed->elf_backend_can_make_multiple_eh_frame + && strncmp (sec->name, ".eh_frame.", 10) == 0) + return 0; + if (strcmp (".gcc_except_table", sec->name) == 0) return 0; diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index ca600bb..f39244e 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -658,6 +658,9 @@ #ifndef elf_backend_can_make_lsda_relative_eh_frame #define elf_backend_can_make_lsda_relative_eh_frame _bfd_elf_can_make_relative #endif +#ifndef elf_backend_can_make_multiple_eh_frame +#define elf_backend_can_make_multiple_eh_frame 0 +#endif #ifndef elf_backend_encode_eh_address #define elf_backend_encode_eh_address _bfd_elf_encode_eh_address #endif @@ -891,6 +894,7 @@ static const struct elf_backend_data elfNN_bed = elf_backend_eh_frame_address_size, elf_backend_can_make_relative_eh_frame, elf_backend_can_make_lsda_relative_eh_frame, + elf_backend_can_make_multiple_eh_frame, elf_backend_encode_eh_address, elf_backend_write_section, elf_backend_elfsym_local_is_section, |