elf_hash_table_id access
authorAlan Modra <amodra@gmail.com>
Mon, 24 Aug 2020 17:07:02 +0000 (02:37 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 24 Aug 2020 17:15:58 +0000 (02:45 +0930)
* elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table
before accessing elf_hash_table_id.
* elf32-arc.c (elf_arc_hash_table): Likewise.
* elf32-arm.c (elf32_arm_hash_table): Likewise.
* elf32-avr.c (avr_link_hash_table): Likewise.
* elf32-bfin.c (bfinfdpic_hash_table): Likewise.
* elf32-cris.c (elf_cris_hash_table): Likewise.
* elf32-csky.c (csky_elf_hash_table): Likewise.
* elf32-frv.c (frvfdpic_hash_table): Likewise.
* elf32-hppa.c (hppa_link_hash_table): Likewise.
* elf32-lm32.c (lm32_elf_hash_table): Likewise.
* elf32-m32r.c (m32r_elf_hash_table): Likewise.
* elf32-m68hc1x.h (m68hc11_elf_hash_table): Likewise.
* elf32-m68k.c (elf_m68k_hash_table): Likewise.
* elf32-metag.c (metag_link_hash_table): Likewise.
* elf32-microblaze.c (elf32_mb_hash_table): Likewise.
* elf32-nds32.h (nds32_elf_hash_table): Likewise.
* elf32-or1k.c (or1k_elf_hash_table): Likewise.
* elf32-s390.c (elf_s390_hash_table): Likewise.
* elf32-sh.c (sh_elf_hash_table): Likewise.
* elf32-spu.c (spu_hash_table): Likewise.
* elf32-tilepro.c (tilepro_elf_hash_table): Likewise.
* elf32-xtensa.c (elf_xtensa_hash_table): Likewise.
* elf64-alpha.c (alpha_elf_hash_table): Likewise.
* elf64-hppa.c (hppa_link_hash_table): Likewise.
* elf64-ia64-vms.c (elf64_ia64_hash_table): Likewise.
* elf64-s390.c (elf_s390_hash_table): Likewise.
* elfnn-ia64.c (elfNN_ia64_hash_table): Likewise.
* elfnn-riscv.c (riscv_elf_hash_table): Likewise.
* elfxx-mips.c (mips_elf_hash_table): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_hash_table): Likewise.
* elfxx-tilegx.c (tilegx_elf_hash_table): Likewise.

32 files changed:
bfd/ChangeLog
bfd/elf-m10300.c
bfd/elf32-arc.c
bfd/elf32-arm.c
bfd/elf32-avr.c
bfd/elf32-bfin.c
bfd/elf32-cris.c
bfd/elf32-csky.c
bfd/elf32-frv.c
bfd/elf32-hppa.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-m68hc1x.h
bfd/elf32-m68k.c
bfd/elf32-metag.c
bfd/elf32-microblaze.c
bfd/elf32-nds32.h
bfd/elf32-or1k.c
bfd/elf32-s390.c
bfd/elf32-sh.c
bfd/elf32-spu.c
bfd/elf32-tilepro.c
bfd/elf32-xtensa.c
bfd/elf64-alpha.c
bfd/elf64-hppa.c
bfd/elf64-ia64-vms.c
bfd/elf64-s390.c
bfd/elfnn-ia64.c
bfd/elfnn-riscv.c
bfd/elfxx-mips.c
bfd/elfxx-sparc.h
bfd/elfxx-tilegx.c

