Fixed some wierdness uncovered by llvm-3.4 bad behavior. Plus puffed out the apache 14.0 tutorial a bit.

This commit is contained in:
Ian A. Mason 2018-05-08 15:11:42 -07:00
parent a2fff80cfe
commit 49578305ef
3 changed files with 84 additions and 8 deletions

View File

@ -13,10 +13,25 @@ On a clean 14.04 machine I will build apache.
DISTRIB_ID=Ubuntu DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04 DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS" DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
``` ```
## Step 0.
We want a recent version of `go` so we install `1.10`. Currently this requires some effort.
```
>sudo add-apt-repository ppa:gophers/archive
>sudo apt-get update
>sudo apt-get install golang-1.10-go
>export PATH=/usr/lib/go-1.10/bin:${PATH}
```
## Step 1. ## Step 1.
@ -25,8 +40,6 @@ Install `gllvm`.
``` ```
>export GOPATH=/vagrant/go >export GOPATH=/vagrant/go
>mkdir -p ${GOPATH}
>go get github.com/SRI-CSL/gllvm/cmd/... >go get github.com/SRI-CSL/gllvm/cmd/...
>export PATH=${GOPATH}/bin:${PATH} >export PATH=${GOPATH}/bin:${PATH}
@ -78,7 +91,61 @@ tightly coupled to the gcc and plugin versions you are using.
Extract the bitcode. Extract the bitcode.
``` ```
>get-bc httpd >get-bc -m httpd
``` ```
The `-m` flag tells the get-bc tool to also write a manifest listing all the bitcode modules
that were linked together to create the `httpd.bc` module.
```
>more httpd.bc.llvm.manifest
/home/vagrant/httpd-2.4.33/.modules.o.bc
/home/vagrant/httpd-2.4.33/.buildmark.o.bc
/home/vagrant/httpd-2.4.33/server/.main.o.bc
/home/vagrant/httpd-2.4.33/server/.vhost.o.bc
/home/vagrant/httpd-2.4.33/server/.util.o.bc
/home/vagrant/httpd-2.4.33/server/.mpm_common.o.bc
/home/vagrant/httpd-2.4.33/server/.util_filter.o.bc
/home/vagrant/httpd-2.4.33/server/.util_pcre.o.bc
/home/vagrant/httpd-2.4.33/server/.exports.o.bc
/home/vagrant/httpd-2.4.33/server/.scoreboard.o.bc
/home/vagrant/httpd-2.4.33/server/.error_bucket.o.bc
/home/vagrant/httpd-2.4.33/server/.protocol.o.bc
/home/vagrant/httpd-2.4.33/server/.core.o.bc
/home/vagrant/httpd-2.4.33/server/.request.o.bc
/home/vagrant/httpd-2.4.33/server/.provider.o.bc
/home/vagrant/httpd-2.4.33/server/.eoc_bucket.o.bc
/home/vagrant/httpd-2.4.33/server/.eor_bucket.o.bc
/home/vagrant/httpd-2.4.33/server/.core_filters.o.bc
/home/vagrant/httpd-2.4.33/server/.util_expr_eval.o.bc
/home/vagrant/httpd-2.4.33/server/.config.o.bc
/home/vagrant/httpd-2.4.33/server/.log.o.bc
/home/vagrant/httpd-2.4.33/server/.util_fcgi.o.bc
/home/vagrant/httpd-2.4.33/server/.util_script.o.bc
/home/vagrant/httpd-2.4.33/server/.util_md5.o.bc
/home/vagrant/httpd-2.4.33/server/.util_cfgtree.o.bc
/home/vagrant/httpd-2.4.33/server/.util_time.o.bc
/home/vagrant/httpd-2.4.33/server/.connection.o.bc
/home/vagrant/httpd-2.4.33/server/.listen.o.bc
/home/vagrant/httpd-2.4.33/server/.util_mutex.o.bc
/home/vagrant/httpd-2.4.33/server/.mpm_unix.o.bc
/home/vagrant/httpd-2.4.33/server/.mpm_fdqueue.o.bc
/home/vagrant/httpd-2.4.33/server/.util_cookies.o.bc
/home/vagrant/httpd-2.4.33/server/.util_debug.o.bc
/home/vagrant/httpd-2.4.33/server/.util_xml.o.bc
/home/vagrant/httpd-2.4.33/server/.util_regex.o.bc
/home/vagrant/httpd-2.4.33/server/.util_expr_parse.o.bc
/home/vagrant/httpd-2.4.33/server/.util_expr_scan.o.bc
/home/vagrant/httpd-2.4.33/modules/core/.mod_so.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.http_core.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.http_protocol.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.http_request.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.http_filters.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.chunk_filter.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.byterange_filter.o.bc
/home/vagrant/httpd-2.4.33/modules/http/.http_etag.o.bc
/home/vagrant/httpd-2.4.33/server/mpm/event/.event.o.bc
/home/vagrant/httpd-2.4.33/os/unix/.unixd.o.bc
```

