Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 6 Oct 2017 12:49:48 +0000 (05:49 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 6 Oct 2017 12:49:48 +0000 (05:49 -0700)
Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC to avoid
potential dangling else problems.

* elfxx-x86.h (COPY_INPUT_RELOC_P): Add "do/while(0);".
(VERIFY_COPY_RELOC): Likewise.

bfd/ChangeLog
bfd/elfxx-x86.h

index 982d29daabf2a4deb8ee5b23884f2d6e8ef5c583..8633071d245b80d68c41cae596eeb6f524b1415e 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * elfxx-x86.h (COPY_INPUT_RELOC_P): Add "do/while(0);".
+       (VERIFY_COPY_RELOC): Likewise.
+
 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        * elfxx-x86.h (VERIFY_COPY_RELOC): New.
index ca270ded0a582471449f301fb5dcf78899f72125..5dc21b06bfd098a891a99142541d7721a7a1cb56 100644 (file)
 
 /* 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) \
-  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 ();
+  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.  */
 
This page took 0.030335 seconds and 4 git commands to generate.