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 4byte_literals.c. 29 * 30 * The following include files need to be included before this file: 31 * #include "ld.h" 32 * #include "objects.h" 33 */ 34 35/* 36 * The literal_data which is set into a merged_section's literal_data field for 37 * S_4BYTE_LITERALS sections. The external functions declared at the end of 38 * this file operate on this data and are used for the other fields of a 39 * merged_section for literals (literal_merge and literal_write). 40 */ 41struct literal4_data { 42 struct literal4_block *literal4_blocks; /* the literal4's */ 43 struct literal4_load_order_data /* the load order info needed to */ 44 *literal4_load_order_data; /* re-merge when using -dead_strip */ 45#ifdef DEBUG 46 unsigned long nfiles; /* number of files with this section */ 47 unsigned long nliterals; /* total number of literals in the input files*/ 48 /* merged into this section */ 49#endif /* DEBUG */ 50}; 51 52/* the number of entries in the hash table */ 53#define LITERAL4_BLOCK_SIZE 60 54 55/* The structure to hold an 4 byte literal */ 56struct literal4 { 57 unsigned long long0; 58}; 59 60/* the blocks that store the liiterals; allocated as needed */ 61struct literal4_block { 62 unsigned long used; /* the number of literals used in */ 63 struct literal4 /* this block */ 64 literal4s[LITERAL4_BLOCK_SIZE]; /* the literals */ 65 struct literal4_block *next; /* the next block */ 66}; 67 68/* the load order info needed to re-merge when using -dead_strip */ 69struct literal4_load_order_data { 70 unsigned long nliteral4_order_lines; 71 struct literal4_order_line *literal4_order_lines; 72}; 73/* the load order info for a single literal4 order line */ 74struct literal4_order_line { 75 struct literal4 literal4; 76 unsigned long line_number; 77 unsigned long output_offset; 78}; 79 80__private_extern__ void literal4_merge( 81 struct literal4_data *data, 82 struct merged_section *ms, 83 struct section *s, 84 struct section_map *section_map, 85 enum bool redo_live); 86 87__private_extern__ void literal4_order( 88 struct literal4_data *data, 89 struct merged_section *ms); 90 91__private_extern__ void literal4_reset_live( 92 struct literal4_data *data, 93 struct merged_section *ms); 94 95__private_extern__ unsigned long lookup_literal4( 96 struct literal4 literal4, 97 struct literal4_data *data, 98 struct merged_section *ms); 99 100__private_extern__ void literal4_output( 101 struct literal4_data *data, 102 struct merged_section *ms); 103 104__private_extern__ void literal4_free( 105 struct literal4_data *data); 106 107#ifdef DEBUG 108__private_extern__ void print_literal4_data( 109 struct literal4_data *data, 110 char *indent); 111 112__private_extern__ void literal4_data_stats( 113 struct literal4_data *data, 114 struct merged_section *ms); 115#endif /* DEBUG */ 116