mirror of https://github.com/ipxe/ipxe.git
[build] Fix building on older versions of binutils
Some older versions of binutils have issues with both the use of PROVIDE() and the interpretation of numeric literals within a section description. Work around these older versions by defining the required numeric literals outside of any section description, and by automatically determining whether or not to generate extra space for page tables rather than relying on LDFLAGS. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/45/head
parent
163f8acba0
commit
a4923354e3
|
@ -27,10 +27,18 @@ SECTIONS {
|
|||
PROVIDE ( _max_align = 16 );
|
||||
|
||||
/*
|
||||
* Default to not generating space for page tables
|
||||
* Values used in page table calculations
|
||||
*
|
||||
* On older versions of ld (without the SANE_EXPR feature),
|
||||
* numeric literals within a section description tend to be
|
||||
* interpreted as section-relative symbols.
|
||||
*
|
||||
*/
|
||||
PROVIDE ( _use_page_tables = 0 );
|
||||
_page_size = 4096;
|
||||
_page_size_1 = ( _page_size - 1 );
|
||||
_pte_size = 8;
|
||||
_pte_count = ( _page_size / _pte_size );
|
||||
_pte_count_1 = ( _pte_count - 1 );
|
||||
|
||||
/*
|
||||
* Allow decompressor to require a minimum amount of temporary stack
|
||||
|
@ -133,12 +141,18 @@ SECTIONS {
|
|||
*(COMMON)
|
||||
*(.stack)
|
||||
*(.stack.*)
|
||||
_pages = .;
|
||||
*(.pages)
|
||||
*(.pages.*)
|
||||
_textdata_paged_len = ABSOLUTE ( . - _textdata );
|
||||
_textdata_ptes = ABSOLUTE ( ( _textdata_paged_len + 4095 ) / 4096 );
|
||||
_textdata_pdes = ABSOLUTE ( ( _textdata_ptes + 511 ) / 512 );
|
||||
. += ( _use_page_tables ? ( _textdata_pdes * 4096 ) : 0 );
|
||||
_use_page_tables = ABSOLUTE ( . ) - ABSOLUTE ( _pages );
|
||||
_textdata_paged_len =
|
||||
ABSOLUTE ( ABSOLUTE ( . ) - ABSOLUTE ( _textdata ) );
|
||||
_textdata_ptes =
|
||||
ABSOLUTE ( ( _textdata_paged_len + _page_size_1 ) / _page_size );
|
||||
_textdata_pdes =
|
||||
ABSOLUTE ( ( _textdata_ptes + _pte_count_1 ) / _pte_count );
|
||||
. += ( _use_page_tables ? ( _textdata_pdes * _page_size ) : 0 );
|
||||
_epages = .;
|
||||
_etextdata = .;
|
||||
}
|
||||
_textdata_filesz = ABSOLUTE ( _mtextdata ) - ABSOLUTE ( _textdata );
|
||||
|
|
|
@ -9,10 +9,6 @@ LDFLAGS += --section-start=.textdata=0xffffffffeb000000
|
|||
#
|
||||
CFLAGS += -mno-red-zone
|
||||
|
||||
# Generate extra space for page tables to cover .textdata
|
||||
#
|
||||
LDFLAGS += --defsym=_use_page_tables=1
|
||||
|
||||
# Include generic BIOS Makefile
|
||||
#
|
||||
MAKEDEPS += arch/x86/Makefile.pcbios
|
||||
|
|
Loading…
Reference in New Issue