From c212f39d9a82c6c09f4a1447d9d2ff09843827c5 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 16 Feb 2022 17:41:23 +0000 Subject: ld: Support customized output section type bfd/ PR ld/28841 * bfd-in2.h (struct bfd_section): Add type. (discarded_section): Add field. * elf.c (elf_fake_sections): Handle bfd_section::type. * section.c (BFD_FAKE_SECTION): Add field. * mri.c (mri_draw_tree): Update function call. ld/ PR ld/28841 * ld.texi: Document new output section type. * ldlex.l: Add new token TYPE. * ldgram.y: Handle TYPE=exp. * ldlang.h: Add type_section to list of section types. * ldlang.c (lang_add_section): Handle type_section. (map_input_to_output_sections): Handle type_section. * testsuite/ld-scripts/output-section-types.t: Add tests. * testsuite/ld-scripts/output-section-types.d: Update. --- ld/ldlang.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ld/ldlang.h') diff --git a/ld/ldlang.h b/ld/ldlang.h index 0d057c9..95f6e46 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -122,7 +122,9 @@ enum section_type overlay_section, noload_section, noalloc_section, - readonly_section + type_section, + readonly_section, + typed_readonly_section }; /* This structure holds a list of program headers describing @@ -166,6 +168,7 @@ typedef struct lang_output_section_statement_struct int constraint; flagword flags; enum section_type sectype; + etree_type *sectype_value; unsigned int processed_vma : 1; unsigned int processed_lma : 1; unsigned int all_input_readonly : 1; @@ -545,7 +548,7 @@ extern void lang_add_output (const char *, int from_script); extern lang_output_section_statement_type *lang_enter_output_section_statement (const char *, etree_type *, enum section_type, etree_type *, etree_type *, - etree_type *, int, int); + etree_type *, etree_type *, int, int); extern void lang_final (void); extern void lang_relax_sections -- cgit v1.1