index f2d18122bbc6c2b4eaf7804fbc471fa8c7b5535e..0c638590fce949fd169593827b2dadaa627134cb 100644 (file)
@@ -1,3 +1,38 @@
+2020-08-25  Alan Modra  <amodra@gmail.com>
+
+       * elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table
+       before accessing elf_hash_table_id.
+       * elf32-arc.c (elf_arc_hash_table): Likewise.
+       * elf32-arm.c (elf32_arm_hash_table): Likewise.
+       * elf32-avr.c (avr_link_hash_table): Likewise.
+       * elf32-bfin.c (bfinfdpic_hash_table): Likewise.
+       * elf32-cris.c (elf_cris_hash_table): Likewise.
+       * elf32-csky.c (csky_elf_hash_table): Likewise.
+       * elf32-frv.c (frvfdpic_hash_table): Likewise.
+       * elf32-hppa.c (hppa_link_hash_table): Likewise.
+       * elf32-lm32.c (lm32_elf_hash_table): Likewise.
+       * elf32-m32r.c (m32r_elf_hash_table): Likewise.
+       * elf32-m68hc1x.h (m68hc11_elf_hash_table): Likewise.
+       * elf32-m68k.c (elf_m68k_hash_table): Likewise.
+       * elf32-metag.c (metag_link_hash_table): Likewise.
+       * elf32-microblaze.c (elf32_mb_hash_table): Likewise.
+       * elf32-nds32.h (nds32_elf_hash_table): Likewise.
+       * elf32-or1k.c (or1k_elf_hash_table): Likewise.
+       * elf32-s390.c (elf_s390_hash_table): Likewise.
+       * elf32-sh.c (sh_elf_hash_table): Likewise.
+       * elf32-spu.c (spu_hash_table): Likewise.
+       * elf32-tilepro.c (tilepro_elf_hash_table): Likewise.
+       * elf32-xtensa.c (elf_xtensa_hash_table): Likewise.
+       * elf64-alpha.c (alpha_elf_hash_table): Likewise.
+       * elf64-hppa.c (hppa_link_hash_table): Likewise.
+       * elf64-ia64-vms.c (elf64_ia64_hash_table): Likewise.
+       * elf64-s390.c (elf_s390_hash_table): Likewise.
+       * elfnn-ia64.c (elfNN_ia64_hash_table): Likewise.
+       * elfnn-riscv.c (riscv_elf_hash_table): Likewise.
+       * elfxx-mips.c (mips_elf_hash_table): Likewise.
+       * elfxx-sparc.h (_bfd_sparc_elf_hash_table): Likewise.
+       * elfxx-tilegx.c (tilegx_elf_hash_table): Likewise.
+
 2020-08-21  Jon Turney  <jon.turney@dronecode.org.uk>
 
        * elf.c (elfcore_grok_win32pstatus): Change name_size to unsigned
index 1c436a78d5cb2aeb593251442d88854295763f6c..ae8cac84e67bc8b124f1b23626df3a7c59effa7e 100644 (file)
@@ -128,8 +128,9 @@ struct elf_mn10300_obj_tdata
 /* Get the MN10300 ELF linker hash table from a link_info structure.  */
 
 #define elf32_mn10300_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == MN10300_ELF_DATA ? ((struct elf32_mn10300_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == MN10300_ELF_DATA)     \
