bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/29998] ld terminated with signal 11 [Segmentation fault] under m


From: medhefgo at web dot de
Subject: [Bug ld/29998] ld terminated with signal 11 [Segmentation fault] under mingw with LTO
Date: Tue, 24 Jan 2023 17:59:16 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29998

--- Comment #18 from Jan Janssen <medhefgo at web dot de> ---
Compilation works now and the binary will run, but I get a miscompilation(?)
wrt popcount builtin.

Both cases are based on https://github.com/systemd/systemd/pull/26097, where I
originally encountered them, btw.

$ cat test1.c
void test1() {}
$ cat test2.c
void test1(); static void test2() { test1(); }
$ cat test3.c 
int run(void) {
        volatile unsigned i = 4278190080;
        return __builtin_popcount(i);
}
$ rm -f test.exe libtest.a test[123].o
$ x86_64-w64-mingw32-gcc -c -flto test1.c test2.c test3.c
$ x86_64-w64-mingw32-gcc-ar csrDT libtest.a test1.o
$ x86_64-w64-mingw32-gcc -o test.exe -flto -nostdlib test2.o test3.o libtest.a
-lgcc

When I run the above build steps (with your path applied), they produce the
same assembly for run(), except for this line:

   14000102b:   e8 00 00 00 00          call   140001030 <run+0x1c>

vs this without -flto:

   140001037:   e8 24 00 00 00          call   140001060 <__popcountdi2>

The lto build doesn't even include popcount and the EFI binary either produces
a page fault or division error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]