Dear SeaBIOS folks,
just a note, that due to a regression in GCC 6 in Debian Sid/unstable [1] the latest master branch [2] does not build.
``` $ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1 ```
It builds fine with gcc-4.9 and gcc-5.
``` $ make CC=gcc-4.9 -j $ make CC=gcc-5 -j ```
There is gcc-6 6.2.0-9 out already [3], but it’s not available over the mirrors yet.
Thanks,
Paul
[1] http://metadata.ftp-master.debian.org/changelogs/main/g/gcc-6/gcc-6_6.2.0-7_... gcc (Debian 6.2.0-7) 6.2.0 20161018 [2] commit 00b0402 (docs: fix various typos and inconsistency) [3] http://metadata.ftp-master.debian.org/changelogs/main/g/gcc-6/gcc-6_6.2.0-9_...
Dear SeaBIOS folks,
Am Donnerstag, den 20.10.2016, 23:58 +0200 schrieb Paul Menzel:
just a note, that due to a regression in GCC 6 in Debian Sid/unstable [1] the latest master branch [2] does not build.
$ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1
It builds fine with gcc-4.9 and gcc-5.
$ make CC=gcc-4.9 -j $ make CC=gcc-5 -j
There is gcc-6 6.2.0-9 out already [3], but it’s not available over the mirrors yet.
And unfortunately the build failure still happens with that version.
In the mean time, there is a separate bug report for this issue for SeaBIOS that it fails to build from source in Debian [4].
I successfully build SeaBIOS with GCC 6-20161020, so it’s a Debian packaging issue. Probably due to the change below.
* Configure with --enable-default-pie and pass -z now when pie is enabled; on amd64 arm64 armel armhf i386 mips mipsel mips64el ppc64el s390x. Closes: #835148 [6].
I added `no-pic` to the COMMON_CFLAGS, and that fixed the build issue for me. I don’t understand, what that has to do with PIE though.
Thanks,
Paul
[1] http://metadata.ftp-master.debian.org/changelogs/main/g/gcc-6/gcc-6_6.2.0-7_... gcc (Debian 6.2.0-7) 6.2.0 20161018 [2] commit 00b0402 (docs: fix various typos and inconsistency) [3] http://metadata.ftp-master.debian.org/changelogs/main/g/gcc-6/gcc-6_6.2.0-9_...
[4] https://bugs.debian.org/841546 seabios: FTBFS: src/stacks.c:635: Error: found '(', expected: ')' [5] ftp://gcc.gnu.org/pub/gcc/snapshots/6-20161020/ [6] https://bugs.debian.org/835148
Date: Sun, 23 Oct 2016 18:56:28 +0200
Debian enables PIE hardening flags by default since package gcc-6 6.2.0-7 [1].
With that change, SeaBIOS fails to build with the error below [2][3].
``` $ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1 ```
Passing `no-pic` to the compiler fixes this issue.
[1] https://bugs.debian.org/835148 [2] https://bugs.debian.org/841546 [3] https://www.seabios.org/pipermail/seabios/2016-October/010980.html "Build failure with GCC 6 from Debian Sid/unstable"
Signed-off-by: Paul Menzel paulepanter@users.sourceforge.net --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 41bfcf4..4a20631 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,8 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \ -minline-all-stringops -fomit-frame-pointer \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ - -ffunction-sections -fdata-sections -fno-common -fno-merge-constants + -ffunction-sections -fdata-sections -fno-common -fno-merge-constants \ + -fno-pic COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
Dear SeaBIOS folks,
Am Sonntag, den 23.10.2016, 20:57 +0200 schrieb Paul Menzel:
Date: Sun, 23 Oct 2016 18:56:28 +0200
Debian enables PIE hardening flags by default since package gcc-6 6.2.0-7 [1].
With that change, SeaBIOS fails to build with the error below [2][3].
$ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1
Passing `no-pic` to the compiler fixes this issue.
[1] https://bugs.debian.org/835148 [2] https://bugs.debian.org/841546 [3] https://www.seabios.org/pipermail/seabios/2016-October/010980.html "Build failure with GCC 6 from Debian Sid/unstable"
Signed-off-by: Paul Menzel paulepanter@users.sourceforge.net
Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 41bfcf4..4a20631 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,8 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \ -minline-all-stringops -fomit-frame-pointer \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \
- -ffunction-sections -fdata-sections -fno-common -fno-merge-constants
- -ffunction-sections -fdata-sections -fno-common -fno-merge-constants \
-fno-pic
COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
Using
``` COMMONCFLAGS += $(call cc-option,$(CC),-fno-pic,) ```
did not work for whatever reason.
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
Thanks,
Paul
On Sun, Oct 23, 2016 at 08:57:28PM +0200, Paul Menzel wrote:
Date: Sun, 23 Oct 2016 18:56:28 +0200
Debian enables PIE hardening flags by default since package gcc-6 6.2.0-7 [1].
With that change, SeaBIOS fails to build with the error below [2][3].
$ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1
I just built and compiled gcc v6.2.0 and it compiles seabios fine. So, this looks like a debian bug, and I think it should be filed there.
Passing `no-pic` to the compiler fixes this issue.
I don't see where pic (position independent code) is related. My guess is that it just causes random code changes which then doesn't tickle the underlying issue.
Does adding '-fno-pie' help?
-Kevin
Dear Kevin,
On 10/25/16 17:21, Kevin O'Connor wrote:
On Sun, Oct 23, 2016 at 08:57:28PM +0200, Paul Menzel wrote:
Date: Sun, 23 Oct 2016 18:56:28 +0200
Debian enables PIE hardening flags by default since package gcc-6 6.2.0-7 [1].
With that change, SeaBIOS fails to build with the error below [2][3].
$ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1
I just built and compiled gcc v6.2.0 and it compiles seabios fine. So, this looks like a debian bug, and I think it should be filed there.
Yes, that’s exactly what I wrote.
Debian decided to enable PIE hardening flags by default in the GCC package.
Passing `no-pic` to the compiler fixes this issue.
I don't see where pic (position independent code) is related. My guess is that it just causes random code changes which then doesn't tickle the underlying issue.
Does adding '-fno-pie' help?
Isn’t that already used due to `COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)` in the `Makefile`?
I’ll try it anyway.
Thanks,
Paul
Dear Kevin,
On 10/25/16 17:27, Paul Menzel wrote:
On 10/25/16 17:21, Kevin O'Connor wrote:
On Sun, Oct 23, 2016 at 08:57:28PM +0200, Paul Menzel wrote:
Date: Sun, 23 Oct 2016 18:56:28 +0200
Debian enables PIE hardening flags by default since package gcc-6 6.2.0-7 [1].
With that change, SeaBIOS fails to build with the error below [2][3].
$ make Build Kconfig config file Compile checking out/src/misc.o Compile checking out/src/stacks.o src/stacks.c: Assembler messages: src/stacks.c:567: Error: found '(', expected: ')' src/stacks.c:567: Error: junk `(%ebp))' after expression src/stacks.c:568: Warning: indirect call without `*' Makefile:133: die Regel für Ziel „out/src/stacks.o“ scheiterte make: *** [out/src/stacks.o] Fehler 1
I just built and compiled gcc v6.2.0 and it compiles seabios fine. So, this looks like a debian bug, and I think it should be filed there.
Yes, that’s exactly what I wrote.
Debian decided to enable PIE hardening flags by default in the GCC package.
Passing `no-pic` to the compiler fixes this issue.
I don't see where pic (position independent code) is related. My guess is that it just causes random code changes which then doesn't tickle the underlying issue.
Does adding '-fno-pie' help?
Isn’t that already used due to `COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)` in the `Makefile`?
I’ll try it anyway.
That also worked. Should I sent an updated patch?
Kind regards,
Paul
On Tue, Oct 25, 2016 at 06:08:08PM +0200, Paul Menzel wrote:
On 10/25/16 17:27, Paul Menzel wrote:
On 10/25/16 17:21, Kevin O'Connor wrote:
Does adding '-fno-pie' help?
Isn’t that already used due to `COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)` in the `Makefile`?
I’ll try it anyway.
That also worked. Should I sent an updated patch?
Does the patch below work?
-Kevin
commit 589fe2803b110014a84dee2056f1e2fec744d2e6 Author: Kevin O'Connor kevin@koconnor.net Date: Tue Oct 25 12:09:41 2016 -0400
build: Add -fno-pie to the gcc flags when available
Signed-off-by: Kevin O'Connor kevin@koconnor.net
diff --git a/Makefile b/Makefile index 1916ecf..3b94ee0 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,7 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ -ffunction-sections -fdata-sections -fno-common -fno-merge-constants COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) +COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) COMMONCFLAGS += $(call cc-option,$(CC),-fstack-check=no,)
Dear Kevin,
On 10/25/16 18:14, Kevin O'Connor wrote:
On Tue, Oct 25, 2016 at 06:08:08PM +0200, Paul Menzel wrote:
On 10/25/16 17:27, Paul Menzel wrote:
On 10/25/16 17:21, Kevin O'Connor wrote:
Does adding '-fno-pie' help?
Isn’t that already used due to `COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)` in the `Makefile`?
I’ll try it anyway.
That also worked. Should I sent an updated patch?
Does the patch below work?
-Kevin
commit 589fe2803b110014a84dee2056f1e2fec744d2e6 Author: Kevin O'Connor kevin@koconnor.net Date: Tue Oct 25 12:09:41 2016 -0400
build: Add -fno-pie to the gcc flags when available Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/Makefile b/Makefile index 1916ecf..3b94ee0 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,7 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ -ffunction-sections -fdata-sections -fno-common -fno-merge-constants COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) +COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) COMMONCFLAGS += $(call cc-option,$(CC),-fstack-check=no,)
Yes, I was just about to send that.
Do you know, why SeaBIOS won’t build without it?
Kind regards,
Paul
On Tue, Oct 25, 2016 at 06:20:46PM +0200, Paul Menzel wrote:
On 10/25/16 18:14, Kevin O'Connor wrote:
On Tue, Oct 25, 2016 at 06:08:08PM +0200, Paul Menzel wrote:
On 10/25/16 17:27, Paul Menzel wrote:
On 10/25/16 17:21, Kevin O'Connor wrote:
Does adding '-fno-pie' help?
Isn’t that already used due to `COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)` in the `Makefile`?
I’ll try it anyway.
That also worked. Should I sent an updated patch?
Does the patch below work?
Yes, I was just about to send that.
Do you know, why SeaBIOS won’t build without it?
I don't know the specifics, but in general the ASLR (address space layout randomization) stuff assumes specific OS properties that aren't valid when running on bare metal. They certainly aren't going to work when the processor is in 16bit mode.
-Kevin
25.10.2016 19:14, Kevin O'Connor wrote:
On Tue, Oct 25, 2016 at 06:08:08PM +0200, Paul Menzel wrote:
Does the patch below work?
index 1916ecf..3b94ee0 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,7 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ -ffunction-sections -fdata-sections -fno-common -fno-merge-constants COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) +COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,)
Hm. Are there really two different options? Maybe the first is just a spelling mistake?
Thanks,
/mjt
On Tue, Oct 25, 2016 at 08:04:34PM +0300, Michael Tokarev wrote:
25.10.2016 19:14, Kevin O'Connor wrote:
On Tue, Oct 25, 2016 at 06:08:08PM +0200, Paul Menzel wrote:
Does the patch below work?
index 1916ecf..3b94ee0 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,7 @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ -ffunction-sections -fdata-sections -fno-common -fno-merge-constants COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) +COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,)
Hm. Are there really two different options? Maybe the first is just a spelling mistake?
The first was some ancient distribution that introduced its own custom flag. It should probably be removed in some future release.
-Kevin