+   ? (struct elf32_mn10300_link_hash_table *) (p)->hash : NULL)
 
 #define elf32_mn10300_link_hash_traverse(table, func, info)            \
   (elf_link_hash_traverse                                              \
index 4d9d6b999285e0ded9601b265e098a88c07c4de6..7d282f39ac2667282e9b44fd0da14769f4c32113 100644 (file)
@@ -1939,8 +1939,9 @@ elf_arc_relocate_section (bfd *                     output_bfd,
 }
 
 #define elf_arc_hash_table(p) \
-    (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == ARC_ELF_DATA ? ((struct elf_arc_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == ARC_ELF_DATA)         \
+   ? (struct elf_arc_link_hash_table *) (p)->hash : NULL)
 
 static bfd_boolean
 elf_arc_check_relocs (bfd *                     abfd,
index 283a6140304b8d61c231de9c0b1b69554f51e0a3..66930c0c7dc1da0b621f5ea23a96a2d17383f9d2 100644 (file)
@@ -3255,9 +3255,10 @@ struct elf32_arm_link_hash_entry
     (info)))
 
 /* Get the ARM elf linker hash table from a link_info structure.  */
-#define elf32_arm_hash_table(info) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((info)->hash)) \
-  == ARM_ELF_DATA ? ((struct elf32_arm_link_hash_table *) ((info)->hash)) : NULL)
+#define elf32_arm_hash_table(p) \
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == ARM_ELF_DATA)         \
+   ? (struct elf32_arm_link_hash_table *) (p)->hash : NULL)
 
 #define arm_stub_hash_lookup(table, string, create, copy) \
   ((struct elf32_arm_stub_hash_entry *) \
index d4ad18c82579f704cda765d65cf4277f3ff07f10..9adf627975d0748ff77c400798272d794ce43105 100644 (file)
@@ -106,9 +106,9 @@ struct elf32_avr_link_hash_table
 
 /* Various hash macros and functions.  */
 #define avr_link_hash_table(p) \
-  /* PR 3874: Check that we have an AVR style hash table before using it.  */\
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == AVR_ELF_DATA ? ((struct elf32_avr_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == AVR_ELF_DATA)         \
+   ? (struct elf32_avr_link_hash_table *) (p)->hash : NULL)
 
 #define avr_stub_hash_entry(ent) \
   ((struct elf32_avr_stub_hash_entry *)(ent))
index f6ecc380d8e7da434e1a33d8a2faee027babb0ab..ab928530db60d8f412896fda51b8cdca419ff08e 100644 (file)
@@ -1668,9 +1668,10 @@ struct bfinfdpic_elf_link_hash_table
 
 /* Get the Blackfin ELF linker hash table from a link_info structure.  */
 
-#define bfinfdpic_hash_table(info) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((info)->hash)) \
-  == BFIN_ELF_DATA ? ((struct bfinfdpic_elf_link_hash_table *) ((info)->hash)) : NULL)
+#define bfinfdpic_hash_table(p) \
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == BFIN_ELF_DATA)                \
+   ? (struct bfinfdpic_elf_link_hash_table *) (p)->hash : NULL)
 
 #define bfinfdpic_got_section(info) \
   (bfinfdpic_hash_table (info)->elf.sgot)
index 4360b5418c0ff273fc9cfc3b2827622eae0639b0..6e5a2d87d6242ac53ca99ed3529d3656ead0e351 100644 (file)
@@ -837,8 +837,9 @@ struct elf_cris_link_hash_table
 /* Get the CRIS ELF linker hash table from a link_info structure.  */
 
 #define elf_cris_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == CRIS_ELF_DATA ? ((struct elf_cris_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == CRIS_ELF_DATA)                \
+   ? (struct elf_cris_link_hash_table *) (p)->hash : NULL)
 
 /* Get the CRIS ELF linker hash entry from a regular hash entry (the
    "parent class").  The .root reference is just a simple type
index 2998aad2055bd7db85f230b455ebeec9ee93e7f1..7806ec7417ad1ec06b304581ed2e53ffaf86470c 100644 (file)
@@ -1184,11 +1184,10 @@ struct csky_elf_link_hash_entry
     (info)))
 
 /* Get the C-SKY ELF linker hash table from a link_info structure.  */
-#define csky_elf_hash_table(info) \
-  ((elf_hash_table_id  ((struct elf_link_hash_table *) ((info)->hash)) \
-    == CSKY_ELF_DATA)                                                  \
-   ? ((struct csky_elf_link_hash_table *) ((info)->hash))              \
-   : NULL)
+#define csky_elf_hash_table(p) \
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == CSKY_ELF_DATA)                \
+   ? (struct csky_elf_link_hash_table *) (p)->hash : NULL)
 
 #define csky_elf_hash_entry(ent)  ((struct csky_elf_link_hash_entry*)(ent))
 
