This attribute is useful in OS development when we jump from 32 to 64 bit
code and expect that 64bit function forces correct stack alignment.
Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html
Differential D36272
[CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64 anatol.pomozov on Aug 3 2017, 9:46 AM. Authored by
Details
This attribute is useful in OS development when we jump from 32 to 64 bit Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html
Diff Detail Event TimelineComment Actions I ran following tests. 1 failed but it looks unrelated to my change. $ utils/lit/lit.py -sv --param=clang_site_config=build/tools/clang/test/lit.site.cfg tools/clang/test/ lit.py: /usr/local/google/home/anatol/sources/llvm/tools/clang/test/lit.cfg:200: note: using clang: '/usr/local/google/home/anatol/sources/llvm/build/./bin/clang' lit.py: /mnt/cold/sources/llvm/utils/lit/lit/discovery.py:190: warning: test suite 'Clang-Unit' contained no tests FAIL: Clang :: Driver/sanitizer-ld.c (4347 of 9181) ******************** TEST 'Clang :: Driver/sanitizer-ld.c' FAILED ******************** Script: -- /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-SHARED-ASAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.so -shared 2>&1 -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libasan -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-DSO-SHARED-ASAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-freebsd -fuse-ld=ld -fsanitize=address -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_freebsd_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-FREEBSD /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-freebsd -fuse-ld=ld -fsanitize=address -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_freebsd_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-FREEBSD-LDL /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld -stdlib=platform -fsanitize=address -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/empty_resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /dev/null -fsanitize=address -target i386-unknown-linux -fuse-ld=ld -stdlib=platform --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree -lstdc++ -static 2>&1 | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-LINUX-CXX-STATIC /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-gnueabi -fuse-ld=ld -fsanitize=address --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/sysroot | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-ARM /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target armv7l-linux-gnueabi -fuse-ld=ld -fsanitize=address --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/sysroot | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-ARMv7 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/sysroot | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-ANDROID /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-androideabi -fsanitize=address --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/sysroot -shared-libasan | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED-LIBASAN /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-androideabi -fuse-ld=ld -fsanitize=address --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/sysroot -shared | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-ANDROID-SHARED /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target sparcel-myriad-rtems-elf -fuse-ld=ld -fsanitize=address --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_myriad_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-MYRIAD /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ -fsanitize=thread -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-TSAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld -stdlib=platform -lstdc++ -fsanitize=memory -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-MSAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-UBSAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=undefined -fsanitize-link-c++-runtime /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -fsanitize=undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld -stdlib=platform -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=address,undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -fsanitize=address,undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld -stdlib=platform --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -fsanitize=memory,undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -fsanitize=thread,undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i386-unknown-linux -fuse-ld=ld -resource-dir=/mnt/cold/sources/clang/test/Driver/Inputs/resource_dir --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree -shared | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-UBSAN-LINUX-SHARED /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-LSAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=leak -fsanitize-coverage=func --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-LSAN-COV-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=leak,address /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-LSAN-ASAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=address -fsanitize-coverage=func /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-COV-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=memory -fsanitize-coverage=func /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-MSAN-COV-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=dataflow -fsanitize-coverage=func /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-DFSAN-COV-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=undefined -fsanitize-coverage=func /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-UBSAN-COV-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize-coverage=func /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-COV-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld -rtlib=platform --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fsanitize-cfi-cross-dso /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fsanitize-cfi-cross-dso /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -fno-sanitize-trap=cfi -fsanitize-recover=cfi -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -fsanitize=address /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -mmacosx-version-min=10.6 -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang --driver-mode=g++ -fsanitize=leak /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -mmacosx-version-min=10.6 -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-SAFESTACK-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fsanitize-stats /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-STATS-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fsanitize-stats /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-apple-darwin -fuse-ld=ld --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fsanitize-stats /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-pc-windows --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-STATS-WIN64 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=cfi -fsanitize-stats /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target i686-pc-windows --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_linux_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-STATS-WIN32 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o -shared 2>&1 -target arm-linux-androideabi -fuse-ld=ld -fsanitize=safe-stack --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target aarch64-linux-android -fuse-ld=ld -fsanitize=safe-stack --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-androideabi -fuse-ld=ld -fsanitize=cfi --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CFI-ANDROID /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -no-canonical-prefixes /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target arm-linux-androideabi -fuse-ld=ld -fsanitize=cfi -fsanitize-cfi-cross-dso --sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-CROSSDSO-CFI-ANDROID /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-scei-ps4 -fuse-ld=ld -shared | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-UBSAN-PS4 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=address /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-scei-ps4 -fuse-ld=ld -shared | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ASAN-PS4 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=address,undefined /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-scei-ps4 -fuse-ld=ld -shared | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-AUBSAN-PS4 /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=efficiency-cache-frag /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ESAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c /usr/local/google/home/anatol/sources/llvm/build/./bin/clang -fsanitize=efficiency-working-set /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -### -o /mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o 2>&1 -target x86_64-unknown-linux -fuse-ld=ld | /usr/local/google/home/anatol/sources/llvm/build/./bin/FileCheck --check-prefix=CHECK-ESAN-LINUX /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c -- Exit Code: 1 Command Output (stderr): -- /mnt/cold/sources/clang/test/Driver/sanitizer-ld.c:488:37: error: expected string not found in input // CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" ^ <stdin>:1:1: note: scanning from here clang version 6.0.0 (https://github.com/llvm-mirror/clang 18564ee34cc1734234c6b597cc86ba867217801f) (https://github.com/llvm-mirror/llvm 61e4e61f04ce9ab0a37e54d481ceabd087899dc4) ^ <stdin>:6:933: note: possible intended match here "/usr/local/google/home/anatol/work/daydream/android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-ld" "--sysroot=/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree" "--fix-cortex-a53-843419" "-z" "relro" "--eh-frame-hdr" "-m" "aarch64linux" "-dynamic-linker" "/system/bin/linker64" "-o" "/mnt/cold/sources/llvm/build/tools/clang/test/Driver/Output/sanitizer-ld.c.tmp.o" "crtbegin_dynamic.o" "-L/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/lib/gcc/aarch64-linux-android/4.8" "-L/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/lib/gcc/aarch64-linux-android/4.8/../../../../aarch64-linux-android/lib" "-L/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/lib/gcc/aarch64-linux-android/4.8/../../.." "-L/mnt/cold/sources/clang/test/Driver/Inputs/basic_android_tree/lib" "/tmp/lit_tmp__emdgJ/sanitizer-ld-943640.o" "-lgcc" "-ldl" "-lc" "-lgcc" "-ldl" "crtend_android.o" ^ -- ******************** Testing Time: 78.52s ******************** Failing Tests (1): Clang :: Driver/sanitizer-ld.c Expected Passes : 9119 Expected Failures : 20 Unsupported Tests : 41 Unexpected Failures: 1 1 warning(s) in tests. Comment Actions I've added "cfe-commits" as a subscriber since that's how we make sure the review request gets to the mailing list (which is still where review canonically takes place). Comment Actions Are we SURE the stack alignment for this type is supposed to be 16 bit as well? I didn't see any discussion about it in the email conversation. I have very little understanding of this attribute, but I would (perhaps naiively) presume that it would be different on 64 bit targets. Additionally, there is likely value to split the test run-line into 2, one that specifies 64 bit Windows and one that is 64 bit Linux. The value being that they validate two different code paths (whereas 32 is the same code path). Comment Actions Related maillist discussion is http://lists.llvm.org/pipermail/cfe-dev/2017-June/054359.html
x86_64 ABI requires 16-byte stack alignment and compiler already enforces it at the caller side. It does not work when we jump from 32bit code (where stack might not be 16-byte aligned) to 64bit code. So we need a way to enforce the stack alignment at callee side. In this case the attribute above is helpful. Comment Actions
I added a RUN for triplet '-triple x86_64-pc-win32' and tests are failing for me. I rebuilt clang without my patches and still see the same failure. It looks like the original function-attributes currently does not work with win32 triplet. -- Exit Code: 1 Command Output (stderr): -- /mnt/cold/sources/llvm/tools/clang/test/CodeGen/function-attributes.c:76:21: warning: unknown attribute 'force_align_arg_pointer' ignored void __attribute__((force_align_arg_pointer)) f16(void) { ^ 1 warning generated. /mnt/cold/sources/llvm/tools/clang/test/CodeGen/function-attributes.c:4:11: error: expected string not found in input // CHECK: define signext i8 @f0(i32 %x) [[NUW:#[0-9]+]] ^ <stdin>:1:1: note: scanning from here ; ModuleID = '/mnt/cold/sources/llvm/tools/clang/test/CodeGen/function-attributes.c' ^ <stdin>:7:1: note: possible intended match here define i8 @f0(i32 %x) #0 { ^ /mnt/cold/sources/llvm/tools/clang/test/CodeGen/function-attributes.c:67:11: error: expected string not found in input // CHECK: [[NUW]] ^ <stdin>:158:17: note: scanning from here define void @f15() #0 { ^ <stdin>:158:17: note: uses undefined variable "NUW" define void @f15() #0 { ^ /mnt/cold/sources/llvm/tools/clang/test/CodeGen/function-attributes.c:104:11: error: expected string not found in input // CHECK: call i32 @_setjmp(i32* null) ^ <stdin>:191:1: note: scanning from here entry: ^ <stdin>:193:7: note: possible intended match here %1 = call i32 @_setjmp(i8* null, i8* %0) #7 ^ -- Comment Actions Aaron would likely know better than me... but could it be the spelling type should be GCC instead of GNU? Comment Actions Another fact: gcc 7.2.0 supports this attribute at x86_64. It would be great if two major compilers were feature compatible and worked in a similar way. Comment Actions Yes, this should be spelled with GCC rather than GNU, as it's a documented GCC attribute and needs the C++11 spelling you get from that switch. That doesn't have to be a part of this patch, however, when it gets done, we should also add documentation to AttrDocs.td for the attribute.
Comment Actions Did you figure out why this doesn't work on windows? Not having the windows-specific x64 test seems like a mistake, unless we're going to make this a linux-only attribute. In which case, you'll have to remove this attribute in the 32-bit windows case. Comment Actions The function-attributes.c test does not pass at Windows even without my patch. Unfortunately I am not familiar with clang enough to debug this issue. Comment Actions Yes, but the point of your patch seems to be to ADD this functionality to x64 Linux AND windows. This needs to match the behavior of Comment Actions Hi Eric, thank you for your reply. Both these triples are currently broken, with my change and without. The attribute functionality in WinX86_64TargetCodeGenInfo mirrors one in X86_64TargetCodeGenInfo and it should work the same way. It is done intentionally as both these systems have the stack alignment restrictions. In addition to option you proposed there are other ways to make the forward progress:
Comment Actions As I said, as long as BOTH windows versions have the same issue, I think _I_ am OK with it. Since x86-windows already didn't work, you've simply added x64-windows support, which seems like a win to me. I think I'm ok with this for now, so I'll approve. Comment Actions Yes, I'm okay with that. I'd also be more okay if we corrected the attribute spelling to be GCC instead of GNU and added some documentation to the attribute, since we're updating it. Comment Actions
The tests fail at windows the same way. The only difference - "attribute is not supported at 64bit" compiler warning is gone with my change.
These are great suggestions! But I think it makes more sense to have a separate change for it as it orthogonal to what I am trying to do here. Having separate commits for independent changes is better as it makes things like bisecting and rollbacks easier. Comment Actions I tend to agree, however I suspect Aaron really wants it done. Any chance you could submit a review to make that change? *Please* :) Comment Actions I agree that a follow-up patch is totally fine for this. If (either of) you want to do the patch, that'd be fantastic! If you don't feel like doing the patch, that's also fine (I may get around to it someday myself). Comment Actions Hi Aaron. Thank you very much for reviewing this patch. I'll be glad to add documentation for 'force_align_arg_pointer' attribute and upload another patch. But before doing it I would like to finish work on the current patch and make its forward progress toward repository. Comment Actions You're good to commit this patch already -- do you need someone to commit on your behalf? Comment Actions I have no commit permissions (this is my first patch to LLVM project). Ideally if someone of you merge it. If not then I'll ask a friend of mine who works on clang sanitizers to merge it. |
You can use auto * here instead of spelling out the type twice.