Back to index

cell-binutils  2.17cvs20070401
ranlib.h
Go to the documentation of this file.
00001 /* ranlib.h -- archive library index member definition for GNU.
00002    Copyright 1990, 1991 Free Software Foundation, Inc.
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00017 
00018 /* The Symdef member of an archive contains two things:
00019    a table that maps symbol-string offsets to file offsets,
00020    and a symbol-string table.  All the symbol names are
00021    run together (each with trailing null) in the symbol-string
00022    table.  There is a single longword bytecount on the front
00023    of each of these tables.  Thus if we have two symbols,
00024    "foo" and "_bar", that are in archive members at offsets
00025    200 and 900, it would look like this:
00026         16           ; byte count of index table
00027        0             ; offset of "foo" in string table
00028        200           ; offset of foo-module in file
00029        4             ; offset of "bar" in string table
00030        900           ; offset of bar-module in file
00031        9             ; byte count of string table
00032        "foo\0_bar\0" ; string table  */
00033 
00034 #define       RANLIBMAG     "__.SYMDEF"   /* Archive file name containing index */
00035 #define       RANLIBSKEW    3             /* Creation time offset */
00036 
00037 /* Format of __.SYMDEF:
00038    First, a longword containing the size of the 'symdef' data that follows.
00039    Second, zero or more 'symdef' structures.
00040    Third, a longword containing the length of symbol name strings.
00041    Fourth, zero or more symbol name strings (each followed by a null).  */
00042 
00043 struct symdef
00044   {
00045     union
00046       {
00047        unsigned long string_offset;       /* In the file */
00048        char *name;                 /* In memory, sometimes */
00049       } s;
00050     /* this points to the front of the file header (AKA member header --
00051        a struct ar_hdr), not to the front of the file or into the file).
00052        in other words it only tells you which file to read */       
00053     unsigned long file_offset;
00054   };
00055 
00056 /* Compatability with BSD code */
00057 
00058 #define       ranlib symdef
00059 #define       ran_un s
00060 #define       ran_strx string_offset
00061 #define       ran_name name
00062 #define       ran_off       file_offset