Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / elfxx-x86.h
index b81e1455398357809363f8b32d7f7259819cbc27..a2f5fc235a9de7ea5463ce13ea79fcdab3a008ad 100644 (file)
 #define SYMBOL_REFERENCES_LOCAL_P(INFO, H) \
   _bfd_x86_elf_link_symbol_references_local ((INFO), (H))
 
-/* Is a undefined weak symbol which is resolved to 0.  Reference to an
-   undefined weak symbol is resolved to 0 when building executable if
-   it isn't dynamic and
-   1. Has non-GOT/non-PLT relocations in text section.  Or
-   2. Has no GOT/PLT relocation.
-   Local undefined weak symbol is always resolved to 0.
- */
+/* TRUE if an undefined weak symbol should be resolved to 0.  Local
+   undefined weak symbol is always resolved to 0.  Reference to an
+   undefined weak symbol is resolved to 0 in executable if undefined
+   weak symbol should be resolved to 0 (zero_undefweak > 0).  */
 #define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, EH) \
   ((EH)->elf.root.type == bfd_link_hash_undefweak               \
    && (SYMBOL_REFERENCES_LOCAL_P ((INFO), &(EH)->elf)           \
        || (bfd_link_executable (INFO)                           \
-          && (!(EH)->has_got_reloc                              \
-              || (EH)->has_non_got_reloc))))
+          && (EH)->zero_undefweak > 0)))
 
 /* Should copy relocation be generated for a symbol.  Don't generate
    copy relocation against a protected symbol defined in a shared
 
 /* Verify that the symbol has an entry in the procedure linkage table.  */
 #define VERIFY_PLT_ENTRY(INFO, H, PLT, GOTPLT, RELPLT, LOCAL_UNDEFWEAK) \
-  if (((H)->dynindx == -1 \
-       && !LOCAL_UNDEFWEAK \
-       && !(((H)->forced_local || bfd_link_executable (INFO)) \
-           && (H)->def_regular \
-           && (H)->type == STT_GNU_IFUNC)) \
-      || (PLT) == NULL \
-      || (GOTPLT) == NULL \
-      || (RELPLT) == NULL) \
-    abort ();
+  do \
+    { \
+      if (((H)->dynindx == -1 \
+          && !LOCAL_UNDEFWEAK \
+          && !(((H)->forced_local || bfd_link_executable (INFO)) \
+               && (H)->def_regular \
+               && (H)->type == STT_GNU_IFUNC)) \
+         || (PLT) == NULL \
+         || (GOTPLT) == NULL \
+         || (RELPLT) == NULL) \
+       abort (); \
+    } \
+  while (0);
+
+/* Verify that the symbol supports copy relocation.  */
+#define VERIFY_COPY_RELOC(H, HTAB) \
+  do \
+    { \
+      if ((H)->dynindx == -1 \
+         || ((H)->root.type != bfd_link_hash_defined \
+             && (H)->root.type != bfd_link_hash_defweak) \
+         || (HTAB)->elf.srelbss == NULL \
+         || (HTAB)->elf.sreldynrelro == NULL) \
+       abort (); \
+    } \
+  while (0);
 
 /* x86 ELF linker hash entry.  */
 
@@ -219,11 +232,11 @@ struct elf_x86_link_hash_entry
 
   unsigned char tls_type;
 
-  /* TRUE if symbol has GOT or PLT relocations.  */
-  unsigned int has_got_reloc : 1;
-
-  /* TRUE if symbol has non-GOT/non-PLT relocations in text sections.  */
-  unsigned int has_non_got_reloc : 1;
+  /* Bit 0: Symbol has no GOT nor PLT relocations.
+     Bit 1: Symbol has non-GOT/non-PLT relocations in text sections.
+     zero_undefweak is initialized to 1 and undefined weak symbol
+     should be resolved to 0 if zero_undefweak > 0.  */
+  unsigned int zero_undefweak : 2;
 
   /* Don't call finish_dynamic_symbol on this symbol.  */
   unsigned int no_finish_dynamic_symbol : 1;
This page took 0.023672 seconds and 4 git commands to generate.