PR 21847, Don't default PowerPC64 to --plt-localentry
[deliverable/binutils-gdb.git] / gold / layout.h
index 6da960750473ee5121f05bdcb1165565bc626343..5f58c2c67f69905ae5be98ab302577f44612bef0 100644 (file)
@@ -1,7 +1,6 @@
 // layout.h -- lay out output file sections for gold  -*- C++ -*-
 
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012
-// Free Software Foundation, Inc.
+// Copyright (C) 2006-2017 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -67,6 +66,10 @@ struct Timespec;
 extern bool
 is_compressed_debug_section(const char* secname);
 
+// Return the name of the corresponding uncompressed debug section.
+extern std::string
+corresponding_uncompressed_section_name(std::string secname);
+
 // Maintain a list of free space within a section, segment, or file.
 // Used for incremental update links.
 
@@ -536,7 +539,7 @@ class Layout
   // and ALIGN are the extra flags and alignment of the segment.
   struct Unique_segment_info
   {
-    // Identifier for the segment.  ELF segments dont have names.  This
+    // Identifier for the segment.  ELF segments don't have names.  This
     // is used as the name of the output section mapped to the segment.
     const char* name;
     // Additional segment flags.
@@ -636,6 +639,12 @@ class Layout
                  unsigned int reloc_shndx, unsigned int reloc_type,
                  off_t* offset);
 
+  // After processing all input files, we call this to make sure that
+  // the optimized .eh_frame sections have been added to the output
+  // section.
+  void
+  finalize_eh_frame_section();
+
   // Add .eh_frame information for a PLT.  The FDE must start with a
   // 4-byte PC-relative reference to the start of the PLT, followed by
   // a 4-byte size of PLT.
@@ -755,7 +764,8 @@ class Layout
            || strncmp(name, ".gnu.linkonce.wi.",
                       sizeof(".gnu.linkonce.wi.") - 1) == 0
            || strncmp(name, ".line", sizeof(".line") - 1) == 0
-           || strncmp(name, ".stab", sizeof(".stab") - 1) == 0);
+           || strncmp(name, ".stab", sizeof(".stab") - 1) == 0
+           || strncmp(name, ".pdr", sizeof(".pdr") - 1) == 0);
   }
 
   // Return true if RELOBJ is an input file whose base name matches
@@ -892,9 +902,13 @@ class Layout
                          const Output_data_reloc_generic* dyn_rel,
                          bool add_debug, bool dynrel_includes_plt);
 
+  // Add a target-specific dynamic tag with constant value.
+  void
+  add_target_specific_dynamic_tag(elfcpp::DT tag, unsigned int val);
+
   // Compute and write out the build ID if needed.
   void
-  write_build_id(Output_file*) const;
+  write_build_id(Output_file*, unsigned char*, size_t) const;
 
   // Rewrite output file in binary format.
   void
@@ -969,7 +983,17 @@ class Layout
   // be mapped to an output section that should be KEPT.
   bool
   keep_input_section(const Relobj*, const char*);
-  
+
+  // Add a special output object that will be recreated afresh
+  // if there is another relaxation iteration.
+  void
+  add_relax_output(Output_data* data)
+  { this->relax_output_list_.push_back(data); }
+
+  // Clear out (and free) everything added by add_relax_output.
+  void
+  reset_relax_output();
+
  private:
   Layout(const Layout&);
   Layout& operator=(const Layout&);
@@ -1013,9 +1037,9 @@ class Layout
   void
   create_gold_note();
 
-  // Record whether the stack must be executable.
+  // Record whether the stack must be executable, and a user-supplied size.
   void
-  create_executable_stack_info();
+  create_stack_segment();
 
   // Create a build ID note if needed.
   void
@@ -1043,7 +1067,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*
@@ -1058,6 +1082,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<Symbol*>* pdynamic_symbols,
                        Versions* versions);
 
@@ -1125,7 +1150,7 @@ class Layout
   choose_output_section(const Relobj* relobj, const char* name,
                        elfcpp::Elf_Word type, elfcpp::Elf_Xword flags,
                        bool is_input_section, Output_section_order order,
-                       bool is_relro);
+                       bool is_relro, bool is_reloc, bool match_input_spec);
 
   // Create a new Output_section.
   Output_section*
