Issue 84148
Summary llvm-objdump returns exit code 0 when broken Mach-O is passed
Labels new issue
Assignees
Reporter ligurio
    On POSIX systems, usually non-zero exit code means failure and zero exit code means successful execution.
In 2016 there was a commit "[llvm] r266248 - Start to add real error messages for malformed Mach-O files." [^1] for `llvm-objdump`. This change allows to easily detect broken Mach-O binaries. However, when error is detected `llvm-objdump` returns exit code `0`.

How to reproduce:

```sh
$ file empty.o 
empty.o: DOS executable (block device driver)
$ llvm-objdump --macho --all-headers empty.o 
empty.o: is not an object file
$ echo $?
0
```

`llvm-objdump -v`: Ubuntu LLVM version 18.0.0 

[^1]: https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160411/347289.html
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to