-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POWERPC64*] llvm12 and later produces broken binaries on FreeBSD #50932
Comments
assigned to @adalava |
The same occurs with clang/LLVM built from sources (tested main branch at 2c5c06c). |
During my tests, a working binary is produced when -fstack-protector-strong is removed. |
0x10010eb4 <caph_limit_stream> addis r2,r12,2
|
objdump output with clang11 and clang12 |
I meant "pkg install llvm12" ;-) |
An alternative test program that doesn't rely on FreeBSD libraries is: int main(int argc, char *argv[]) build parameters: |
Bisect points to commit 2518433 |
llvm12 FreeBSD in-tree fix |
Are you going to submit this fix via phabricator? |
Just submitted it as https://reviews.llvm.org/D109090 I'm not sure who should review it. Feel free to edit it if you wish. |
The commit https://reviews.llvm.org/rG1cb9f37a17ab528e53d38c790c1bc44a087d2a50 fixed the problem on FreeBSD/powerpc64, however caused a regression on FreeBSD/amd64 freestanding objects used in kernel. It seems like there's a problem somewhere else (check discussion on https://reviews.llvm.org/D109090). To resolve the regression the patch should be amended to restrict the logic to PPC64 only, but more investigation is still required. |
|
mentioned in issue #51489 |
Adjust logic of 1cb9f37 to match freebsd/freebsd-src@9a4d48a645a7a. D113443 is the original attempt to bring this FreeBSD patch to llvm-project, but it never landed. This change is required to build FreeBSD kernel modules with -fstack-protector using a standard LLVM toolchain. The FreeBSD kernel loader does not handle R_X86_64_REX_GOTPCRELX relocations. Fixes llvm#50932.
Adjust logic of 1cb9f37 to match freebsd/freebsd-src@9a4d48a645a7a. D113443 is the original attempt to bring this FreeBSD patch to llvm-project, but it never landed. This change is required to build FreeBSD kernel modules with -fstack-protector using a standard LLVM toolchain. The FreeBSD kernel loader does not handle R_X86_64_REX_GOTPCRELX relocations. Fixes llvm#50932.
Adjust logic of 1cb9f37 to match freebsd/freebsd-src@9a4d48a645a7a. D113443 is the original attempt to bring this FreeBSD patch to llvm-project, but it never landed. This change is required to build FreeBSD kernel modules with -fstack-protector using a standard LLVM toolchain. The FreeBSD kernel loader does not handle R_X86_64_REX_GOTPCRELX relocations. Fixes #50932.
Extended Description
LLVM12 and later (tested main branch at 2c5c06c) produces broken binaries on FreeBSD 13 for powerpc64 and powerpc64le. The binaries will crash with segmentation.
Steps to reproduce using FreeBSD 13 RELEASE ISO:
#include <capsicum_helpers.h>
#include <err.h>
int
main(int argc, char *argv[])
{
}
clang12 -O2 -g echo_crash.c -o echo_crash.good
clang12 -O2 -g -fstack-protector-strong echo_crash.c -o echo_crash.bad
./echo_crash.good: will produce no output and return normally.
./echo_crash.bad: Segmentation Fault
The text was updated successfully, but these errors were encountered: