isLLVMObjdump accepts a string with path to an objdump binary, and returns a boolean indicating if the given binary is an LLVM objdump binary of an acceptable version.
(output string)
| 207 | // and returns a boolean indicating if the given binary is an LLVM |
| 208 | // objdump binary of an acceptable version. |
| 209 | func isLLVMObjdump(output string) bool { |
| 210 | fields := objdumpLLVMVerRE.FindStringSubmatch(output) |
| 211 | if len(fields) != 5 { |
| 212 | return false |
| 213 | } |
| 214 | if fields[4] == "trunk" { |
| 215 | return true |
| 216 | } |
| 217 | verMajor, err := strconv.Atoi(fields[1]) |
| 218 | if err != nil { |
| 219 | return false |
| 220 | } |
| 221 | verPatch, err := strconv.Atoi(fields[3]) |
| 222 | if err != nil { |
| 223 | return false |
| 224 | } |
| 225 | if runtime.GOOS == "linux" && verMajor >= 8 { |
| 226 | // Ensure LLVM objdump is at least version 8.0 on Linux. |
| 227 | // Some flags, like --demangle, and double dashes for options are |
| 228 | // not supported by previous versions. |
| 229 | return true |
| 230 | } |
| 231 | if runtime.GOOS == "darwin" { |
| 232 | // Ensure LLVM objdump is at least version 10.0.1 on MacOS. |
| 233 | return verMajor > 10 || (verMajor == 10 && verPatch >= 1) |
| 234 | } |
| 235 | return false |
| 236 | } |
| 237 | |
| 238 | // isBuObjdump accepts a string with path to an objdump binary, |
| 239 | // and returns a boolean indicating if the given binary is a GNU |
no outgoing calls
searching dependent graphs…