1/* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17/* 18 * NOTE: Android supports both 4KiB and 16Kib page sizes. 19 * 20 * Use the larger page size (16384) for page alignment that 21 * works in both 4KiB and 16KiB devices. 22 */ 23SECTIONS { 24 . = SIZEOF_HEADERS; 25 .text : { 26 *(.text.*) 27 . = ALIGN(16384); 28 exec_region_start = .; 29 . += (512 * 1024); 30 . = ALIGN(16384); 31 exec_region_end = .; 32 } 33 .plt : { 34 *(.plt) 35 } 36 /* Align following segments on the page boundary to prevent 37 * next PT_LOAD segment from mapping over .plt section removing 38 * executable flag from .plt. See also http://b/254823538. 39 */ 40 . = ALIGN(16384); 41 .fini_array : { 42 *(.fini_array.*) 43 } 44 .init_array : { 45 *(.ini_array.*) 46 } 47 .dynamic : { 48 *(.dynamic) 49 } 50 .got : { 51 *(.got) 52 } 53 .got.plt : { 54 *(.got.plt) 55 } 56 /* Align the rest of segments on the page boundary to prevent 57 * GNU_RELRO segment from mprotecting writable flag away 58 * from them. See also http://b/261807330. 59 */ 60 . = ALIGN(16384); 61} 62