X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gold%2Flayout.h;h=c4f1f8c35bea1c1ce5b4ee6c71f35b94b7262338;hb=abdb711e0855f0597a96db0486b598144b788212;hp=10be3d474531d3fbf1d37cffacaf7b0ecf9b931a;hpb=412ffd830b94a860e81e8515140ba5ebc5aa82be;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/layout.h b/gold/layout.h index 10be3d4745..c4f1f8c35b 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -1,6 +1,6 @@ // layout.h -- lay out output file sections for gold -*- C++ -*- -// Copyright (C) 2006-2016 Free Software Foundation, Inc. +// Copyright (C) 2006-2019 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -422,9 +422,21 @@ enum Output_section_order // The PLT. ORDER_PLT, + // The hot text sections, prefixed by .text.hot. + ORDER_TEXT_HOT, + // The regular text sections. ORDER_TEXT, + // The startup text sections, prefixed by .text.startup. + ORDER_TEXT_STARTUP, + + // The startup text sections, prefixed by .text.startup. + ORDER_TEXT_EXIT, + + // The unlikely text sections, prefixed by .text.unlikely. + ORDER_TEXT_UNLIKELY, + // The .fini section. ORDER_FINI, @@ -525,7 +537,8 @@ class Layout Output_section* layout(Sized_relobj_file *object, unsigned int shndx, const char* name, const elfcpp::Shdr& shdr, - unsigned int reloc_shndx, unsigned int reloc_type, off_t* offset); + unsigned int sh_type, unsigned int reloc_shndx, + unsigned int reloc_type, off_t* offset); std::map* get_section_order_map() @@ -653,6 +666,13 @@ class Layout size_t cie_length, const unsigned char* fde_data, size_t fde_length); + // Remove .eh_frame information for a PLT. FDEs using the CIE must + // be removed in reverse order to the order they were added. + void + remove_eh_frame_for_plt(Output_data* plt, const unsigned char* cie_data, + size_t cie_length, const unsigned char* fde_data, + size_t fde_length); + // Scan a .debug_info or .debug_types section, and add summary // information to the .gdb_index section. template @@ -673,6 +693,25 @@ class Layout layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags, const Object*); + // Layout a .note.gnu.property section. + void + layout_gnu_property(unsigned int note_type, + unsigned int pr_type, + size_t pr_datasz, + const unsigned char* pr_data, + const Object* object); + + // Merge per-object properties with program properties. + void + merge_gnu_properties(const Object* object); + + // Add a target-specific property for the output .note.gnu.property section. + void + add_gnu_property(unsigned int note_type, + unsigned int pr_type, + size_t pr_datasz, + const unsigned char* pr_data); + // Add an Output_section_data to the layout. This is used for // special sections like the GOT section. ORDER is where the // section should wind up in the output segment. IS_RELRO is true @@ -1008,6 +1047,14 @@ class Layout }; static const Section_name_mapping section_name_mapping[]; static const int section_name_mapping_count; + static const Section_name_mapping text_section_name_mapping[]; + static const int text_section_name_mapping_count; + + // Find section name NAME in map and return the mapped name if found + // with the length set in PLEN. + static const char* match_section_name(const Section_name_mapping* map, + const int count, const char* name, + size_t* plen); // During a relocatable link, a list of group sections and // signatures. @@ -1033,6 +1080,10 @@ class Layout create_note(const char* name, int note_type, const char* section_name, size_t descsz, bool allocate, size_t* trailing_padding); + // Create a note section for gnu program properties. + void + create_gnu_properties_note(); + // Create a note section for gold version. void create_gold_note(); @@ -1067,7 +1118,7 @@ class Layout // Create the output sections for the symbol table. void create_symtab_sections(const Input_objects*, Symbol_table*, - unsigned int, off_t*); + unsigned int, off_t*, unsigned int); // Create the .shstrtab section. Output_section* @@ -1082,6 +1133,7 @@ class Layout create_dynamic_symtab(const Input_objects*, Symbol_table*, Output_section** pdynstr, unsigned int* plocal_dynamic_count, + unsigned int* pforced_local_dynamic_count, std::vector* pdynamic_symbols, Versions* versions); @@ -1318,6 +1370,14 @@ class Layout std::vector section_infos_; }; + // Program properties from .note.gnu.property sections. + struct Gnu_property + { + size_t pr_datasz; + unsigned char* pr_data; + }; + typedef std::map Gnu_properties; + // The number of input files, for sizing tables. int number_of_input_files_; // Information set by scripts or by command line options. @@ -1444,6 +1504,8 @@ class Layout Incremental_binary* incremental_base_; // For incremental links, a list of free space within the file. Free_list free_list_; + // Program properties. + Gnu_properties gnu_properties_; }; // This task handles writing out data in output sections which is not