summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/scripts
diff options
context:
space:
mode:
authorMichael Brown2013-07-16 00:08:50 +0200
committerMichael Brown2013-07-16 00:50:54 +0200
commitca319873bf43d5d955cc3d8770b5b2415798907d (patch)
tree8168679666b92de3de4ab5f4453c8383b22bc103 /src/arch/i386/scripts
parent[legal] Add missing FILE_LICENCE declarations (diff)
downloadipxe-ca319873bf43d5d955cc3d8770b5b2415798907d.tar.gz
ipxe-ca319873bf43d5d955cc3d8770b5b2415798907d.tar.xz
ipxe-ca319873bf43d5d955cc3d8770b5b2415798907d.zip
[build] Fix %.licence build target
Our use of --gc-sections causes the linker to discard the symbols defined by FILE_LICENCE(), meaning that the resulting licence determination is incomplete. We must use the KEEP() directive in the linker script to force the linker to not discard the licence symbols. Using KEEP(*(COMMON)) would be undesirable, since there are some symbols in COMMON which we may wish to discard. Fix by placing symbols defined by PROVIDE_SYMBOL() (which is used by FILE_LICENCE()) into a special ".provided" section, which we then mark with KEEP(). All such symbols are zero-length, so there is no cost in terms of the final binary size. Since the symbols are no longer in COMMON, the linker will reject symbols with the same name coming from multiple objects. We therefore append the object name to the licence symbol, to ensure that it is unique. Reported-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/scripts')
-rw-r--r--src/arch/i386/scripts/i386-kir.lds2
-rw-r--r--src/arch/i386/scripts/i386.lds2
-rw-r--r--src/arch/i386/scripts/linux.lds2
3 files changed, 6 insertions, 0 deletions
diff --git a/src/arch/i386/scripts/i386-kir.lds b/src/arch/i386/scripts/i386-kir.lds
index 338d6ee8..66bf804e 100644
--- a/src/arch/i386/scripts/i386-kir.lds
+++ b/src/arch/i386/scripts/i386-kir.lds
@@ -98,6 +98,8 @@ SECTIONS {
*(.data)
*(.data.*)
KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */
+ KEEP(*(.provided))
+ KEEP(*(.provided.*))
_edata16_progbits = .;
}
.bss16 : AT ( _data16_load_offset + __bss16 ) {
diff --git a/src/arch/i386/scripts/i386.lds b/src/arch/i386/scripts/i386.lds
index fb763656..98f95cb2 100644
--- a/src/arch/i386/scripts/i386.lds
+++ b/src/arch/i386/scripts/i386.lds
@@ -109,6 +109,8 @@ SECTIONS {
*(.data)
*(.data.*)
KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */
+ KEEP(*(.provided))
+ KEEP(*(.provided.*))
_mtextdata = .;
} .bss.textdata (NOLOAD) : AT ( _end_lma ) {
*(.bss)
diff --git a/src/arch/i386/scripts/linux.lds b/src/arch/i386/scripts/linux.lds
index 64c9b97f..9f2eeaf3 100644
--- a/src/arch/i386/scripts/linux.lds
+++ b/src/arch/i386/scripts/linux.lds
@@ -53,6 +53,8 @@ SECTIONS {
*(.data)
*(.data.*)
KEEP(*(SORT(.tbl.*)))
+ KEEP(*(.provided))
+ KEEP(*(.provided.*))
_edata = .;
}