clang-randstruct / llvm-project

Randomize the order of fields in a structure layout as a compile-time hardening feature
3 stars 1 forks source link

Randomize layout docs #27

Closed Nixoncole closed 5 years ago

Nixoncole commented 5 years ago

Here is a PR for the stand alone documentation for the radnomize_layout attribute.

tim-pugh commented 5 years ago
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:18: error: Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.tdEnd of line in string literal:
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:make[2]: *** [tools/clang/include/clang/Sema/CMakeFiles/ClangAttrParsedAttrImpl.dir/build.make:93: tools/clang/include/clang/Sema/AttrParsedAttrImpl.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:23680: tools/clang/include/clang/Sema/CMakeFiles/ClangAttrParsedAttrImpl.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td:Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td  let Heading = "randomize_layout;:
                ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.tdmake[2]: *** [tools/clang/include/clang/Sema/CMakeFiles/ClangAttrTemplateInstantiate.dir/build.make:93: tools/clang/include/clang/Sema/AttrTemplateInstantiate.inc] Error 1
:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.tdIncluded from :/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td:Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/../..//clang/Basic/AttrDocs.td:4102:17: error: make[1]: *** [CMakeFiles/Makefile2:23712: tools/clang/include/clang/Sema/CMakeFiles/ClangAttrTemplateInstantiate.dir/all] Error 2
Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td:Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../Basic/Attr.td:55:
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td:4102:18: /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/../..//clang/Basic/AttrDocs.td:4102:error: 18: End of line in string literal
error: End of line in string literal
  let Heading = "randomize_layout;
   let Heading = "randomize_layout; 
                            ^ 
   ^
Included from Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../Basic/Attr.td/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/Attr.td::5555:
:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/../..//clang/Basic/AttrDocs.td/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Sema/../..//clang/Basic/AttrDocs.td::41024102::17make[2]: *** [tools/clang/include/clang/Sema/CMakeFiles/ClangAttrParsedAttrList.dir/build.make:93: tools/clang/include/clang/Sema/AttrParsedAttrList.inc] Error 1
17: : error: error: Unknown token when parsing a value
Unknown token when parsing a value
  let Heading = "randomize_layout;
   let Heading = "randomize_layout; 
                          ^ 
   ^
make[2]: *** [tools/clang/include/clang/Sema/CMakeFiles/ClangAttrSpellingListIndex.dir/build.make:93: tools/clang/include/clang/Sema/AttrSpellingListIndex.inc] Error 1
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
            55 :
    ^
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td:4102:18: Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td:error: 55:
End of line in string literal
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td:4102  let Heading = "randomize_layout;:
17:  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td : error: 4102 : 18 Unknown token when parsing a value:  
    let Heading = "randomize_layout; error: 
    End of line in string literal  
        let Heading = "randomize_layout;^ 

          Included from   /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td  :   55  :
^ 
 /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td : 4102 : 17 :  ^
error: Unknown token when parsing a value
  let Heading = "randomize_layout;
   Included from  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td :     5555 :
:
  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td : 4102 :^17
: /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../..//clang/Basic/AttrDocs.td:4102:error: 18: Unknown token when parsing a value
error:   let Heading = "randomize_layout;
End of line in string literal
             let Heading = "randomize_layout; 
      ^ 
              ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
make[2]: *** [tools/clang/include/clang/Basic/CMakeFiles/ClangAttrList.dir/build.make:117: tools/clang/include/clang/Basic/AttrList.inc] Error 1
make[2]: *** [tools/clang/include/clang/Sema/CMakeFiles/ClangAttrParsedAttrKinds.dir/build.make:93: tools/clang/include/clang/Sema/AttrParsedAttrKinds.inc] Error 1
make[2]: *** [tools/clang/include/clang/AST/CMakeFiles/ClangAttrVisitor.dir/build.make:97: tools/clang/include/clang/AST/AttrVisitor.inc] Error 1
make[2]: *** [tools/clang/include/clang/AST/CMakeFiles/ClangAttrTraverse.dir/build.make:97: tools/clang/include/clang/AST/AttrNodeTraverse.inc] Error 1
make[2]: *** [tools/clang/include/clang/Parse/CMakeFiles/ClangAttrSubMatchRulesParserStringSwitches.dir/build.make:93: tools/clang/include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc] Error 1
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../Basic/Attr.td:make[2]: *** [tools/clang/include/clang/AST/CMakeFiles/ClangAttrClasses.dir/build.make:97: tools/clang/include/clang/AST/Attrs.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:22401: tools/clang/include/clang/AST/CMakeFiles/ClangAttrVisitor.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:22497: tools/clang/include/clang/AST/CMakeFiles/ClangAttrTraverse.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:23045: tools/clang/include/clang/Basic/CMakeFiles/ClangAttrList.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:23562: tools/clang/include/clang/Parse/CMakeFiles/ClangAttrSubMatchRulesParserStringSwitches.dir/all] Error 2
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.tdmake[1]: *** [CMakeFiles/Makefile2:22561: tools/clang/include/clang/AST/CMakeFiles/ClangAttrClasses.dir/all] Error 2
:make[1]: *** [CMakeFiles/Makefile2:23648: tools/clang/include/clang/Sema/CMakeFiles/ClangAttrParsedAttrList.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:23744: tools/clang/include/clang/Sema/CMakeFiles/ClangAttrSpellingListIndex.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:23776: tools/clang/include/clang/Sema/CMakeFiles/ClangAttrParsedAttrKinds.dir/all] Error 2
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../..//clang/Basic/AttrDocs.td:make[2]: *** [tools/clang/include/clang/Basic/CMakeFiles/ClangAttrSubjectMatchRuleList.dir/build.make:117: tools/clang/include/clang/Basic/AttrSubMatchRulesList.inc] Error 1
4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
             55make[2]: *** [tools/clang/include/clang/AST/CMakeFiles/ClangAttrImpl.dir/build.make:97: tools/clang/include/clang/AST/AttrImpl.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:23461: tools/clang/include/clang/Basic/CMakeFiles/ClangAttrSubjectMatchRuleList.dir/all] Error 2
Included from Included from  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/Attr.td/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../Basic/Attr.tdIncluded from :
 /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../Basic/Attr.td:::  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../..//clang/Basic/AttrDocs.td^:
4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
Included from  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../Basic/Attr.td :  55 :
  /home/timpugh_pdx_edu/llvm-project/clang/include/clang/AST/../..//clang/Basic/AttrDocs.td : 4102 : 17 :    error:  ^
Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../..//clang/Basic/AttrDocs.td:4102:18: error: End of line in string literal
  let Heading = "randomize_layout;
                 ^
Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../Basic/Attr.td:55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Parse/../..//clang/Basic/AttrDocs.td:4102:17: error: Unknown token when parsing a value
  let Heading = "randomize_layout;
                ^
55:
55:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/../..//clang/Basic/AttrDocs.td/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../..//clang/Basic/AttrDocs.td::41024102::1818: : error: error: End of line in string literalEnd of line in string literal

  let Heading = "randomize_layout;  let Heading = "randomize_layout;

                                  ^^

Included from Included from /home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/Attr.td/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../Basic/Attr.td::5555:
:
/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Basic/../..//clang/Basic/AttrDocs.td/home/timpugh_pdx_edu/llvm-project/clang/include/clang/Serialization/../..//clang/Basic/AttrDocs.td::41024102::1717: : error: error: Unknown token when parsing a valueUnknown token when parsing a value

  let Heading = "randomize_layout;  let Heading = "randomize_layout;

                                ^^

make[2]: *** [tools/clang/include/clang/Serialization/CMakeFiles/ClangAttrPCHRead.dir/build.make:93: tools/clang/include/clang/Serialization/AttrPCHRead.inc] Error 1
make[2]: *** [tools/clang/include/clang/Parse/CMakeFiles/ClangAttrParserStringSwitches.dir/build.make:93: tools/clang/include/clang/Parse/AttrParserStringSwitches.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:22593: tools/clang/include/clang/AST/CMakeFiles/ClangAttrImpl.dir/all] Error 2
make[2]: *** [tools/clang/include/clang/AST/CMakeFiles/ClangAttrTextDump.dir/build.make:97: tools/clang/include/clang/AST/AttrTextNodeDump.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:23594: tools/clang/include/clang/Parse/CMakeFiles/ClangAttrParserStringSwitches.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:23859: tools/clang/include/clang/Serialization/CMakeFiles/ClangAttrPCHRead.dir/all] Error 2
make[2]: *** [tools/clang/include/clang/Basic/CMakeFiles/ClangAttrHasAttributeImpl.dir/build.make:117: tools/clang/include/clang/Basic/AttrHasAttributeImpl.inc] Error 1
make[2]: *** [tools/clang/include/clang/Serialization/CMakeFiles/ClangAttrPCHWrite.dir/build.make:93: tools/clang/include/clang/Serialization/AttrPCHWrite.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:22433: tools/clang/include/clang/AST/CMakeFiles/ClangAttrTextDump.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:23827: tools/clang/include/clang/Serialization/CMakeFiles/ClangAttrPCHWrite.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:22949: tools/clang/include/clang/Basic/CMakeFiles/ClangAttrHasAttributeImpl.dir/all] Error 2
jeffreytakahashi commented 5 years ago

For future usage, Cole gave a great list of links and how to use this:

https://clang.llvm.org/docs/InternalsManual.html#documentation clang-tblgen -gen-attr-docs -I /path/to/clang/include /path/to/clang/include/clang/Basic/Attr.td -o /path/to/clang/docs/AttributeReference.rst https://llvm.org/docs/TableGen/BackEnds.html#attrdocs https://llvm.org/docs/TableGen/index.html

tim-pugh commented 5 years ago

Navigate to ~/llvm-project/build/bin and run:

./clang-tblgen -gen-attr-docs -I ../../clang/include/ ../../clang/include/clang/Basic/Attr.td -o ../../clang/docs/AttributeReference.rst

and then navigate to

../../clang/docs/AttributeReference.rst

and search for "randomize_layout" to see the addition.