@@ -1265,7 +1290,8 @@ class Layout
     // Check that sections and special data are in reset states.
     void
     check_output_data_for_reset_values(const Layout::Section_list&,
-                                      const Layout::Data_list&);
+                                      const Layout::Data_list& special_outputs,
+                                      const Layout::Data_list& relax_outputs);
 
     // Record information of a section list.
     void
@@ -1317,6 +1343,9 @@ class Layout
   // The list of unattached Output_data objects which require special
   // handling because they are not Output_sections.
   Data_list special_output_list_;
+  // Like special_output_list_, but cleared and recreated on each
+  // iteration of relaxation.
+  Data_list relax_output_list_;
   // The section headers.
   Output_section_headers* section_headers_;
   // A pointer to the PT_TLS segment if there is one.
@@ -1428,9 +1457,11 @@ class Write_sections_task : public Task
  public:
   Write_sections_task(const Layout* layout, Output_file* of,
                      Task_token* output_sections_blocker,
+                     Task_token* input_sections_blocker,
                      Task_token* final_blocker)
     : layout_(layout), of_(of),
       output_sections_blocker_(output_sections_blocker),
+      input_sections_blocker_(input_sections_blocker),
       final_blocker_(final_blocker)
   { }
 
@@ -1455,6 +1486,7 @@ class Write_sections_task : public Task
   const Layout* layout_;
   Output_file* of_;
   Task_token* output_sections_blocker_;
+  Task_token* input_sections_blocker_;
   Task_token* final_blocker_;
 };
 
@@ -1497,10 +1529,10 @@ class Write_symbols_task : public Task
 {
  public:
   Write_symbols_task(const Layout* layout, const Symbol_table* symtab,
-                    const Input_objects* input_objects,
+                    const Input_objects* /*input_objects*/,
                     const Stringpool* sympool, const Stringpool* dynpool,
                     Output_file* of, Task_token* final_blocker)
-    : layout_(layout), symtab_(symtab), input_objects_(input_objects),
+    : layout_(layout), symtab_(symtab),
       sympool_(sympool), dynpool_(dynpool), of_(of),
       final_blocker_(final_blocker)
   { }
@@ -1523,7 +1555,6 @@ class Write_symbols_task : public Task
  private:
   const Layout* layout_;
   const Symbol_table* symtab_;
-  const Input_objects* input_objects_;
   const Stringpool* sympool_;
   const Stringpool* dynpool_;
   Output_file* of_;
@@ -1568,14 +1599,40 @@ class Write_after_input_sections_task : public Task
   Task_token* final_blocker_;
 };
 
+// This task function handles computation of the build id.
+// When using --build-id=tree, it schedules the tasks that
+// compute the hashes for each chunk of the file. This task
+// cannot run until we have finalized the size of the output
+// file, after the completion of Write_after_input_sections_task.
+
+class Build_id_task_runner : public Task_function_runner
+{
+ public:
+  Build_id_task_runner(const General_options* options, const Layout* layout,
+                      Output_file* of)
+    : options_(options), layout_(layout), of_(of)
+  { }
+
+  // Run the operation.
+  void
+  run(Workqueue*, const Task*);
+
+ private:
+  const General_options* options_;
+  const Layout* layout_;
+  Output_file* of_;
+};
+
 // This task function handles closing the file.
 
 class Close_task_runner : public Task_function_runner
 {
  public:
   Close_task_runner(const General_options* options, const Layout* layout,
-                   Output_file* of)
-    : options_(options), layout_(layout), of_(of)
+                   Output_file* of, unsigned char* array_of_hashes,
+                   size_t size_of_hashes)
+    : options_(options), layout_(layout), of_(of),
+      array_of_hashes_(array_of_hashes), size_of_hashes_(size_of_hashes)
   { }
 
   // Run the operation.
@@ -1586,6 +1643,8 @@ class Close_task_runner : public Task_function_runner
   const General_options* options_;
   const Layout* layout_;
   Output_file* of_;
+  unsigned char* const array_of_hashes_;
+  const size_t size_of_hashes_;
 };
 
 // A small helper function to align an address.
This page took 0.027562 seconds and 4 git commands to generate.