index ad0779b52c578ca4507b3cea06901e1f26544665..9908c0112a5fac731f355c32f565636e469cf187 100644 (file)
@@ -826,8 +826,9 @@ struct frvfdpic_elf_link_hash_table
 /* Get the FRV ELF linker hash table from a link_info structure.  */
 
 #define frvfdpic_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == FRV_ELF_DATA ? ((struct frvfdpic_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == FRV_ELF_DATA)         \
+   ? (struct frvfdpic_elf_link_hash_table *) (p)->hash : NULL)
 
 #define frvfdpic_got_section(info) \
   (frvfdpic_hash_table (info)->elf.sgot)
index 56284eaf0071889a14bc0730de9fc6db76b80e90..b9b1dad1aef3d25d4041cfda3f9667a88e9aef37 100644 (file)
@@ -296,8 +296,9 @@ struct elf32_hppa_link_hash_table
 
 /* Various hash macros and functions.  */
 #define hppa_link_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == HPPA32_ELF_DATA ? ((struct elf32_hppa_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == HPPA32_ELF_DATA)      \
+   ? (struct elf32_hppa_link_hash_table *) (p)->hash : NULL)
 
 #define hppa_elf_hash_entry(ent) \
   ((struct elf32_hppa_link_hash_entry *)(ent))
index 2be3b9264421ff114c76a79646e67b0b6b8b35ce..1751b66bae6e049ec4841a8fa733c43939de59f3 100644 (file)
@@ -67,8 +67,9 @@ struct elf_lm32_link_hash_table
 /* Get the lm32 ELF linker hash table from a link_info structure.  */
 
 #define lm32_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == LM32_ELF_DATA ? ((struct elf_lm32_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == LM32_ELF_DATA)                \
+   ? (struct elf_lm32_link_hash_table *) (p)->hash : NULL)
 
 #define lm32fdpic_got_section(info) \
   (lm32_elf_hash_table (info)->root.sgot)
index 5857c943aec9adb4ca9f4c4a9b5433c4c942fc78..533d662ee8956b2df1fe8c5c0db855aa13e32fb1 100644 (file)
@@ -1509,8 +1509,9 @@ struct elf_m32r_pcrel_relocs_copied
 /* Get the m32r ELF linker hash table from a link_info structure.  */
 
 #define m32r_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == M32R_ELF_DATA ? ((struct elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == M32R_ELF_DATA)                \
+   ? (struct elf_link_hash_table *) (p)->hash : NULL)
 
 /* Create an m32r ELF linker hash table.  */
 
index 720c270a59585b4bee80a46a5fd5753b609dcb72..f88f276772b331bfd2539804cfbb076379fefaa1 100644 (file)
@@ -127,8 +127,9 @@ struct m68hc11_elf_link_hash_table
 /* Get the Sparc64 ELF linker hash table from a link_info structure.  */
 
 #define m68hc11_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == M68HC11_ELF_DATA ? ((struct m68hc11_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == M68HC11_ELF_DATA)     \
+   ? (struct m68hc11_elf_link_hash_table *) (p)->hash : NULL)
 
 /* Create a 68HC11/68HC12 ELF linker hash table.  */
 
index 120816f918b3927f4fb66a49096f3a0b6c9f4dca..b9b8bec6aa89f00ec5c3dd084e5a058155eb6c71 100644 (file)
@@ -910,8 +910,9 @@ struct elf_m68k_link_hash_table
 /* Get the m68k ELF linker hash table from a link_info structure.  */
 
 #define elf_m68k_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == M68K_ELF_DATA ? ((struct elf_m68k_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == M68K_ELF_DATA)                \
+   ? (struct elf_m68k_link_hash_table *) (p)->hash : NULL)
 
 /* Shortcut to multi-GOT data.  */
 #define elf_m68k_multi_got(INFO) (&elf_m68k_hash_table (INFO)->multi_got_)
