2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _MACH_O_SARLD_H_
24 #define _MACH_O_SARLD_H_
26 #include <mach-o/nlist.h>
28 * sa_rld() loads the specified object in memory against the specified
29 * base file in memory. The output is placed in memory starting at
30 * the value of the parameter workmem_addr and the size of the memory
31 * used for the output returned indirectly through workmem_size.
32 * Initially *workmem_size is the size of the working memory.
35 char *basefile_name
, /* base file name */
36 struct mach_header
*basefile_addr
, /* mach header of the base file */
38 char *object_name
, /* name of the object to load */
39 char *object_addr
, /* addr of the object in memory to load */
40 unsigned long object_size
, /* size of the object in memory to load */
42 char *workmem_addr
, /* address of working memory */
43 unsigned long *workmem_size
, /* size of working memory (in/out) */
45 char *error_buf_addr
, /* address of error message buffer */
46 unsigned long error_buf_size
, /* size of error message buffer */
48 char *malloc_addr
, /* address to use for initializing malloc */
49 unsigned long malloc_len
); /* length to use for same */
52 * sa_rld_with_symtab() is the same as sa_rld() except it passed in a pointer
53 * to the symbol table, its size and a pointer to the string table and its
54 * size. Rather getting the the symbol table off of the mach header and the
57 typedef int sa_rld_with_symtab_t(
58 char *basefile_name
, /* base file name */
59 struct mach_header
*basefile_addr
, /* mach header of the base file */
61 char *object_name
, /* name of the object to load */
62 char *object_addr
, /* addr of the object in memory to load */
63 unsigned long object_size
, /* size of the object in memory to load */
65 char *workmem_addr
, /* address of working memory */
66 unsigned long *workmem_size
, /* size of working memory (in/out) */
68 char *error_buf_addr
, /* address of error message buffer */
69 unsigned long error_buf_size
, /* size of error message buffer */
71 char *malloc_addr
, /* address to use for initializing malloc */
72 unsigned long malloc_len
, /* length to use for same */
74 struct nlist
*symtab
, /* pointer to the symbol table */
75 unsigned long nsyms
, /* number of symbols */
77 char *strtab
, /* pointer to the string table */
78 unsigned long strsize
); /* sizeof the string table */
81 extern sa_rld_t sa_rld
;
82 extern sa_rld_with_symtab_t sa_rld_with_symtab
;
85 * These two variables are internal to sarld and not part of the external sarld
86 * API. These are set in sa_rld() and used in layout_segments() as the place
87 * to put the output in memory.
89 __private_extern__
char *sa_rld_output_addr
;
90 __private_extern__
unsigned long sa_rld_output_size
;
94 #endif /* _MACH_O_SARLD_H_ */