1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#if defined(__MWERKS__) && !defined(__private_extern__)
24#define __private_extern__ __declspec(private_extern)
25#endif
26
27/*
28 * Global types, variables and routines declared in the file specs.c.
29 *
30 * The following include file need to be included before this file:
31 * #include <mach.h>
32 * #include "ld.h"
33 */
34
35/* Type to hold the information specified on the command line about segments */
36struct segment_spec {
37    char *segname;		/* full segment name from command line */
38    enum bool addr_specified;	/* TRUE if address has been specified */
39    enum bool prot_specified;	/* TRUE if protection has been specified */
40    unsigned long addr;		/* specified address */
41    vm_prot_t maxprot;		/* specified maximum protection */
42    vm_prot_t initprot;		/* specified initial protection */
43    unsigned long
44	nsection_specs;		/* count of section_spec structures below */
45    struct section_spec		/* list of section_spec structures for */
46	  *section_specs;	/*  -segcreate options */
47    enum bool processed;	/* TRUE after this has been processed */
48};
49
50/* Type to hold the information about sections specified on the command line */
51struct section_spec {
52    char *sectname;		/* full section name from command line */
53    enum bool align_specified;	/* TRUE if alignment has been specified */
54    unsigned long align;	/* the alignment (as a power of two) */
55    char *contents_filename;	/* file name for the contents of the section */
56    char *file_addr;		/* address the above file is mapped at */
57    unsigned long file_size;	/* size of above file as returned by stat(2) */
58    char *order_filename;	/* file name that contains the order that */
59				/*  symbols are to loaded in this section */
60    char *order_addr;		/* address the above file is mapped at */
61    unsigned long order_size;	/* size of above file as returned by stat(2) */
62    enum bool processed;	/* TRUE after this has been processed */
63};
64
65/* The structures to hold the information specified about segments */
66__private_extern__ struct segment_spec *segment_specs;
67__private_extern__ unsigned long nsegment_specs;
68
69__private_extern__ struct segment_spec *create_segment_spec(
70    char *segname);
71__private_extern__ struct section_spec *create_section_spec(
72    struct segment_spec *seg_spec,
73    char *sectname);
74__private_extern__ struct segment_spec * lookup_segment_spec(
75    char *segname);
76__private_extern__ struct section_spec *lookup_section_spec(
77    char *segname,
78    char *sectname);
79__private_extern__ void process_section_specs(
80    void);
81__private_extern__ void process_segment_specs(
82    void);
83#ifdef DEBUG
84__private_extern__ void print_segment_specs(
85    void);
86__private_extern__ void print_prot(
87    vm_prot_t prot);
88#endif /* DEBUG */
89