1/*
2 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18ENTRY(_start)
19
20SECTIONS
21{
22  /* Merge code and data into one section. */
23  .text : {
24        *(.text)
25        *(.text.*)
26        *(.data)
27        *(.data.*)
28        *(.rodata)
29        *(.rodata.*)
30        *(.bss)
31        *(.bss.*)
32  }
33
34  /DISCARD/ : {
35        /*
36         * PIC/PIE executable contains .got.plt section even if it is not linked
37         * with dynamic libraries. In such case it is just placeholder for
38         * _GLOBAL_OFFSET_TABLE_ symbol and .PLT0. .PLT0 is filled by dynamic
39         * linker and our code is not supposed to be loaded by dynamic linker.
40         * So, from our point of view .PLT0 is unused. This means that there is
41         * pretty good chance that we can safely drop .got.plt as a whole here.
42         * Sadly this is not true. _GLOBAL_OFFSET_TABLE_ is used as a reference
43         * for relative addressing (and only for that thing) and ld complains if
44         * we remove .got.plt section here because it cannot find required symbol.
45         * However, _GLOBAL_OFFSET_TABLE_ is no longer needed in final output.
46         * So, drop .got.plt section during conversion to plain binary format.
47         *
48         * Please check build32.mk for more details.
49         */
50        /* *(.got.plt) */
51  }
52}
53