17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57257d1b4Sraf * Common Development and Distribution License (the "License").
67257d1b4Sraf * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217257d1b4Sraf
227c478bd9Sstevel@tonic-gate /*
23ba7866cdSAli Bahrami * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate /*
277257d1b4Sraf * Copyright (c) 1988 AT&T
287257d1b4Sraf * All Rights Reserved
297c478bd9Sstevel@tonic-gate */
307c478bd9Sstevel@tonic-gate
31*7d732bb0SJohn Levon /*
32*7d732bb0SJohn Levon * Copyright (c) 2018, Joyent, Inc.
33*7d732bb0SJohn Levon */
34*7d732bb0SJohn Levon
357c478bd9Sstevel@tonic-gate #include <ar.h>
367c478bd9Sstevel@tonic-gate #include <stdlib.h>
377c478bd9Sstevel@tonic-gate #include <memory.h>
387c478bd9Sstevel@tonic-gate #include <errno.h>
397c478bd9Sstevel@tonic-gate #include <libelf.h>
407c478bd9Sstevel@tonic-gate #include "decl.h"
417c478bd9Sstevel@tonic-gate #include "msg.h"
427c478bd9Sstevel@tonic-gate #include "member.h"
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate #define MANGLE '\177'
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate * Archive processing
497c478bd9Sstevel@tonic-gate * When processing an archive member, two things can happen
507c478bd9Sstevel@tonic-gate * that are a little tricky.
517c478bd9Sstevel@tonic-gate *
527c478bd9Sstevel@tonic-gate * Sliding
537c478bd9Sstevel@tonic-gate * Sliding support is left in for backward compatibility and for
547c478bd9Sstevel@tonic-gate * support of Archives produced on other systems. The bundled
557c478bd9Sstevel@tonic-gate * ar(1) produces archives with all members on a 4 byte boundry,
567c478bd9Sstevel@tonic-gate * so current archives should need no sliding.
577c478bd9Sstevel@tonic-gate *
587c478bd9Sstevel@tonic-gate * Archive members that are only 2-byte aligned within the file will
597c478bd9Sstevel@tonic-gate * be slid. To reuse the file's memory image, the library slides an
607c478bd9Sstevel@tonic-gate * archive member into its header to align the bytes. This means
617c478bd9Sstevel@tonic-gate * the header must be disposable.
627c478bd9Sstevel@tonic-gate *
637c478bd9Sstevel@tonic-gate * Header reuse
647c478bd9Sstevel@tonic-gate * Because the library can trample the header, it must be preserved to
657c478bd9Sstevel@tonic-gate * avoid restrictions on archive member reuse. That is, if the member
667c478bd9Sstevel@tonic-gate * header changes, the library may see garbage the next time it looks
677c478bd9Sstevel@tonic-gate * at the header. After extracting the original header, the library
687c478bd9Sstevel@tonic-gate * appends it to the parents `ed_memlist' list, thus future lookups first
697c478bd9Sstevel@tonic-gate * check this list to determine if a member has previously been processed
707c478bd9Sstevel@tonic-gate * and whether sliding occured.
717c478bd9Sstevel@tonic-gate */
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate * Size check
767c478bd9Sstevel@tonic-gate * If the header is too small, the following generates a negative
777c478bd9Sstevel@tonic-gate * subscript for x.x and fails to compile.
787c478bd9Sstevel@tonic-gate *
797c478bd9Sstevel@tonic-gate * The check is based on sizeof (Elf64) because that's always going
807c478bd9Sstevel@tonic-gate * to be at least as big as Elf32.
817c478bd9Sstevel@tonic-gate */
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate struct x
847c478bd9Sstevel@tonic-gate {
857c478bd9Sstevel@tonic-gate char x[sizeof (struct ar_hdr) - 3 * sizeof (Elf64) - 1];
867c478bd9Sstevel@tonic-gate };
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate static const char fmag[] = ARFMAG;
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate /*
947c478bd9Sstevel@tonic-gate * Convert a string starting at 'p' and ending at 'end' into
957c478bd9Sstevel@tonic-gate * an integer. Base is the base of the number being converted
967c478bd9Sstevel@tonic-gate * (either 8 or 10).
977c478bd9Sstevel@tonic-gate *
987c478bd9Sstevel@tonic-gate * Returns the converted integer of the string being scaned.
997c478bd9Sstevel@tonic-gate */
1007c478bd9Sstevel@tonic-gate unsigned long
_elf_number(char * p,char * end,int base)1017257d1b4Sraf _elf_number(char *p, char *end, int base)
1027c478bd9Sstevel@tonic-gate {
1037c478bd9Sstevel@tonic-gate register unsigned c;
1047c478bd9Sstevel@tonic-gate register unsigned long n = 0;
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gate while (p < end) {
1077c478bd9Sstevel@tonic-gate if ((c = *p - '0') >= base) {
1087c478bd9Sstevel@tonic-gate while (*p++ == ' ')
1097c478bd9Sstevel@tonic-gate if (p >= end)
1107c478bd9Sstevel@tonic-gate return (n);
1117c478bd9Sstevel@tonic-gate return (0);
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate n *= base;
1147c478bd9Sstevel@tonic-gate n += c;
1157c478bd9Sstevel@tonic-gate ++p;
1167c478bd9Sstevel@tonic-gate }
1177c478bd9Sstevel@tonic-gate return (n);
1187c478bd9Sstevel@tonic-gate }
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate * Convert ar_hdr to Member
1237c478bd9Sstevel@tonic-gate * Converts ascii file representation to the binary memory values.
1247c478bd9Sstevel@tonic-gate */
1257c478bd9Sstevel@tonic-gate Member *
_elf_armem(Elf * elf,char * file,size_t fsz)1267257d1b4Sraf _elf_armem(Elf *elf, char *file, size_t fsz)
1277c478bd9Sstevel@tonic-gate {
1287c478bd9Sstevel@tonic-gate register struct ar_hdr *f = (struct ar_hdr *)file;
1297c478bd9Sstevel@tonic-gate register Member *m;
1307c478bd9Sstevel@tonic-gate register Memlist *l, * ol;
1317c478bd9Sstevel@tonic-gate register Memident *i;
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate if (fsz < sizeof (struct ar_hdr)) {
1347c478bd9Sstevel@tonic-gate _elf_seterr(EFMT_ARHDRSZ, 0);
1357c478bd9Sstevel@tonic-gate return (0);
1367c478bd9Sstevel@tonic-gate }
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate * Determine in this member has already been processed
1407c478bd9Sstevel@tonic-gate */
1417c478bd9Sstevel@tonic-gate for (l = elf->ed_memlist, ol = l; l; ol = l, l = l->m_next)
1427c478bd9Sstevel@tonic-gate for (i = (Memident *)(l + 1); i < l->m_free; i++)
1437c478bd9Sstevel@tonic-gate if (i->m_offset == file)
1447c478bd9Sstevel@tonic-gate return (i->m_member);
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gate if (f->ar_fmag[0] != fmag[0] || f->ar_fmag[1] != fmag[1]) {
1477c478bd9Sstevel@tonic-gate _elf_seterr(EFMT_ARFMAG, 0);
1487c478bd9Sstevel@tonic-gate return (0);
1497c478bd9Sstevel@tonic-gate }
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gate /*
1527c478bd9Sstevel@tonic-gate * Allocate a new member structure and assign it to the next free
1537c478bd9Sstevel@tonic-gate * free memlist ident.
1547c478bd9Sstevel@tonic-gate */
1557c478bd9Sstevel@tonic-gate if ((m = (Member *)malloc(sizeof (Member))) == 0) {
1567c478bd9Sstevel@tonic-gate _elf_seterr(EMEM_ARMEM, errno);
1577c478bd9Sstevel@tonic-gate return (0);
1587c478bd9Sstevel@tonic-gate }
1597c478bd9Sstevel@tonic-gate if ((elf->ed_memlist == 0) || (ol->m_free == ol->m_end)) {
1607c478bd9Sstevel@tonic-gate if ((l = (Memlist *)malloc(sizeof (Memlist) +
1617c478bd9Sstevel@tonic-gate (sizeof (Memident) * MEMIDENTNO))) == 0) {
1627c478bd9Sstevel@tonic-gate _elf_seterr(EMEM_ARMEM, errno);
163*7d732bb0SJohn Levon free(m);
1647c478bd9Sstevel@tonic-gate return (0);
1657c478bd9Sstevel@tonic-gate }
1667c478bd9Sstevel@tonic-gate l->m_next = 0;
1677c478bd9Sstevel@tonic-gate l->m_free = (Memident *)(l + 1);
1687c478bd9Sstevel@tonic-gate l->m_end = (Memident *)((uintptr_t)l->m_free +
1697257d1b4Sraf (sizeof (Memident) * MEMIDENTNO));
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gate if (elf->ed_memlist == 0)
1727c478bd9Sstevel@tonic-gate elf->ed_memlist = l;
1737c478bd9Sstevel@tonic-gate else
1747c478bd9Sstevel@tonic-gate ol->m_next = l;
1757c478bd9Sstevel@tonic-gate ol = l;
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate ol->m_free->m_offset = file;
1787c478bd9Sstevel@tonic-gate ol->m_free->m_member = m;
1797c478bd9Sstevel@tonic-gate ol->m_free++;
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate m->m_err = 0;
1827c478bd9Sstevel@tonic-gate (void) memcpy(m->m_name, f->ar_name, ARSZ(ar_name));
1837c478bd9Sstevel@tonic-gate m->m_name[ARSZ(ar_name)] = '\0';
1847c478bd9Sstevel@tonic-gate m->m_hdr.ar_name = m->m_name;
1857c478bd9Sstevel@tonic-gate (void) memcpy(m->m_raw, f->ar_name, ARSZ(ar_name));
1867c478bd9Sstevel@tonic-gate m->m_raw[ARSZ(ar_name)] = '\0';
1877c478bd9Sstevel@tonic-gate m->m_hdr.ar_rawname = m->m_raw;
1887c478bd9Sstevel@tonic-gate m->m_slide = 0;
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate /*
1917c478bd9Sstevel@tonic-gate * Classify file name.
1927c478bd9Sstevel@tonic-gate * If a name error occurs, delay until getarhdr().
1937c478bd9Sstevel@tonic-gate */
1947c478bd9Sstevel@tonic-gate
1957c478bd9Sstevel@tonic-gate if (f->ar_name[0] != '/') { /* regular name */
1967c478bd9Sstevel@tonic-gate register char *p;
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gate p = &m->m_name[sizeof (m->m_name)];
1997c478bd9Sstevel@tonic-gate while (*--p != '/')
2007c478bd9Sstevel@tonic-gate if (p <= m->m_name)
2017c478bd9Sstevel@tonic-gate break;
2027c478bd9Sstevel@tonic-gate *p = '\0';
2037c478bd9Sstevel@tonic-gate } else if (f->ar_name[1] >= '0' && f->ar_name[1] <= '9') { /* strtab */
2047c478bd9Sstevel@tonic-gate register unsigned long j;
2057c478bd9Sstevel@tonic-gate
2067c478bd9Sstevel@tonic-gate j = _elf_number(&f->ar_name[1],
2077257d1b4Sraf &f->ar_name[ARSZ(ar_name)], 10);
2087c478bd9Sstevel@tonic-gate if (j < elf->ed_arstrsz)
2097c478bd9Sstevel@tonic-gate m->m_hdr.ar_name = elf->ed_arstr + j;
2107c478bd9Sstevel@tonic-gate else {
2117c478bd9Sstevel@tonic-gate m->m_hdr.ar_name = 0;
2127c478bd9Sstevel@tonic-gate /*LINTED*/ /* MSG_INTL(EFMT_ARSTRNM) */
2137c478bd9Sstevel@tonic-gate m->m_err = (int)EFMT_ARSTRNM;
2147c478bd9Sstevel@tonic-gate }
2157c478bd9Sstevel@tonic-gate } else if (f->ar_name[1] == ' ') /* "/" */
2167c478bd9Sstevel@tonic-gate m->m_name[1] = '\0';
2177c478bd9Sstevel@tonic-gate else if (f->ar_name[1] == '/' && f->ar_name[2] == ' ') /* "//" */
2187c478bd9Sstevel@tonic-gate m->m_name[2] = '\0';
219ba7866cdSAli Bahrami else if (f->ar_name[1] == 'S' && f->ar_name[2] == 'Y' &&
220ba7866cdSAli Bahrami f->ar_name[3] == 'M' && f->ar_name[4] == '6' &&
221ba7866cdSAli Bahrami f->ar_name[5] == '4' && f->ar_name[6] == '/' &&
222ba7866cdSAli Bahrami f->ar_name[7] == ' ') /* "/SYM64/" */
223ba7866cdSAli Bahrami m->m_name[7] = '\0';
2247c478bd9Sstevel@tonic-gate else { /* "/?" */
2257c478bd9Sstevel@tonic-gate m->m_hdr.ar_name = 0;
2267c478bd9Sstevel@tonic-gate /*LINTED*/ /* MSG_INTL(EFMT_ARUNKNM) */
2277c478bd9Sstevel@tonic-gate m->m_err = (int)EFMT_ARUNKNM;
2287c478bd9Sstevel@tonic-gate }
2297c478bd9Sstevel@tonic-gate
2307c478bd9Sstevel@tonic-gate m->m_hdr.ar_date = (time_t)_elf_number(f->ar_date,
2317257d1b4Sraf &f->ar_date[ARSZ(ar_date)], 10);
2327c478bd9Sstevel@tonic-gate /* LINTED */
2337c478bd9Sstevel@tonic-gate m->m_hdr.ar_uid = (uid_t)_elf_number(f->ar_uid,
2347257d1b4Sraf &f->ar_uid[ARSZ(ar_uid)], 10);
2357c478bd9Sstevel@tonic-gate /* LINTED */
2367c478bd9Sstevel@tonic-gate m->m_hdr.ar_gid = (gid_t)_elf_number(f->ar_gid,
2377257d1b4Sraf &f->ar_gid[ARSZ(ar_gid)], 10);
2387c478bd9Sstevel@tonic-gate /* LINTED */
2397c478bd9Sstevel@tonic-gate m->m_hdr.ar_mode = (mode_t)_elf_number(f->ar_mode,
2407257d1b4Sraf &f->ar_mode[ARSZ(ar_mode)], 8);
2417c478bd9Sstevel@tonic-gate m->m_hdr.ar_size = (off_t)_elf_number(f->ar_size,
2427257d1b4Sraf &f->ar_size[ARSZ(ar_size)], 10);
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate return (m);
2457c478bd9Sstevel@tonic-gate }
2467c478bd9Sstevel@tonic-gate
2477c478bd9Sstevel@tonic-gate
2487c478bd9Sstevel@tonic-gate /*
2497c478bd9Sstevel@tonic-gate * Initial archive processing
2507c478bd9Sstevel@tonic-gate * An archive may have two special members.
251ba7866cdSAli Bahrami *
252ba7866cdSAli Bahrami * A symbol table, named / or /SYM64/, must be first if it is present.
253ba7866cdSAli Bahrami * Both forms use the same layout differing in the width of the
254ba7866cdSAli Bahrami * integer type used (32 or 64-bit respectively).
255ba7866cdSAli Bahrami *
256ba7866cdSAli Bahrami * A long name string table, named //, must precede all "normal"
257ba7866cdSAli Bahrami * members. This string table is used to hold the names of archive
258ba7866cdSAli Bahrami * members with names that are longer than 15 characters. It should not
259ba7866cdSAli Bahrami * be confused with the string table found at the end of the symbol
260ba7866cdSAli Bahrami * table, which is used to hold symbol names.
2617c478bd9Sstevel@tonic-gate *
2627c478bd9Sstevel@tonic-gate * This code "peeks" at headers but doesn't change them.
2637c478bd9Sstevel@tonic-gate * Later processing wants original headers.
2647c478bd9Sstevel@tonic-gate *
2657c478bd9Sstevel@tonic-gate * String table is converted, changing '/' name terminators
2667c478bd9Sstevel@tonic-gate * to nulls. The last byte in the string table, which should
2677c478bd9Sstevel@tonic-gate * be '\n', is set to nil, guaranteeing null termination. That
2687c478bd9Sstevel@tonic-gate * byte should be '\n', but this code doesn't check.
2697c478bd9Sstevel@tonic-gate *
2707c478bd9Sstevel@tonic-gate * The symbol table conversion is delayed until needed.
2717c478bd9Sstevel@tonic-gate */
2727c478bd9Sstevel@tonic-gate void
_elf_arinit(Elf * elf)2737c478bd9Sstevel@tonic-gate _elf_arinit(Elf * elf)
2747c478bd9Sstevel@tonic-gate {
2757257d1b4Sraf char *base = elf->ed_ident;
2767257d1b4Sraf register char *end = base + elf->ed_fsz;
2777257d1b4Sraf register struct ar_hdr *a;
2787257d1b4Sraf register char *hdr = base + SARMAG;
2797257d1b4Sraf register char *mem;
2807c478bd9Sstevel@tonic-gate int j;
2817c478bd9Sstevel@tonic-gate size_t sz = SARMAG;
2827c478bd9Sstevel@tonic-gate
2837c478bd9Sstevel@tonic-gate elf->ed_status = ES_COOKED;
2847c478bd9Sstevel@tonic-gate elf->ed_nextoff = SARMAG;
2857c478bd9Sstevel@tonic-gate for (j = 0; j < 2; ++j) { /* 2 special members */
2867c478bd9Sstevel@tonic-gate unsigned long n;
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate if (((end - hdr) < sizeof (struct ar_hdr)) ||
2897c478bd9Sstevel@tonic-gate (_elf_vm(elf, (size_t)(SARMAG),
2907c478bd9Sstevel@tonic-gate sizeof (struct ar_hdr)) != OK_YES))
2917c478bd9Sstevel@tonic-gate return;
2927c478bd9Sstevel@tonic-gate
2937c478bd9Sstevel@tonic-gate a = (struct ar_hdr *)hdr;
2947c478bd9Sstevel@tonic-gate mem = (char *)a + sizeof (struct ar_hdr);
2957c478bd9Sstevel@tonic-gate n = _elf_number(a->ar_size, &a->ar_size[ARSZ(ar_size)], 10);
2967c478bd9Sstevel@tonic-gate if ((end - mem < n) || (a->ar_name[0] != '/') ||
2977c478bd9Sstevel@tonic-gate ((sz = n) != n)) {
2987c478bd9Sstevel@tonic-gate return;
2997c478bd9Sstevel@tonic-gate }
3007c478bd9Sstevel@tonic-gate
3017c478bd9Sstevel@tonic-gate hdr = mem + sz;
302ba7866cdSAli Bahrami if (a->ar_name[1] == ' ') { /* 32-bit symbol table */
3037c478bd9Sstevel@tonic-gate elf->ed_arsym = mem;
3047c478bd9Sstevel@tonic-gate elf->ed_arsymsz = sz;
3057c478bd9Sstevel@tonic-gate elf->ed_arsymoff = (char *)a - base;
3067c478bd9Sstevel@tonic-gate } else if (a->ar_name[1] == '/' && a->ar_name[2] == ' ') {
307ba7866cdSAli Bahrami /* Long name string table */
3087c478bd9Sstevel@tonic-gate int k;
3097c478bd9Sstevel@tonic-gate
3107c478bd9Sstevel@tonic-gate if (_elf_vm(elf, (size_t)(mem - elf->ed_ident),
3117c478bd9Sstevel@tonic-gate sz) != OK_YES)
3127c478bd9Sstevel@tonic-gate return;
3137c478bd9Sstevel@tonic-gate if (elf->ed_vm == 0) {
3147257d1b4Sraf char *nmem;
3157c478bd9Sstevel@tonic-gate if ((nmem = malloc(sz)) == 0) {
3167c478bd9Sstevel@tonic-gate _elf_seterr(EMEM_ARSTR, errno);
3177c478bd9Sstevel@tonic-gate return;
3187c478bd9Sstevel@tonic-gate }
3197c478bd9Sstevel@tonic-gate (void) memcpy(nmem, mem, sz);
3207c478bd9Sstevel@tonic-gate elf->ed_myflags |= EDF_ASTRALLOC;
3217c478bd9Sstevel@tonic-gate mem = nmem;
3227c478bd9Sstevel@tonic-gate }
3237c478bd9Sstevel@tonic-gate
3247c478bd9Sstevel@tonic-gate elf->ed_arstr = mem;
3257c478bd9Sstevel@tonic-gate elf->ed_arstrsz = sz;
3267c478bd9Sstevel@tonic-gate elf->ed_arstroff = (char *)a - base;
3277c478bd9Sstevel@tonic-gate for (k = 0; k < sz; k++) {
3287c478bd9Sstevel@tonic-gate if (*mem == '/')
3297c478bd9Sstevel@tonic-gate *mem = '\0';
3307c478bd9Sstevel@tonic-gate ++mem;
3317c478bd9Sstevel@tonic-gate }
3327c478bd9Sstevel@tonic-gate *(mem - 1) = '\0';
333ba7866cdSAli Bahrami } else if (a->ar_name[1] == 'S' && a->ar_name[2] == 'Y' &&
334ba7866cdSAli Bahrami a->ar_name[3] == 'M' && a->ar_name[4] == '6' &&
335ba7866cdSAli Bahrami a->ar_name[5] == '4' && a->ar_name[6] == '/' &&
336ba7866cdSAli Bahrami a->ar_name[7] == ' ') {
337ba7866cdSAli Bahrami /* 64-bit symbol table */
338ba7866cdSAli Bahrami elf->ed_arsym = mem;
339ba7866cdSAli Bahrami elf->ed_arsymsz = sz;
340ba7866cdSAli Bahrami elf->ed_arsymoff = (char *)a - base;
341ba7866cdSAli Bahrami elf->ed_myflags |= EDF_ARSYM64;
3427c478bd9Sstevel@tonic-gate } else {
3437c478bd9Sstevel@tonic-gate return;
3447c478bd9Sstevel@tonic-gate }
3457c478bd9Sstevel@tonic-gate hdr += sz & 1;
3467c478bd9Sstevel@tonic-gate }
3477c478bd9Sstevel@tonic-gate }
348