optionrom: fix compilation with mingw docker target
commit9d4cd7b4ed413a1371997ce74da39900b2a8473b
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 9 Aug 2016 20:50:40 +0000 (9 22:50 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 9 Aug 2016 20:57:36 +0000 (9 22:57 +0200)
tree6e4865a2cb57b9ad3e03fc7ad6b5b9d5c3b2c64e
parentb0e8f5cadcce7c1e2047e1e2c96f827a26171f58
optionrom: fix compilation with mingw docker target

Two fixes are needed.  First, mingw does not have -D_FORTIFY_SOURCE,
hence --enable-debug disables optimization.  This is not acceptable
for ROMs, which should override CFLAGS to force inclusion of -O2.

Second, PE stores global constructors and destructors using the
following linker script snippet:

     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0);
     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*));  LONG (0);

The LONG directives cause the .img files to be 16 bytes too large;
the recently added check to signrom.py catches this.  To fix this,
replace -T and -e options with a linker script.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pc-bios/optionrom/Makefile
pc-bios/optionrom/flat.lds [new file with mode: 0644]