Commit: Fix building ld/emultempl/avrelf.em with clang

Message ID 87y2ycsdnv.fsf@redhat.com
State New
Headers show
Series
  • Commit: Fix building ld/emultempl/avrelf.em with clang
Related show

Commit Message

Nick Clifton Sept. 25, 2019, 1:34 p.m.
Hi Guys,

  I recently came across this build error when using clang instead of
  gcc on a toolchain configure with --enable-targets=all:

    eavr1.c:104:7: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
        && strcmp ("avr1","avrxmega6")
        ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  So I am checking in the patch below to fix the problem.

Cheers
  Nick

ld/ChangeLog
2019-09-25  Nick Clifton  <nickc@redhat.com>

	* emultempl/avrelf.em (_before_allocation): Silence build warning
	using clang.

Patch

diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index f3d1082287..48675efc22 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -77,10 +77,10 @@  avr_elf_${EMULATION_NAME}_before_allocation (void)
       return;
     }
 
-  /* We only need stubs for avr6, avrxmega6, and avrxmega7. */
-  if (strcmp ("${EMULATION_NAME}","avr6")
-      && strcmp ("${EMULATION_NAME}","avrxmega6")
-      && strcmp ("${EMULATION_NAME}","avrxmega7") )
+  /* We only need stubs for avr6, avrxmega6, and avrxmega7.  */
+  if (strcmp ("${EMULATION_NAME}", "avr6") != 0
+      && strcmp ("${EMULATION_NAME}", "avrxmega6") != 0
+      && strcmp ("${EMULATION_NAME}", "avrxmega7") != 0)
     avr_no_stubs = TRUE;
 
   avr_elf_set_global_bfd_parameters ();