index f1122fd71e582ade51de38ae971d53d187378a4d..e3203b264f34d34b97bdd006f2bbd8ff1aefae7c 100644 (file)
@@ -906,8 +906,9 @@ metag_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
 
 /* Various hash macros and functions.  */
 #define metag_link_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == METAG_ELF_DATA ? ((struct elf_metag_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == METAG_ELF_DATA)       \
+   ? (struct elf_metag_link_hash_table *) (p)->hash : NULL)
 
 #define metag_elf_hash_entry(ent) \
   ((struct elf_metag_link_hash_entry *)(ent))
index 10aa022beeaeffbeedfd339a430d7f7d1a696f8a..1b5c2efcd6edfe372cfcd3fb9b75c251aac2f60d 100644 (file)
@@ -756,9 +756,10 @@ struct elf32_mb_link_hash_table
 
 /* Get the ELF linker hash table from a link_info structure.  */
 
-#define elf32_mb_hash_table(p)                         \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == MICROBLAZE_ELF_DATA ? ((struct elf32_mb_link_hash_table *) ((p)->hash)) : NULL)
+#define elf32_mb_hash_table(p) \
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == MICROBLAZE_ELF_DATA)  \
+   ? (struct elf32_mb_link_hash_table *) (p)->hash : NULL)
 
 /* Create an entry in a microblaze ELF linker hash table.  */
 
index 83547b2cffcc3569c6f2a57e2716b4b111d47e58..57da1a206a158c3825e282efe8bdb5045c56cd65 100644 (file)
@@ -104,10 +104,10 @@ extern void          bfd_elf32_nds32_set_target_option (struct bfd_link_info *,
                                                      int, int, FILE *,
                                                      int, int, int);
 
-#define nds32_elf_hash_table(info) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((info)->hash)) \
-   == NDS32_ELF_DATA ? \
-   ((struct elf_nds32_link_hash_table *) ((info)->hash)) : NULL)
+#define nds32_elf_hash_table(p) \
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == NDS32_ELF_DATA)       \
+   ? (struct elf_nds32_link_hash_table *) (p)->hash : NULL)
 
 #define elf32_nds32_compute_jump_table_size(htab) \
   ((htab)->next_tls_desc_index * 4)
index ef78187dced0d7706cacd915c893130999046d9e..38406eda3d686736049123b05194938770d56eb6 100644 (file)
@@ -921,8 +921,9 @@ struct elf_or1k_link_hash_table
 
 /* Get the ELF linker hash table from a link_info structure.  */
 #define or1k_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-   == OR1K_ELF_DATA ? ((struct elf_or1k_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == OR1K_ELF_DATA)                \
+   ? (struct elf_or1k_link_hash_table *) (p)->hash : NULL)
 
 static bfd_boolean
 elf_or1k_mkobject (bfd *abfd)
index 530a10d3be657d36697fd87302d776cbbff8e33f..158f909d05a9b9f0d066100b401cc2eb268b9d31 100644 (file)
@@ -751,8 +751,9 @@ struct elf_s390_link_hash_table
 /* Get the s390 ELF linker hash table from a link_info structure.  */
 
 #define elf_s390_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == S390_ELF_DATA ? ((struct elf_s390_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == S390_ELF_DATA)                \
+   ? (struct elf_s390_link_hash_table *) (p)->hash : NULL)
 
 #undef ELF64
 #include "elf-s390-common.c"
index 481bed4c4f915cc5bdcfb096fc50e709ca702b4f..04949463ebf227d12cb42cf1b3168e3b4be8eb5d 100644 (file)
@@ -2192,8 +2192,9 @@ struct elf_sh_link_hash_table
 /* Get the sh ELF linker hash table from a link_info structure.  */
 
 #define sh_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == SH_ELF_DATA ? ((struct elf_sh_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == SH_ELF_DATA)          \
