17c478bd9Sstevel@tonic-gate#
2*cd3e9333SAli Bahrami# Copyright (c) 1993, 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
72a8d6ebaSRod Evans# Common Development and Distribution License (the "License").
82a8d6ebaSRod 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#
237c478bd9Sstevel@tonic-gate# A default mapfile for optimizing the creation of a filter shared object.
247c478bd9Sstevel@tonic-gate# Creates a single, read-only, executable text segment to catch all loadable
257c478bd9Sstevel@tonic-gate# sections.
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gate# Filters that consist solely of a symbol table can be built directly from
287c478bd9Sstevel@tonic-gate# ld(1) so that no .init/.fini sections are created.  Although the filter can
297c478bd9Sstevel@tonic-gate# be constructed as a single read-only segment, the execute attribute of the
307c478bd9Sstevel@tonic-gate# segment is maintained to allow for simple .init processing (i.e., .init
317c478bd9Sstevel@tonic-gate# processing that requires no relocations), and to accommodate older versions
327c478bd9Sstevel@tonic-gate# of dbx that produce warning messages if they find objects without traditional
337c478bd9Sstevel@tonic-gate# text segments.
347c478bd9Sstevel@tonic-gate#
357c478bd9Sstevel@tonic-gate# If a filter is required to execute .init code that references global data
367c478bd9Sstevel@tonic-gate# then the filter will require relocation (i.e., it will have to be written to
377c478bd9Sstevel@tonic-gate# by ld.so.1).  Filters of this sort should *not* use this mapfile.
387c478bd9Sstevel@tonic-gate#
397c478bd9Sstevel@tonic-gate# This compaction of a filter into a single segment allows ld.so.1 to optimize
407c478bd9Sstevel@tonic-gate# its processing of a filter.  If the filter is small enough this segment may
417c478bd9Sstevel@tonic-gate# be handled in a single page mapping (for example libdl.so.1).
427c478bd9Sstevel@tonic-gate#
437c478bd9Sstevel@tonic-gate# The assignment of all allocatable sections to this segment insures that the
447c478bd9Sstevel@tonic-gate# .dynamic, and any .data or .bss sections, become part of the text.  Note that
457c478bd9Sstevel@tonic-gate# the compiler has a habit of generating empty .data and .bss sections.
462a8d6ebaSRod Evans#
472a8d6ebaSRod Evans# Override the default alignment so that this single paged object can be mapped
482a8d6ebaSRod Evans# more flexibly.
497c478bd9Sstevel@tonic-gate
50*cd3e9333SAli Bahrami$mapfile_version 2
51*cd3e9333SAli Bahrami
52*cd3e9333SAli BahramiLOAD_SEGMENT filter {
53*cd3e9333SAli Bahrami	FLAGS = READ EXECUTE;
54*cd3e9333SAli Bahrami	ALIGN = 0x1000;
55*cd3e9333SAli Bahrami	ASSIGN_SECTION {
56*cd3e9333SAli Bahrami		FLAGS = ALLOC;
57*cd3e9333SAli Bahrami	};
58*cd3e9333SAli Bahrami};
59