xref: /freebsd/sys/conf/ldscript.kmod.amd64 (revision e12492164aeba4ae8bbb7773037ecff0ddf95923)
1a211ca52SMark Johnston/*-
2a211ca52SMark Johnston * SPDX-License-Identifier: BSD-2-Clause
3a211ca52SMark Johnston *
4a211ca52SMark Johnston * Copyright (c) 2019 Mark Johnston <markj@FreeBSD.org>
5a211ca52SMark Johnston *
6a211ca52SMark Johnston * Redistribution and use in source and binary forms, with or without
7a211ca52SMark Johnston * modification, are permitted provided that the following conditions
8a211ca52SMark Johnston * are met:
9a211ca52SMark Johnston * 1. Redistributions of source code must retain the above copyright
10a211ca52SMark Johnston *    notice, this list of conditions and the following disclaimer.
11a211ca52SMark Johnston * 2. Redistributions in binary form must reproduce the above copyright
12a211ca52SMark Johnston *    notice, this list of conditions and the following disclaimer in the
13a211ca52SMark Johnston *    documentation and/or other materials provided with the distribution.
14a211ca52SMark Johnston *
15a211ca52SMark Johnston * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16a211ca52SMark Johnston * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17a211ca52SMark Johnston * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18a211ca52SMark Johnston * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19a211ca52SMark Johnston * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20a211ca52SMark Johnston * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21a211ca52SMark Johnston * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22a211ca52SMark Johnston * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23a211ca52SMark Johnston * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24a211ca52SMark Johnston * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25a211ca52SMark Johnston * SUCH DAMAGE.
26a211ca52SMark Johnston *
27a211ca52SMark Johnston * $FreeBSD$
28a211ca52SMark Johnston */
29a211ca52SMark Johnston
30a211ca52SMark Johnston /*
31a211ca52SMark Johnston  * Coalesce executable and read-only sections, and pad to page alignment so
32a211ca52SMark Johnston  * that memory protections can be strictly enforced.
33a211ca52SMark Johnston  */
34a211ca52SMark Johnston
35a211ca52SMark JohnstonSECTIONS
36a211ca52SMark Johnston{
37*e1249216SMark Johnston	.plt		:
38*e1249216SMark Johnston	{
39*e1249216SMark Johnston		*(.plt)
40*e1249216SMark Johnston	}
41a211ca52SMark Johnston	.text		:
42a211ca52SMark Johnston	{
43a211ca52SMark Johnston		*(.text .text.*)
44a211ca52SMark Johnston		. = ALIGN(CONSTANT(COMMONPAGESIZE));
45a211ca52SMark Johnston	}
46a211ca52SMark Johnston
47a211ca52SMark Johnston	.rodata		:
48a211ca52SMark Johnston	{
49a211ca52SMark Johnston		*(.rodata .rodata.*)
50a211ca52SMark Johnston		. = ALIGN(CONSTANT(COMMONPAGESIZE));
51a211ca52SMark Johnston	}
52a211ca52SMark Johnston}
53