+   ? (struct elf_sh_link_hash_table *) (p)->hash : NULL)
 
 /* Create an entry in an sh ELF linker hash table.  */
 
index dcdee26082536ea9c389bd5e571b5fd5a160edc3..13cff2c5e09880b0da7e49d05c1b131650394337 100644 (file)
@@ -371,8 +371,9 @@ struct got_entry
 };
 
 #define spu_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == SPU_ELF_DATA ? ((struct spu_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == SPU_ELF_DATA)         \
+   ? (struct spu_link_hash_table *) (p)->hash : NULL)
 
 struct call_info
 {
index e062dc03866470c54a0b4b269bd9f3ac42dcf807..351146673943f839f07b14a7e0ae488eb10446e2 100644 (file)
@@ -729,9 +729,9 @@ tilepro_elf_mkobject (bfd *abfd)
 
 /* Get the Tilepro ELF linker hash table from a link_info structure.  */
 #define tilepro_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == TILEPRO_ELF_DATA \
-  ? ((struct elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == TILEPRO_ELF_DATA)     \
+   ? (struct elf_link_hash_table *) (p)->hash : NULL)
 
 static reloc_howto_type *
 tilepro_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
index 8928b11fbce3b3b1aeed53858661bd49d018a88b..65c6ceb37942b9d8849efc4ea460a34156415ad9 100644 (file)
@@ -705,8 +705,9 @@ struct elf_xtensa_link_hash_table
 /* Get the Xtensa ELF linker hash table from a link_info structure.  */
 
 #define elf_xtensa_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == XTENSA_ELF_DATA ? ((struct elf_xtensa_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == XTENSA_ELF_DATA)      \
+   ? (struct elf_xtensa_link_hash_table *) (p)->hash : NULL)
 
 /* Create an entry in an Xtensa ELF linker hash table.  */
 
index cb89dfb03fa29ea2b2bf1bd5cbcb29fc5c908a46..1976450fa4e5d0bd73a54793eed6fd15d6fddd32 100644 (file)
@@ -216,8 +216,9 @@ struct alpha_elf_link_hash_table
 /* Get the Alpha ELF linker hash table from a link_info structure.  */
 
 #define alpha_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == ALPHA_ELF_DATA ? ((struct alpha_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == ALPHA_ELF_DATA)       \
+   ? (struct alpha_elf_link_hash_table *) (p)->hash : NULL)
 
 /* Get the object's symbols as our own entry type.  */
 
index dd52b3511825bd7c3531f5eb7b4a39b9d1dd079d..bf8207e3a7a53bf2a8cb439a9509614903125b74 100644 (file)
@@ -145,8 +145,9 @@ struct elf64_hppa_link_hash_table
 };
 
 #define hppa_link_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == HPPA64_ELF_DATA ? ((struct elf64_hppa_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == HPPA64_ELF_DATA)      \
+   ? (struct elf64_hppa_link_hash_table *) (p)->hash : NULL)
 
 #define hppa_elf_hash_entry(ent) \
   ((struct elf64_hppa_link_hash_entry *)(ent))
index fd001607a359bf04d15799b97a8a4ec37e0c77af..5ce8775459e117d86aea6afdd8626a1ee08ef51f 100644 (file)
@@ -170,8 +170,9 @@ struct elf64_ia64_allocate_data
 };
 
 #define elf64_ia64_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == IA64_ELF_DATA ? ((struct elf64_ia64_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == IA64_ELF_DATA)                \
