From c917b673cf5f14440685ac50041f8a8cd98c4fca Mon Sep 17 00:00:00 2001 From: Ian A Mason Date: Fri, 30 Oct 2020 15:43:40 +0000 Subject: [PATCH] FreeBSD bug fix (pico extension) --- Makefile | 1 + shared/compiler.go | 2 ++ shared/parser.go | 8 ++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f90cc90..f64adc4 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ help: @echo '' +install: develop develop: go install github.com/SRI-CSL/gllvm/cmd/... diff --git a/shared/compiler.go b/shared/compiler.go index 7485797..5a353a8 100644 --- a/shared/compiler.go +++ b/shared/compiler.go @@ -134,12 +134,14 @@ func buildAndAttachBitcode(compilerExecName string, pr ParserResult, bcObjLinks func attachBitcodePathToObject(bcFile, objFile string) (success bool) { // We can only attach a bitcode path to certain file types + // this is too fragile, we need to look into a better way to do this. switch filepath.Ext(objFile) { case ".o", ".lo", ".os", ".So", + ".pico", //iam: pico is FreeBSD ".po": // Store bitcode path to temp file var absBcPath, _ = filepath.Abs(bcFile) diff --git a/shared/parser.go b/shared/parser.go index 7c3e338..db09cce 100644 --- a/shared/parser.go +++ b/shared/parser.go @@ -352,11 +352,15 @@ func Parse(argList []string) ParserResult { // iam: this is a list because matching needs to be done in order. // if you add a NEW pattern; make sure it is before any existing pattern that also - // matches and has a conflicting flagInfo value. + // matches and has a conflicting flagInfo value. Also be careful with flags that can contain filenames, like + // linker info flags or dependency flags var argPatterns = [...]argPattern{ {`^.+\.(c|cc|cpp|C|cxx|i|s|S|bc)$`, flagInfo{0, pr.inputFileCallback}}, {`^.+\.([fF](|[0-9][0-9]|or|OR|pp|PP))$`, flagInfo{0, pr.inputFileCallback}}, - {`^.+\.(o|lo|So|so|po|a|dylib|pico)$`, flagInfo{0, pr.objectFileCallback}}, //iam: pico is FreeBSD + //iam: it's a bit fragile as to what we recognize as an object file. + // this also shows up in the compile function attachBitcodePathToObject, so additions + // here, should also be additions there. + {`^.+\.(o|lo|So|so|po|a|dylib|pico)$`, flagInfo{0, pr.objectFileCallback}}, //iam: pico is FreeBSD {`^.+\.dylib(\.\d)+$`, flagInfo{0, pr.objectFileCallback}}, {`^.+\.(So|so)(\.\d)+$`, flagInfo{0, pr.objectFileCallback}}, {`^-(l|L).+$`, flagInfo{0, pr.linkUnaryCallback}},