Skip to contentSkip to conversation

rombios: prevent building with PIC/PIE

PATCH In review Olaf Hering 3 participants 4 messages Jun 26, 2017 – Aug 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rombios: prevent building with PIC/PIE

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/PIE mode.

---

build tested with staging-4.9/staging.

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, 4 insertions(+)
tools/firmware/rombios/32bit/Makefile +2 -0
index b0583c93df..28c15444ae 100644
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk
 TARGET = 32bitbios_flat.h
 
 CFLAGS += $(CFLAGS_xeninclude) -I.. -I../../../libacpi
+$(call cc-option-add,CFLAGS,CC,-fno-pic)
+$(call cc-option-add,CFLAGS,CC,-fno-PIE)
 
 SUBDIRS = tcgbios
 
tools/firmware/rombios/32bit/tcgbios/Makefile +2 -0
index f87d13020f..5cff4efc60 100644
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk
 TARGET  = tcgbiosext.o
 
 CFLAGS += $(CFLAGS_xeninclude) -I.. -I../.. -I../../../../libacpi
+$(call cc-option-add,CFLAGS,CC,-fno-pic)
+$(call cc-option-add,CFLAGS,CC,-fno-PIE)
 
 .PHONY: all
 all: $(TARGET)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v2 1/1
#1 lore raw
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.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/PIE mode.

Quoted 29 lines

---

build tested with staging-4.9/staging.

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, 4 insertions(+)
tools/firmware/rombios/32bit/Makefile +2 -0
index b0583c93df..28c15444ae 100644
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk
 TARGET = 32bitbios_flat.h
 
 CFLAGS += $(CFLAGS_xeninclude) -I.. -I../../../libacpi
+$(call cc-option-add,CFLAGS,CC,-fno-pic)
+$(call cc-option-add,CFLAGS,CC,-fno-PIE)
 
 SUBDIRS = tcgbios
 
tools/firmware/rombios/32bit/tcgbios/Makefile +0 -0
index f87d13020f..5cff4efc60 100644

tools/firmware/rombios/32bit/tcgbios/Makefile include $(XEN_ROOT)/tools/firmware/Rules.mk · line 11

Quoted 8 lines
tools/firmware/rombios/32bit/tcgbios/Makefile +2 -0
@@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk
 TARGET  = tcgbiosext.o
 
 CFLAGS += $(CFLAGS_xeninclude) -I.. -I../.. -I../../../../libacpi
+$(call cc-option-add,CFLAGS,CC,-fno-pic)
+$(call cc-option-add,CFLAGS,CC,-fno-PIE)
 
 .PHONY: all
 all: $(TARGET)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 9 lines · Andrew Cooper
Quoted 8 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.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

Quoted 4 lines
Quoted 3 lines

Prevent the failure by enforcing non-PIC/PIE mode.

Committed, thanks.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Andrew Cooper
Quoted 8 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.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

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

Prevent the failure by enforcing non-PIC/PIE mode.

Committed, thanks.

This needs to be backported at least to 4.8 and 4.9; sounds like maybe all supported versions as well?

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel