17c478bd9Sstevel@tonic-gate# 2*cd3e9333SAli Bahrami# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# CDDL HEADER START 57c478bd9Sstevel@tonic-gate# 67c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 7a4faba16SRod Evans# Common Development and Distribution License (the "License"). 8a4faba16SRod Evans# You may not use this file except in compliance with the License. 97c478bd9Sstevel@tonic-gate# 107c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 117c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 127c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 137c478bd9Sstevel@tonic-gate# and limitations under the License. 147c478bd9Sstevel@tonic-gate# 157c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 167c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 177c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 187c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 197c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 207c478bd9Sstevel@tonic-gate# 217c478bd9Sstevel@tonic-gate# CDDL HEADER END 227c478bd9Sstevel@tonic-gate# 23a4faba16SRod Evans# Link-editor mapfile to create a non-executable data segment definition 24a4faba16SRod Evans# within an executable. Note that this only functions properly on the 25a4faba16SRod Evans# x86 architecture. On SPARC, the data segment contains a Procedure Linkage 26a4faba16SRod Evans# Table (PLT) that must remain executable. 27a4faba16SRod Evans# 28a4faba16SRod Evans# As the data segment is extended by sbrk(2) to enlarge the heap, a 29a4faba16SRod Evans# non-executable data segment also results in a non-exutable heap. 30a4faba16SRod Evans# 31a4faba16SRod Evans# The link-editor does not use this file automatically, so one must use the 32a4faba16SRod Evans# -M option to cc or ld: 337c478bd9Sstevel@tonic-gate# 347c478bd9Sstevel@tonic-gate# cc -M /usr/lib/ld/map.noexdata myprogram.c 357c478bd9Sstevel@tonic-gate# 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate# 38a4faba16SRod Evans# Executables can also create a separate non-executable bss segment. 39a4faba16SRod Evans# This segment may use additional memory, but also results in a 40a4faba16SRod Evans# non-executable heap. See /usr/lib/ld/map.noexbss. 417c478bd9Sstevel@tonic-gate# 42a4faba16SRod Evans# See also /usr/lib/ld/map.execdata. 43*cd3e9333SAli Bahrami 44*cd3e9333SAli Bahrami$mapfile_version 2 45*cd3e9333SAli Bahrami 46*cd3e9333SAli Bahrami$if _sparc 47*cd3e9333SAli Bahrami 48*cd3e9333SAli Bahrami$error SPARC Procedure Linkage Table (PLT) must remain executable 49*cd3e9333SAli Bahrami 50*cd3e9333SAli Bahrami$elif _x86 51*cd3e9333SAli Bahrami 52*cd3e9333SAli BahramiLOAD_SEGMENT data { FLAGS = READ WRITE }; 53*cd3e9333SAli Bahrami 54*cd3e9333SAli Bahrami$else 55*cd3e9333SAli Bahrami$error unknown platform 56*cd3e9333SAli Bahrami$endif 57