This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug build/20518] New: Compilation Fails on x86_64 when ssse3 / avx is enabled and _FORTIFY_SOURCE is not set


https://sourceware.org/bugzilla/show_bug.cgi?id=20518

            Bug ID: 20518
           Summary: Compilation Fails on x86_64 when ssse3 / avx is
                    enabled and _FORTIFY_SOURCE is not set
           Product: glibc
           Version: 2.24
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: kata198 at gmail dot com
                CC: carlos at redhat dot com
  Target Milestone: ---

Created attachment 9477
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9477&action=edit
Patch to fix compilation issue with ssse3 and/or avx and no _FORTIFY_SOURCE

When ssse3 and/or avx are enabled in CFLAGS (like in the following flags on my
i5 processor: "-mtune=native -march=native -O3 -pipe" ) and _FORTIFY_SOURCE is
NOT set, compilation of several x86_64 assembly files fails.

The issue was introduced by this commit:

commit c365e615f7429aee302f8af7bf07ae262278febb
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Mar 28 13:13:36 2016 -0700

Implement x86-64 multiarch mempcpy in memcpy

Implement x86-64 multiarch mempcpy in memcpy to share most of code. It
reduces code size of libc.so.

[BZ #18858]
* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Remove
mempcpy-ssse3, mempcpy-ssse3-back, mempcpy-avx-unaligned
and mempcpy-avx512-no-vzeroupper.
* sysdeps/x86_64/multiarch/memcpy-avx-unaligned.S (MEMPCPY_CHK):
New.
(MEMPCPY): Likewise.
* sysdeps/x86_64/multiarch/memcpy-avx512-no-vzeroupper.S
(MEMPCPY_CHK): New.
(MEMPCPY): Likewise.
* sysdeps/x86_64/multiarch/memcpy-ssse3-back.S (MEMPCPY_CHK): New.
(MEMPCPY): Likewise.
* sysdeps/x86_64/multiarch/memcpy-ssse3.S (MEMPCPY_CHK): New.
(MEMPCPY): Likewise.
* sysdeps/x86_64/multiarch/mempcpy-avx-unaligned.S: Removed.
* sysdeps/x86_64/multiarch/mempcpy-avx512-no-vzeroupper.S:
Likewise.
* sysdeps/x86_64/multiarch/mempcpy-ssse3-back.S: Likewise.
* sysdeps/x86_64/multiarch/mempcpy-ssse3.S: Likewise.




A sample error from compilation is as follows:

gcc ../sysdeps/x86_64/multiarch/memcpy-ssse3.S -c -U_FORTIFY_SOURCE
-I../include -I/usr/src/arch/glibc/src/glibc-build/string
-I/usr/src/arch/glibc/src/glibc-build -I../sysdeps/unix/sysv/linux/x86_64/64
-I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86
-I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/x86_64/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/x86_64 -I../sysdeps/unix
-I../sysdeps/posix -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch
-I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu
-I../sysdeps/x86_64/multiarch -I../sysdeps/x86_64 -I../sysdeps/x86
-I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32
-I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I..
-I../libio -I. -nostdinc -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed -isystem /usr/include
-D_LIBC_REENTRANT -include /usr/src/arch/glibc/src/glibc-build/libc-modules.h
-DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DASSEMBLER
-Werror=undef -Wa,--noexecstack -o
/usr/src/arch/glibc/src/glibc-build/string/memcpy-ssse3.o -MD -MP -MF
/usr/src/arch/glibc/src/glibc-build/string/memcpy-ssse3.o.dt -MT
/usr/src/arch/glibc/src/glibc-build/string/memcpy-ssse3.o
gcc ../sysdeps/x86_64/multiarch/memmove-ssse3.S -c -U_FORTIFY_SOURCE
-I../include -I/usr/src/arch/glibc/src/glibc-build/string
-I/usr/src/arch/glibc/src/glibc-build -I../sysdeps/unix/sysv/linux/x86_64/64
-I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86
-I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/x86_64/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/x86_64 -I../sysdeps/unix
-I../sysdeps/posix -I../sysdeps/x86_64/64 -I../sysdeps/x86_64/fpu/multiarch
-I../sysdeps/x86_64/fpu -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu
-I../sysdeps/x86_64/multiarch -I../sysdeps/x86_64 -I../sysdeps/x86
-I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64/wordsize-64
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32
-I../sysdeps/wordsize-64 -I../sysdeps/ieee754 -I../sysdeps/generic -I..
-I../libio -I. -nostdinc -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed -isystem /usr/include
-D_LIBC_REENTRANT -include /usr/src/arch/glibc/src/glibc-build/libc-modules.h
-DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DASSEMBLER
-Werror=undef -Wa,--noexecstack -o
/usr/src/arch/glibc/src/glibc-build/string/memmove-ssse3.o -MD -MP -MF
/usr/src/arch/glibc/src/glibc-build/string/memmove-ssse3.o.dt -MT
/usr/src/arch/glibc/src/glibc-build/string/memmove-ssse3.o
../sysdeps/x86_64/multiarch/memcpy-ssse3.S: Assembler messages:
../sysdeps/x86_64/multiarch/memcpy-ssse3.S:65: Error: operand type mismatch for
`jb'


Since "__chk_fail" seems to be undefined when _FORTIFY_SOURCE is not set (like
in the given gcc, -U_FORTIFY_SOURCE is present).

I've added an attachment which resolves the issue by doing an additional
ifdef-style check for _FORTIFY_SOURCE before trying to call __chk_fail. This
effectively makes the mem*_chk functions the same as their non-chk counterparts
(which I believe is how undefined _FORTIFY_SOURCE is expected to operate).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]