* asranlib/asranlib.c, link/lkar.h, link/lkar.c:
[fw/sdcc] / as / link / lkar.h
index 586c1b00be540bf5af4484900000f90d2776a53c..af77754bfd2a66cc0bf07a6e20b776769abe679a 100644 (file)
@@ -4,7 +4,7 @@
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
 later version.
 
 This program is distributed in the hope that it will be useful,
@@ -13,8 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #ifndef __LKAR_H
 #define __LKAR_H
@@ -30,13 +29,8 @@ typedef short gid_t;
 typedef _off_t off_t;
 #endif
 
-#ifdef WORDS_BIGENDIAN
-#define sgetl(buf)  (((((((unsigned char)(buf)[3] << 8) + (unsigned char)(buf)[2]) << 8) + (unsigned char)(buf)[1]) << 8) + (unsigned char)(buf)[0])
-#define sputl(value, buf)  ((buf)[3] = ((value) >> 24, (buf)[2] = (value) >> 16, (buf)[1] = (value) >> 8, (buf)[0] = (value))
-#else
 #define sgetl(buf)  (((((((unsigned char)(buf)[0] << 8) + (unsigned char)(buf)[1]) << 8) + (unsigned char)(buf)[2]) << 8) + (unsigned char)(buf)[3])
 #define sputl(value, buf)  ((buf)[0] = (value) >> 24, (buf)[1] = (value) >> 16, (buf)[2] = (value) >> 8, (buf)[3] = (value))
-#endif
 
 #define ARMAG   "!<arch>\n"           /* magic string */
 #define SARMAG  (sizeof (ARMAG) - 1)  /* length of magic string */
@@ -66,11 +60,16 @@ typedef _off_t off_t;
 
 #define ARHDR_LEN (AR_NAME_LEN + AR_DATE_LEN + AR_UID_LEN + AR_GID_LEN + AR_MODE_LEN + AR_SIZE_LEN + AR_FMAG_LEN)
 
-#define AR_SYMBOL_TABLE_NAME "/               "
-#define AR_STRING_TABLE_NAME "//              "
+#define AR_SYMBOL_TABLE_NAME            "/               "
+#define AR_STRING_TABLE_NAME            "//              "
+
+#define AR_BSD_SYMBOL_TABLE_NAME        "__.SYMDEF       "
+#define AR_BSD_SORTED_SYMBOL_TABLE_NAME "__.SYMDEF SORTED"
+
+#define AR_IS_SYMBOL_TABLE(name) (0 == strcmp((name), AR_SYMBOL_TABLE_NAME))
+#define AR_IS_STRING_TABLE(name) (0 == strcmp((name), AR_STRING_TABLE_NAME))
 
-#define AR_IS_SYMBOL_TABLE(hdr) (0 == strcmp((hdr).ar_name, AR_SYMBOL_TABLE_NAME))
-#define AR_IS_STRING_TABLE(hdr) (0 == strcmp((hdr).ar_name, AR_STRING_TABLE_NAME))
+#define AR_IS_BSD_SYMBOL_TABLE(name) (0 == strcmp((name), AR_BSD_SYMBOL_TABLE_NAME) || 0 == strcmp((name), AR_BSD_SORTED_SYMBOL_TABLE_NAME))
 
 
 struct ar_hdr                     /* archive member header */
@@ -80,7 +79,7 @@ struct ar_hdr                     /* archive member header */
   uid_t ar_uid;                   /* archive member user identification */
   gid_t ar_gid;                   /* archive member group identification */
   mode_t ar_mode;                 /* archive member mode (octal) */
-  off_t ar_size;                  /* archive member size */
+  size_t ar_size;                 /* archive member size */
 };
 
 #endif /* __LKAR_H */