rombios: prevent building with PIC
PATCH 1/1 rombios: prevent building with PIC
If the default compiler silently defaults to to -fPIC/-fPIE building rombios fails:
ld -melf_i386 -s -r 32bitbios.o tcgbios/tcgbiosext.o util.o pmm.o -o 32bitbios_all.o There are undefined symbols in the BIOS:
U _GLOBAL_OFFSET_TABLE_
make[10]: *** [Makefile:26: 32bitbios_all.o] Error 11
Prevent the failure by enforcing non-PIC mode.
---
build tested with staging-4.9.
PIE is the default now in openSUSE Tumbleweed:
https://lists.opensuse.org/opensuse-factory/2017-06/msg00403.html
tools/firmware/rombios/32bit/Makefile | 2 +- tools/firmware/rombios/32bit/tcgbios/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/firmware/rombios/32bit/Makefile +1 -1
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk TARGET = 32bitbios_flat.h -CFLAGS += $(CFLAGS_xeninclude) -I.. -I../../../libacpi +CFLAGS += $(CFLAGS_xeninclude) -I.. -I../../../libacpi -fno-pic SUBDIRS = tcgbios
tools/firmware/rombios/32bit/tcgbios/Makefile +1 -1
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk TARGET = tcgbiosext.o -CFLAGS += $(CFLAGS_xeninclude) -I.. -I../.. -I../../../../libacpi +CFLAGS += $(CFLAGS_xeninclude) -I.. -I../.. -I../../../../libacpi -fno-pic .PHONY: all all: $(TARGET)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 11 lines · Olaf Hering
If the default compiler silently defaults to to -fPIC/-fPIE building rombios fails:
ld -melf_i386 -s -r 32bitbios.o
tcgbios/tcgbiosext.outil.o pmm.o -o 32bitbios_all.o There are undefined symbols in the BIOS:
U _GLOBAL_OFFSET_TABLE_
make[10]: *** [Makefile:26: 32bitbios_all.o] Error 11Prevent the failure by enforcing non-PIC mode.
Signed-off-by Olaf Hering <[email protected]>
Do you need to check if the compiler supports -fno-pic?
I know not every version of gcc support -fno-pie, but I'm not sure about -fno-pic. In any case, there is already something in our build system to deal with testing gcc options, which would be useful to you.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line · Wei Liu
Do you need to check if the compiler supports -fno-pic?
In my testing gcc-4.3 and 4.5 know about this option.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Olaf Hering
Quoted 1 line · Wei Liu
Do you need to check if the compiler supports -fno-pic?
In my testing gcc-4.3 and 4.5 know about this option.
We support >=4.1. Please check those as well.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line · Wei Liu
We support >=4.1. Please check those as well.
According to the PDF manuals at https://gcc.gnu.org/onlinedocs/ a "-fno-foo" is mentioned, so I think -fno-pic is recognized. I will see if I find a copy of SLE10 to verify with 4.1.2.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line · Wei Liu
We support >=4.1. Please check those as well.
Yes, 4.1.2 works as well.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
tools/firmware/rombios/32bit/Makefile include $(XEN_ROOT)/tools/firmware/Rules.mk · line 6
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Olaf Hering <[email protected]> 06/23/17 7:27 PM >>>
tools/firmware/rombios/32bit/Makefile +0
-0@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/firmware/Rules.mkTARGET =
32bitbios_flat.htools/firmware/rombios/32bit/Makefile +1
-1-CFLAGS += $(CFLAGS_xeninclude) -I.. -I../../../libacpi +CFLAGS += $(CFLAGS_xeninclude) -I.. -I../../../libacpi -fno-pic
In the description you also talk about PIE, but you deal with PIC only here. Is that intentional? If so, please say why in the description.
Also, as to the Cc list - maintainership of rombios/ has recently changed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Am Mon, 26 Jun 2017 00:30:50 -0600
schrieb "Jan Beulich" <[email protected]>:
Quoted 1 line
In the description you also talk about PIE, but you deal with PIC only here. Is that intentional? If so, please say why in the description.
Thats what the URL says. Unclear what the connection between -fpic and -fPIE (?) is.
Quoted 1 line
Also, as to the Cc list - maintainership of rombios/ has recently changed.
Thats what --to-cmd=scripts/getmaintainer.pl gives me.
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Olaf Hering <[email protected]> 06/26/17 8:47 AM >>>
Am Mon, 26 Jun 2017 00:30:50 -0600
schrieb "Jan Beulich" <[email protected]>:Quoted 1 line
In the description you also talk about PIE, but you deal with PIC only here. Is that intentional? If so, please say why in the description.
Thats what the URL says. Unclear what the connection between -fpic and -fPIE (?) is.
Unlike PIC, PIE was introduced later, yet might still be defaulted to. Hence it may be necessary to also deal with that, instead of just addressing one half. Yet it would mean detecting PIE support in the compiler, other than PIC, which - as you've verified - is available everywhere we care about.
Quoted 3 lines
Quoted 1 line
Also, as to the Cc list - maintainership of rombios/ has recently changed.
Thats what --to-cmd=scripts/getmaintainer.pl gives me.
In the unstable staging tree? That would seem wrong.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Am Mon, 26 Jun 2017 05:55:17 -0600
schrieb "Jan Beulich" <[email protected]>:
Quoted 1 line
Unlike PIC, PIE was introduced later, yet might still be defaulted to. Hence it may be necessary to also deal with that, instead of just addressing one half.
There is now v2 which uses cc-option-add
Quoted 1 line
In the unstable staging tree? That would seem wrong.
I ran git send-email from staging-4.9. Sorry for that.
Perhaps MAINTAINER changes should be merged unconditional into staging-x.y
Olaf
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel