2019-06-21 17:52:37 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Adapted from arm64 version.
|
|
|
|
*
|
|
|
|
* GNU linker script for the VDSO library.
|
|
|
|
* Heavily based on the vDSO linker scripts for other archs.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012-2018 ARM Limited
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/const.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/vdso.h>
|
2022-05-10 17:58:33 +08:00
|
|
|
#include <asm-generic/vmlinux.lds.h>
|
2019-06-21 17:52:37 +08:00
|
|
|
|
|
|
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
|
|
|
OUTPUT_ARCH(arm)
|
|
|
|
|
|
|
|
SECTIONS
|
|
|
|
{
|
2020-06-24 16:33:18 +08:00
|
|
|
PROVIDE_HIDDEN(_vdso_data = . - __VVAR_PAGES * PAGE_SIZE);
|
|
|
|
#ifdef CONFIG_TIME_NS
|
|
|
|
PROVIDE_HIDDEN(_timens_data = _vdso_data + PAGE_SIZE);
|
|
|
|
#endif
|
2019-06-21 17:52:37 +08:00
|
|
|
. = VDSO_LBASE + SIZEOF_HEADERS;
|
|
|
|
|
|
|
|
.hash : { *(.hash) } :text
|
|
|
|
.gnu.hash : { *(.gnu.hash) }
|
|
|
|
.dynsym : { *(.dynsym) }
|
|
|
|
.dynstr : { *(.dynstr) }
|
|
|
|
.gnu.version : { *(.gnu.version) }
|
|
|
|
.gnu.version_d : { *(.gnu.version_d) }
|
|
|
|
.gnu.version_r : { *(.gnu.version_r) }
|
|
|
|
|
|
|
|
.note : { *(.note.*) } :text :note
|
|
|
|
|
|
|
|
.dynamic : { *(.dynamic) } :text :dynamic
|
|
|
|
|
2022-06-28 23:13:07 +08:00
|
|
|
.rodata : {
|
|
|
|
*(.rodata*)
|
|
|
|
*(.got)
|
|
|
|
*(.got.plt)
|
|
|
|
*(.plt)
|
|
|
|
*(.rel.iplt)
|
|
|
|
*(.iplt)
|
|
|
|
*(.igot.plt)
|
|
|
|
} :text
|
2019-06-21 17:52:37 +08:00
|
|
|
|
2022-05-10 17:58:33 +08:00
|
|
|
.text : {
|
|
|
|
*(.text*)
|
|
|
|
*(.glue_7)
|
|
|
|
*(.glue_7t)
|
|
|
|
*(.vfp11_veneer)
|
|
|
|
*(.v4_bx)
|
|
|
|
} :text =0xe7f001f2
|
|
|
|
|
2022-06-28 23:13:07 +08:00
|
|
|
.rel.dyn : { *(.rel*) }
|
2022-05-10 17:58:33 +08:00
|
|
|
|
2022-06-28 23:13:06 +08:00
|
|
|
.ARM.exidx : { *(.ARM.exidx*) }
|
2022-06-30 23:31:21 +08:00
|
|
|
DWARF_DEBUG
|
arm64: vdso32: Shuffle .ARM.exidx section above ELF_DETAILS
When building the 32-bit vDSO after commit 5c4fb60816ea ("arm64: vdso32:
add ARM.exidx* sections"), ld.lld 11 fails to link:
ld.lld: error: could not allocate headers
ld.lld: error: unable to place section .text at file offset [0x2A0, 0xBB1]; check your linker script for overflows
ld.lld: error: unable to place section .comment at file offset [0xBB2, 0xC8A]; check your linker script for overflows
ld.lld: error: unable to place section .symtab at file offset [0xC8C, 0xE0B]; check your linker script for overflows
ld.lld: error: unable to place section .strtab at file offset [0xE0C, 0xF1C]; check your linker script for overflows
ld.lld: error: unable to place section .shstrtab at file offset [0xF1D, 0xFAA]; check your linker script for overflows
ld.lld: error: section .ARM.exidx file range overlaps with .hash
>>> .ARM.exidx range is [0x90, 0xCF]
>>> .hash range is [0xB4, 0xE3]
ld.lld: error: section .hash file range overlaps with .ARM.attributes
>>> .hash range is [0xB4, 0xE3]
>>> .ARM.attributes range is [0xD0, 0x10B]
ld.lld: error: section .ARM.attributes file range overlaps with .dynsym
>>> .ARM.attributes range is [0xD0, 0x10B]
>>> .dynsym range is [0xE4, 0x133]
ld.lld: error: section .ARM.exidx virtual address range overlaps with .hash
>>> .ARM.exidx range is [0x90, 0xCF]
>>> .hash range is [0xB4, 0xE3]
ld.lld: error: section .ARM.exidx load address range overlaps with .hash
>>> .ARM.exidx range is [0x90, 0xCF]
>>> .hash range is [0xB4, 0xE3]
This was fixed in ld.lld 12 with a change to match GNU ld's semantics of
placing non-SHF_ALLOC sections after SHF_ALLOC sections.
To workaround this issue, move the .ARM.exidx section before the
.comment, .symtab, .strtab, and .shstrtab sections (ELF_DETAILS) so that
those sections remain contiguous with the .ARM.attributes section.
Fixes: 5c4fb60816ea ("arm64: vdso32: add ARM.exidx* sections")
Link: https://github.com/llvm/llvm-project/commit/ec29538af2e0886a65f479d6a533956a1c478132
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20220630153121.1317045-2-nathan@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
2022-06-30 23:31:20 +08:00
|
|
|
ELF_DETAILS
|
2022-05-10 17:58:33 +08:00
|
|
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
2019-06-21 17:52:37 +08:00
|
|
|
|
|
|
|
/DISCARD/ : {
|
|
|
|
*(.note.GNU-stack)
|
|
|
|
*(.data .data.* .gnu.linkonce.d.* .sdata*)
|
|
|
|
*(.bss .sbss .dynbss .dynsbss)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We must supply the ELF program headers explicitly to get just one
|
|
|
|
* PT_LOAD segment, and set the flags explicitly to make segments read-only.
|
|
|
|
*/
|
|
|
|
PHDRS
|
|
|
|
{
|
|
|
|
text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
|
|
|
|
dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
|
|
|
|
note PT_NOTE FLAGS(4); /* PF_R */
|
|
|
|
}
|
|
|
|
|
|
|
|
VERSION
|
|
|
|
{
|
|
|
|
LINUX_2.6 {
|
|
|
|
global:
|
|
|
|
__vdso_clock_gettime;
|
|
|
|
__vdso_gettimeofday;
|
|
|
|
__vdso_clock_getres;
|
|
|
|
__vdso_clock_gettime64;
|
|
|
|
local: *;
|
|
|
|
};
|
|
|
|
}
|