forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: avoid incremental linking with -gc
The AArch64 linkers seems to have occasional problems with incremental linking (-i) in combination with garbage collect of sections (-gc). The way we're organizing the layout of the binary used for paging depends on -gc to build the different dependency trees for unpaged and initialization code. The problem in the linker is tracked in https://bugs.linaro.org/show_bug.cgi?id=3006 and https://sourceware.org/bugzilla/show_bug.cgi?id=21524 The problem typically manifests itself by: aarch64-toolchain/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: BFD (Linaro_Binutils-2017.02) 2.27.0.20161019 assertion fail /home/tcwg-buildslave/workspace/tcwg-make-release/label/docker-trusty-amd64-tcwg-build/target/aarch64-linux-gnu/snapshots/binutils-gdb.git~linaro_binutils-2_27-branch/bfd/elflink.c:8380 core/arch/arm/kernel/link.mk:90: recipe for target 'out/arm-plat-vexpress/core/init.o' failed make: *** [out/arm-plat-vexpress/core/init.o] Error 1 With this patch we replace the incremental linking with a full link using a special link script. With a full link we can't have undefined symbols so some dummy symbols are provided by the link script when some object files are skipped when reducing the dependency tree. To completely get rid of those dummy symbols the script that gathers the sections is replaced by a python script that skips listed sections (if provided). In terms of features in the resulting binary, nothing is changed in this commit. Reviewed-by: Volodymyr Babchuk <[email protected]> Acked-by: Jerome Forissier <[email protected]> Signed-off-by: Jens Wiklander <[email protected]>
- Loading branch information
1 parent
ce0d8e2
commit 5976a0a
Showing
6 changed files
with
168 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright (c) 2017, Linaro Limited | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
SECTIONS | ||
{ | ||
/* | ||
* This seems to make the ARMv7 linker happy with regards to glue_7 | ||
* sections etc. | ||
*/ | ||
..dummy : { } | ||
} | ||
|
||
__asan_shadow_end = .; | ||
__asan_shadow_start = .; | ||
__bss_end = .; | ||
__bss_start = .; | ||
__ctor_end = .; | ||
__ctor_list = .; | ||
__data_end = .; | ||
__early_bss_end = .; | ||
__early_bss_start = .; | ||
__end = .; | ||
__end_phys_mem_map_section = .; | ||
__end_phys_sdp_mem_section = .; | ||
__exidx_end = .; | ||
__exidx_start = .; | ||
__heap1_end = .; | ||
__heap1_start = .; | ||
__heap2_end = .; | ||
__heap2_start = .; | ||
__initcall_end = .; | ||
__initcall_start = .; | ||
__init_end = .; | ||
__init_size = .; | ||
__init_start = .; | ||
__nozi_end = .; | ||
__nozi_stack_end = .; | ||
__nozi_stack_start = .; | ||
__nozi_start = .; | ||
__pageable_end = .; | ||
__pageable_part_end = .; | ||
__pageable_part_start = .; | ||
__pageable_start = .; | ||
__rodata_dtdrv_end = .; | ||
__rodata_dtdrv_start = .; | ||
__rodata_end = .; | ||
__rodata_start = .; | ||
__text_init_start = .; | ||
__text_start = .; | ||
__tmp_hashes_end = .; | ||
__tmp_hashes_size = .; | ||
__tmp_hashes_start = .; | ||
__vcore_init_ro_size = .; | ||
__vcore_init_ro_start = .; | ||
__vcore_init_rx_size = .; | ||
__vcore_init_rx_start = .; | ||
__vcore_unpg_ro_size = .; | ||
__vcore_unpg_ro_start = .; | ||
__vcore_unpg_rw_size = .; | ||
__vcore_unpg_rw_start = .; | ||
__vcore_unpg_rx_size = .; | ||
__vcore_unpg_rx_start = .; | ||
PROVIDE(core_v_str = 0); | ||
PROVIDE(tee_entry_std = 0); | ||
PROVIDE(tee_svc_handler = 0); | ||
PROVIDE(init_teecore = 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.