freebsd-dev/stand/i386
Dimitry Andric a2037dba7e Link stand/i386 components using a linker script
LLD 10.0.0 changed the behavior of the -Ttext option, so that using
-Ttext=0x0 now causes linking of the loaders to fail with:

ld: error: output file too large: 18446744073707016908 bytes

I reported this in https://bugs.llvm.org/show_bug.cgi?id=44715, and
initially reverted the upstream change in r357259 to work around it.

However, after some discussion with Fangrui Song in the upstream ticket,
I think we can classify this as an unfortunate interaction between using
-Ttext=0 in combination with --no-rosegment.  (We added the latter
in r332090, because btxld does not correctly handle input with more
than 2 PT_LOAD segments.)

Fangrui suggested to use a linker script instead, and Warner was already
attempting this in r305353, but had to revert it due to "crypto-using
boot problems" (not sure what those were :).

This review updates the stand/i386/boot.ldscript to handle more
sections, inserts some symbols like _edata and such that we use in
libsa, and also discards any .interp section.

It uses ORG which is defined on the linker command line using
--defsym ORG=value to set the start of all the sections.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D23952
2020-03-04 21:01:22 +00:00
..
boot0 Centralize several variables. 2018-02-02 06:32:26 +00:00
boot0sio
boot2 Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
btx btx: rename .s files to .S to use Clang IAS 2018-11-26 19:14:33 +00:00
cdboot stand: remove CLANG_NO_IAS from cdboot 2019-08-15 17:32:39 +00:00
common Use symbolic names for int13 calls 2019-12-16 21:52:12 +00:00
gptboot Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
gptzfsboot Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
isoboot Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
libfirewire biospci_write_config args were backwards 2019-01-08 20:01:56 +00:00
libi386 Move smbios.c to libsa. 2020-02-20 00:46:22 +00:00
loader Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
loader_4th Update Makefile.depend files 2019-12-11 17:37:53 +00:00
loader_lua Create a loader for each interpreter for x86 BIOS and all EFI 2018-08-14 18:44:41 +00:00
loader_simp Create a loader for each interpreter for x86 BIOS and all EFI 2018-08-14 18:44:41 +00:00
mbr stand/i386: rename .s to .S to use Clang IAS 2018-12-03 19:16:34 +00:00
pmbr stand/i386: rename .s to .S to use Clang IAS 2018-12-03 19:16:34 +00:00
pxeldr stand: remove CLANG_NO_IAS from pxeldr 2019-08-15 17:59:22 +00:00
zfsboot Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
boot.ldscript Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00
Makefile Remove kgzip and kgzldr. 2019-05-24 05:34:21 +00:00
Makefile.inc Link stand/i386 components using a linker script 2020-03-04 21:01:22 +00:00