travitch / build-bom

Dynamically discover the commands used to create a piece of software
Apache License 2.0
45 stars 8 forks source link

Argument handling updates #43

Closed kquick closed 1 year ago

kquick commented 1 year ago

This PR addresses a number of issues in clang argument handling:

  1. Single letter options can immediately be followed by their value in the same argument rather than in the next argument.
  2. Multi-letter options taking a value can frequently use either a space or an = separator before their value.
  3. When -oFILE.OBJ is expressed (see item 1), FILE.OBJ needs to be identified as the output file to place the resulting bitcode into
  4. Argument identification (for following argument values or for blacklisting) is based on regexps that need anchoring to prevent accidental false positives (e.g. recognizing -o in -fspec-output or --other).
  5. Adds a --strict flag which preserves architecture and optimization specifications, which are (by default) otherwise removed to ensure maximal bitcode information without requiring cross-compilation support in clang/llvm.

This PR also adds a bunch of tests for verification of the above.