[PATCH] D40478: Added control flow architecture protection Flag

Oren Ben Simhon via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 07:38:16 PST 2018


oren_ben_simhon marked an inline comment as done.
oren_ben_simhon added inline comments.


================
Comment at: test/CodeGen/x86-cf-protection.c:1
+// RUN: not %clang_cc1 -fsyntax-only -S -emit-llvm -triple i386-unknown-unknown -fcf-protection=return %s 2>&1 | FileCheck %s --check-prefix=RETURN
+// RUN: not %clang_cc1 -fsyntax-only -S -emit-llvm -triple i386-unknown-unknown -fcf-protection=branch %s 2>&1 | FileCheck %s --check-prefix=BRANCH
----------------
alexfh wrote:
> oren_ben_simhon wrote:
> > alexfh wrote:
> > > Any reason this test runs clang with "-S" and "-emit-llvm"? Neither of those seems to be needed for the actual checks being made below.
> > I agree that -emit-llvm is redundant for the test checks. Without -S  the command has no output on stdout or stderr. So the run fails and doesn't execute.
> The specific problem I've stumbled upon is that the test fails when the source file is on a read-only partition:
> ```
> [3250/3251] Running the Clang regression tests    
> llvm-lit: /src/utils/lit/lit/llvm/config.py:334: note: using clang: /build/bin/clang
> FAIL: Clang :: CodeGen/x86-cf-protection.c (2485 of 11862)
> ******************** TEST 'Clang :: CodeGen/x86-cf-protection.c' FAILED ********************
> Script:                                           
> --                                                
> not /build/bin/clang -cc1 -internal-isystem /build/lib/clang/7.0.0/include -nostdsysteminc -fsyntax-only -S -emit-llvm -triple i386-unknown-unknown -fcf-protection=return /src/tools/clang/test/CodeGen/x86-cf-protection.c 2>&1 | /build/bin/FileCheck /src/tools/clang/test/CodeGen/x86
> -cf-protection.c --check-prefix=RETURN            
> not /build/bin/clang -cc1 -internal-isystem /build/lib/clang/7.0.0/include -nostdsysteminc -fsyntax-only -S -emit-llvm -triple i386-unknown-unknown -fcf-protection=branch /src/tools/clang/test/CodeGen/x86-cf-protection.c 2>&1 | /build/bin/FileCheck /src/tools/clang/test/CodeGen/x86
> -cf-protection.c --check-prefix=BRANCH            
> --                                                
> Exit Code: 1                                      
>                                                   
> Command Output (stderr):                          
> --                                                
> /src/tools/clang/test/CodeGen/x86-cf-protection.c:4:12: error: expected string not found in input
> // RETURN: error: option 'cf-protection=return' cannot be specified without '-mshstk'
>            ^                                      
> <stdin>:1:1: note: scanning from here             
> error: unable to open output file '': 'Read-only file system'
> ^                                                 
>                                                   
> --                                                
> ```
> Adding `-o %t` solves the problem (r322082).
I see. Thanks for the fix.


Repository:
  rC Clang

https://reviews.llvm.org/D40478





More information about the cfe-commits mailing list