+   ? (struct elf64_ia64_link_hash_table *) (p)->hash : NULL)
 
 struct elf64_ia64_vms_obj_tdata
 {
index c8c691e4b18be833330ccd4a0af9a75ec1612fe0..0522850a5d8784fef2aece9a4b6c641c3b5ebce3 100644 (file)
@@ -670,8 +670,9 @@ struct elf_s390_link_hash_table
 /* Get the s390 ELF linker hash table from a link_info structure.  */
 
 #define elf_s390_hash_table(p)                                         \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash))      \
-   == S390_ELF_DATA ? ((struct elf_s390_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == S390_ELF_DATA)                \
+   ? (struct elf_s390_link_hash_table *) (p)->hash : NULL)
 
 #define ELF64 1
 #include "elf-s390-common.c"
index e347332aa259f25d02ac5db02dd870b9f8d30d6c..cadf645df9ebcb9d6e7b27cfa2e94edce68d794f 100644 (file)
@@ -166,8 +166,9 @@ struct elfNN_ia64_allocate_data
 };
 
 #define elfNN_ia64_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == IA64_ELF_DATA ? ((struct elfNN_ia64_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == IA64_ELF_DATA)                \
+   ? (struct elfNN_ia64_link_hash_table *) (p)->hash : NULL)
 
 static struct elfNN_ia64_dyn_sym_info * get_dyn_sym_info
   (struct elfNN_ia64_link_hash_table *ia64_info,
index fb78c241770cf8a1944624835f800a9df6bf32c5..5af1b1c3ff336e74e6d65ea3a96dc1ee447bf75e 100644 (file)
@@ -120,8 +120,9 @@ struct riscv_elf_link_hash_table
 
 /* Get the RISC-V ELF linker hash table from a link_info structure.  */
 #define riscv_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == RISCV_ELF_DATA ? ((struct riscv_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == RISCV_ELF_DATA)       \
+   ? (struct riscv_elf_link_hash_table *) (p)->hash : NULL)
 
 static bfd_boolean
 riscv_info_to_howto_rela (bfd *abfd,
index a0439041c0c418d5cce5f0e7a57ba22675a77e4c..fda653e1afccf441269f7800b5f47fb98016bc17 100644 (file)
@@ -534,8 +534,9 @@ struct mips_elf_link_hash_table
 /* Get the MIPS ELF linker hash table from a link_info structure.  */
 
 #define mips_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == MIPS_ELF_DATA ? ((struct mips_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == MIPS_ELF_DATA)                \
+   ? (struct mips_elf_link_hash_table *) (p)->hash : NULL)
 
 /* A structure used to communicate with htab_traverse callbacks.  */
 struct mips_htab_traverse_info
index f09b0732591cb71720d7eac4b917342ad0615ca6..6fbf237e67400b0b983cecb77471640262eb3916 100644 (file)
@@ -84,8 +84,9 @@ struct _bfd_sparc_elf_link_hash_table
 /* Get the SPARC ELF linker hash table from a link_info structure.  */
 
 #define _bfd_sparc_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == SPARC_ELF_DATA ? ((struct _bfd_sparc_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == SPARC_ELF_DATA)       \
+   ? (struct _bfd_sparc_elf_link_hash_table *) (p)->hash : NULL)
 
 extern reloc_howto_type *_bfd_sparc_elf_reloc_type_lookup
   (bfd *, bfd_reloc_code_real_type);
index 2631a0d35081197b3fe7eaa41a8d117a081f3baf..abe344c0c8620b100765db1b9b9f30f6c69e71ad 100644 (file)
@@ -840,8 +840,9 @@ struct tilegx_elf_link_hash_table
 
 /* Get the Tile ELF linker hash table from a link_info structure.  */
 #define tilegx_elf_hash_table(p) \
-  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
-  == TILEGX_ELF_DATA ? ((struct tilegx_elf_link_hash_table *) ((p)->hash)) : NULL)
+  ((is_elf_hash_table ((p)->hash)                                      \
+    && elf_hash_table_id (elf_hash_table (p)) == TILEGX_ELF_DATA)      \
+   ? (struct tilegx_elf_link_hash_table *) (p)->hash : NULL)
 
 #ifdef BFD64
 static bfd_vma
This page took 0.061915 seconds and 4 git commands to generate.