New issue
Advanced search Search tips

Issue 732961 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Jun 2017
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug

Blocking:
issue 711461
issue 715331



Sign in to add a comment

binutils 2.27 assembler generates incorrect transformation from ldr to movs

Project Member Reported by manojgupta@chromium.org, Jun 13 2017

Issue description

The attached file clone.S from glibc-2.23/sysdeps/unix/sysv/linux/arm/clone.S is incorrectly handled in assembler from binutils 2.27.

In the good version:

  3e:	f41c 7f80 	tst.w	ip, #256	; 0x100
  42:	4f08      	ldr	r7, [pc, #32]	; (64 <__clone+0x64>)
  44:	bf14      	ite	ne
  46:	f04f 30ff 	movne.w	r0, #4294967295	; 0xffffffff

Note that ite/movnew instructions depend on condition codes generated by tst.w.

bad version, ldr is replaced by movs:

  3e:	f41c 7f80 	tst.w	ip, #256	; 0x100
  42:	2714      	movs	r7, #20
  44:	bf14      	ite	ne
  46:	f04f 30ff 	movne.w	r0, #4294967295	; 0xffffffff

According to ARM assembly docs for MOV:

If S is specified, the instruction:
Updates the N and Z flags according to the result.
Can update the C flag during the calculation of Operand2.
Does not affect the V flag.

So movs changes the condition flags generated by tst.w.

This is blocking binutils-2.27 upgrade.
 
clone.S
2.4 KB Download
clone_bad.s
1.3 KB Download
clone_good.s
1.4 KB Download
Command line:

armv7a-cros-linux-gnueabi-gcc  -Wl,-O2 -Wl,--as-needed -Wl,-O2 -Wl,--as-needed -fuse-ld=bfd ../sysdeps/unix/sysv/linux/arm/clone.S -c  -U_FORTIFY_SOURCE   -I../include -I/var/tmp/portage/cross-armv7a-cros-linux-gnueabi/glibc-2.23-r6/work/build-default-armv7a-cros-linux-gnueabi-nptl/misc  -I/var/tmp/portage/cross-armv7a-cros-linux-gnueabi/glibc-2.23-r6/work/build-default-armv7a-cros-linux-gnueabi-nptl  -I../sysdeps/unix/sysv/linux/arm  -I../sysdeps/arm/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/arm  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/arm/armv7/multiarch  -I../sysdeps/arm/armv7  -I../sysdeps/arm/armv6t2  -I../sysdeps/arm/armv6  -I../sysdeps/arm/include -I../sysdeps/arm  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/armv7a-cros-linux-gnueabi/4.9.x/include -isystem /usr/lib/gcc/armv7a-cros-linux-gnueabi/4.9.x/include-fixed -isystem /usr/armv7a-cros-linux-gnueabi/usr/include  -D_LIBC_REENTRANT -include /var/tmp/portage/cross-armv7a-cros-linux-gnueabi/glibc-2.23-r6/work/build-default-armv7a-cros-linux-gnueabi-nptl/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h       -DASSEMBLER  -ggdb -Werror=undef -Wa,--noexecstack  -Werror=undef -Wa,--noexecstack   -o /var/tmp/portage/cross-armv7a-cros-linux-gnueabi/glibc-2.23-r6/work/build-default-armv7a-cros-linux-gnueabi-nptl/misc/clone.o -MD -MP -MF /var/tmp/portage/cross-armv7a-cros-linux-gnueabi/glibc-2.23-r6/work/build-default-armv7a-cros-linux-gnueabi-nptl/misc/clone.o.dt -MT /var/tmp/portage/cross-armv7a-cros-linux-gnueabi/glibc-2.23-r6/work/build-default-armv7a-cros-linux-gnueabi-nptl/misc/clone.o
Blocking: 711461
Attaching clone.asm file used as input to assembler.
clone.asm
6.1 KB View Download
Blocking: 715331
Owner: manojgupta@chromium.org
Status: Verified (was: Untriaged)
Change committed. Verified that building a image with the change included fixes arm boards boot issue.

Sign in to add a comment