View File

@ -107,9 +107,14 @@ func init() {
func printEnvironment() { func printEnvironment() {
vars := []string{envpath, envcc, envcxx, envar, envlnk, envcfg, envbc, envlvl, envfile} vars := []string{envpath, envcc, envcxx, envar, envlnk, envcfg, envbc, envlvl, envfile}
LogWrite("\nLiving in this environment:\n\n") informUser("\nLiving in this environment:\n\n")
for _, v := range vars { for _, v := range vars {
LogWrite("%v = %v\n", v, os.Getenv(v)) val, defined := os.LookupEnv(v)
if defined {
informUser("%v = \"%v\"\n", v, val)
} else {
informUser("%v is NOT defined\n", v)
}
} }
} }

View File

@ -212,6 +212,8 @@ func checkExecutable(cmdExecName string, varg string) (success bool, output stri
err = cmd.Run() err = cmd.Run()
success = (err == nil) success = (err == nil)
output = out.String() output = out.String()
LogInfo("checkExecutable: %s %s returned %s\n", cmdExecName, varg, output)
LogInfo("checkExecutable: returning (%s %s %s)\n", success, output, err)
return return
} }
@ -231,7 +233,8 @@ func checkAuxiliaries() bool {
linkerOK, linkerVersion, _ := checkExecutable(linkerName, "-version") linkerOK, linkerVersion, _ := checkExecutable(linkerName, "-version")
if !linkerOK { // iam: 5/8/2018 3.4 llvm-link and llvm-ar return exit status 1 for -version. GO FIGURE.
if !linkerOK && !strings.Contains(linkerVersion, "LLVM") {
informUser("The bitcode linker %s was not found or not executable.\nBetter not try using get-bc!\n", linkerName) informUser("The bitcode linker %s was not found or not executable.\nBetter not try using get-bc!\n", linkerName)
informUser(explainLLVMLINKNAME) informUser(explainLLVMLINKNAME)
} else { } else {
@ -241,7 +244,8 @@ func checkAuxiliaries() bool {
archiverName = filepath.Join(LLVMToolChainBinDir, archiverName) archiverName = filepath.Join(LLVMToolChainBinDir, archiverName)
archiverOK, archiverVersion, _ := checkExecutable(archiverName, "-version") archiverOK, archiverVersion, _ := checkExecutable(archiverName, "-version")
if !archiverOK { // iam: 5/8/2018 3.4 llvm-link and llvm-ar return exit status 1 for -version. GO FIGURE.
if !archiverOK && !strings.Contains(linkerVersion, "LLVM") {
informUser("The bitcode archiver %s was not found or not executable.\nBetter not try using get-bc!\n", archiverName) informUser("The bitcode archiver %s was not found or not executable.\nBetter not try using get-bc!\n", archiverName)
informUser(explainLLVMARNAME) informUser(explainLLVMARNAME)
} else { } else {