Add "do/while(0);" to COPY_INPUT_RELOC_P/VERIFY_COPY_RELOC

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.
This commit is contained in:
H.J. Lu
2017-10-06 05:49:48 -07:00
parent a1b85d282f
commit e0d8f43169
2 changed files with 28 additions and 15 deletions

View 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> 2017-10-06 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-x86.h (VERIFY_COPY_RELOC): New. * elfxx-x86.h (VERIFY_COPY_RELOC): New.

View File

@ -198,6 +198,8 @@
/* Verify that the symbol has an entry in the procedure linkage table. */ /* Verify that the symbol has an entry in the procedure linkage table. */
#define VERIFY_PLT_ENTRY(INFO, H, PLT, GOTPLT, RELPLT, LOCAL_UNDEFWEAK) \ #define VERIFY_PLT_ENTRY(INFO, H, PLT, GOTPLT, RELPLT, LOCAL_UNDEFWEAK) \
do \
{ \
if (((H)->dynindx == -1 \ if (((H)->dynindx == -1 \
&& !LOCAL_UNDEFWEAK \ && !LOCAL_UNDEFWEAK \
&& !(((H)->forced_local || bfd_link_executable (INFO)) \ && !(((H)->forced_local || bfd_link_executable (INFO)) \
@ -206,16 +208,22 @@
|| (PLT) == NULL \ || (PLT) == NULL \
|| (GOTPLT) == NULL \ || (GOTPLT) == NULL \
|| (RELPLT) == NULL) \ || (RELPLT) == NULL) \
abort (); abort (); \
} \
while (0);
/* Verify that the symbol supports copy relocation. */ /* Verify that the symbol supports copy relocation. */
#define VERIFY_COPY_RELOC(H, HTAB) \ #define VERIFY_COPY_RELOC(H, HTAB) \
do \
{ \
if ((H)->dynindx == -1 \ if ((H)->dynindx == -1 \
|| ((H)->root.type != bfd_link_hash_defined \ || ((H)->root.type != bfd_link_hash_defined \
&& (H)->root.type != bfd_link_hash_defweak) \ && (H)->root.type != bfd_link_hash_defweak) \
|| (HTAB)->elf.srelbss == NULL \ || (HTAB)->elf.srelbss == NULL \
|| (HTAB)->elf.sreldynrelro == NULL) \ || (HTAB)->elf.sreldynrelro == NULL) \
abort (); abort (); \
} \
while (0);
/* x86 ELF linker hash entry. */ /* x86 ELF linker hash entry. */