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#ifndef _MACH_O_SARLD_H_ 24#define _MACH_O_SARLD_H_ 25 26#include <mach-o/nlist.h> 27/* 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. 33 */ 34typedef int sa_rld_t( 35char *basefile_name, /* base file name */ 36struct mach_header *basefile_addr, /* mach header of the base file */ 37 38char *object_name, /* name of the object to load */ 39char *object_addr, /* addr of the object in memory to load */ 40unsigned long object_size, /* size of the object in memory to load */ 41 42char *workmem_addr, /* address of working memory */ 43unsigned long *workmem_size, /* size of working memory (in/out) */ 44 45char *error_buf_addr, /* address of error message buffer */ 46unsigned long error_buf_size, /* size of error message buffer */ 47 48char *malloc_addr, /* address to use for initializing malloc */ 49unsigned long malloc_len); /* length to use for same */ 50 51/* 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 55 * link edit segment. 56 */ 57typedef int sa_rld_with_symtab_t( 58char *basefile_name, /* base file name */ 59struct mach_header *basefile_addr, /* mach header of the base file */ 60 61char *object_name, /* name of the object to load */ 62char *object_addr, /* addr of the object in memory to load */ 63unsigned long object_size, /* size of the object in memory to load */ 64 65char *workmem_addr, /* address of working memory */ 66unsigned long *workmem_size, /* size of working memory (in/out) */ 67 68char *error_buf_addr, /* address of error message buffer */ 69unsigned long error_buf_size, /* size of error message buffer */ 70 71char *malloc_addr, /* address to use for initializing malloc */ 72unsigned long malloc_len, /* length to use for same */ 73 74struct nlist *symtab, /* pointer to the symbol table */ 75unsigned long nsyms, /* number of symbols */ 76 77char *strtab, /* pointer to the string table */ 78unsigned long strsize); /* sizeof the string table */ 79 80#ifdef SA_RLD 81extern sa_rld_t sa_rld; 82extern sa_rld_with_symtab_t sa_rld_with_symtab; 83 84/* 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. 88 */ 89__private_extern__ char *sa_rld_output_addr; 90__private_extern__ unsigned long sa_rld_output_size; 91#endif /* SA_RLD */ 92 93 94#endif /* _MACH_O_SARLD_H_ */ 95