1 /* NLM (NetWare Loadable Module) executable support for BFD.
2 Copyright (C) 1993 Free Software Foundation, Inc.
4 Written by Fred Fish @ Cygnus Support, using ELF support as the
7 This file is part of BFD, the Binary File Descriptor library.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
23 #include <string.h> /* For strrchr and friends */
29 #define Nlm_External_Fixed_Header NAME(Nlm,External_Fixed_Header)
30 #define Nlm_External_Version_Header NAME(Nlm,External_Version_Header)
31 #define Nlm_External_Copyright_Header NAME(Nlm,External_Copyright_Header)
32 #define Nlm_External_Extended_Header NAME(Nlm,External_Extended_Header)
33 #define Nlm_External_Custom_Header NAME(Nlm,External_Custom_Header)
35 #define nlm_symbol_type NAME(nlm,symbol_type)
37 #define nlm_get_symtab_upper_bound NAME(bfd_nlm,get_symtab_upper_bound)
38 #define nlm_get_symtab NAME(bfd_nlm,get_symtab)
39 #define nlm_make_empty_symbol NAME(bfd_nlm,make_empty_symbol)
40 #define nlm_print_symbol NAME(bfd_nlm,print_symbol)
41 #define nlm_get_symbol_info NAME(bfd_nlm,get_symbol_info)
42 #define nlm_set_arch_mach NAME(bfd_nlm,set_arch_mach)
43 #define nlm_object_p NAME(bfd_nlm,object_p)
45 #define MSB (~(~(unsigned long)0 >> 1))
47 /* Forward declarations of static functions */
49 static boolean add_bfd_section
50 PARAMS ((bfd *, char *, file_ptr, bfd_size_type, flagword));
52 static void nlm_swap_fixed_header_in
53 PARAMS ((bfd *, Nlm_External_Fixed_Header *, Nlm_Internal_Fixed_Header *));
55 static boolean nlm_swap_variable_header_in PARAMS ((bfd *));
57 static boolean nlm_swap_auxiliary_headers_in PARAMS ((bfd *));
59 static struct sec *section_from_nlm_index PARAMS ((bfd *, int));
61 static int nlm_section_from_bfd_section PARAMS ((bfd *, struct sec *));
63 static boolean nlm_slurp_symbol_table PARAMS ((bfd *, asymbol **));
65 static int nlm_symbol_from_bfd_symbol
66 PARAMS ((bfd *, struct symbol_cache_entry **));
68 static void nlm_map_symbols PARAMS ((bfd *));
70 /* Should perhaps use put_offset, put_word, etc. For now, the two versions
71 can be handled by explicitly specifying 32 bits or "the long type". */
73 #define put_word bfd_h_put_64
74 #define get_word bfd_h_get_64
77 #define put_word bfd_h_put_32
78 #define get_word bfd_h_get_32
82 DEFUN (nlm_object_p, (abfd), bfd * abfd)
84 Nlm_External_Fixed_Header x_fxdhdr; /* Nlm file header, external form */
85 Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form */
88 /* Read in the fixed length portion of the NLM header in external format. */
90 if (bfd_read ((PTR) &x_fxdhdr, sizeof (x_fxdhdr), 1, abfd) !=
93 bfd_error = system_call_error;
97 /* Check to see if we have an NLM file by matching the NLM signature. */
99 if (strncmp (&x_fxdhdr.signature, NLM_SIGNATURE, NLM_SIGNATURE_SIZE) != 0)
102 bfd_error = wrong_format;
106 /* There's no supported way to discover the endianess of an NLM, so test for
107 a sane version number after doing byte swapping appropriate for this
108 XVEC. (Hack alert!) */
110 if (get_word (abfd, (bfd_byte *) &x_fxdhdr.version) > 0xFFFF)
115 /* There's no supported way to check for 32 bit versus 64 bit addresses,
116 so ignore this distinction for now. (FIXME) */
118 /* Allocate an instance of the nlm_obj_tdata structure and hook it up to
119 the tdata pointer in the bfd. */
121 nlm_tdata (abfd) = (struct nlm_obj_tdata *)
122 bfd_zalloc (abfd, sizeof (struct nlm_obj_tdata));
123 if (nlm_tdata (abfd) == NULL)
125 bfd_error = no_memory;
129 /* FIXME: Any `wrong' exits below here will leak memory (tdata). */
131 /* Swap in the rest of the fixed length header. */
133 i_fxdhdrp = nlm_fixed_header (abfd);
134 nlm_swap_fixed_header_in (abfd, &x_fxdhdr, i_fxdhdrp);
136 if (!nlm_swap_variable_header_in (abfd)
137 || !nlm_swap_auxiliary_headers_in (abfd)
138 || !add_bfd_section (abfd, NLM_CODE_NAME,
139 i_fxdhdrp -> codeImageOffset,
140 i_fxdhdrp -> codeImageSize,
141 SEC_CODE | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS)
142 || !add_bfd_section (abfd, NLM_INITIALIZED_DATA_NAME,
143 i_fxdhdrp -> dataImageOffset,
144 i_fxdhdrp -> dataImageSize,
145 SEC_DATA | SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS)
146 || !add_bfd_section (abfd, NLM_UNINITIALIZED_DATA_NAME,
148 i_fxdhdrp -> uninitializedDataSize,
149 SEC_DATA | SEC_ALLOC))
154 return (abfd -> xvec);
157 /* Add a section to the bfd. */
160 DEFUN (add_bfd_section, (abfd, name, offset, size, flags),
164 bfd_size_type size AND
169 newsect = bfd_make_section (abfd, name);
174 newsect -> vma = 0; /* NLM's are relocatable. */
175 newsect -> _raw_size = size;
176 newsect -> filepos = offset;
177 newsect -> flags = flags;
178 newsect -> alignment_power = bfd_log2 (0); /* FIXME */
183 /* Translate an NLM fixed length file header in external format into an NLM
184 file header in internal format. */
187 DEFUN (nlm_swap_fixed_header_in, (abfd, src, dst),
189 Nlm_External_Fixed_Header * src AND
190 Nlm_Internal_Fixed_Header * dst)
192 memcpy (dst -> signature, src -> signature, NLM_SIGNATURE_SIZE);
193 memcpy (dst -> moduleName, src -> moduleName, NLM_MODULE_NAME_SIZE);
195 get_word (abfd, (bfd_byte *) src -> version);
196 dst -> codeImageOffset =
197 get_word (abfd, (bfd_byte *) src -> codeImageOffset);
198 dst -> codeImageSize =
199 get_word (abfd, (bfd_byte *) src -> codeImageSize);
200 dst -> dataImageOffset =
201 get_word (abfd, (bfd_byte *) src -> dataImageOffset);
202 dst -> dataImageSize =
203 get_word (abfd, (bfd_byte *) src -> dataImageSize);
204 dst -> uninitializedDataSize =
205 get_word (abfd, (bfd_byte *) src -> uninitializedDataSize);
206 dst -> customDataOffset =
207 get_word (abfd, (bfd_byte *) src -> customDataOffset);
208 dst -> customDataSize =
209 get_word (abfd, (bfd_byte *) src -> customDataSize);
210 dst -> moduleDependencyOffset =
211 get_word (abfd, (bfd_byte *) src -> moduleDependencyOffset);
212 dst -> numberOfModuleDependencies =
213 get_word (abfd, (bfd_byte *) src -> numberOfModuleDependencies);
214 dst -> relocationFixupOffset =
215 get_word (abfd, (bfd_byte *) src -> relocationFixupOffset);
216 dst -> numberOfRelocationFixups =
217 get_word (abfd, (bfd_byte *) src -> numberOfRelocationFixups);
218 dst -> externalReferencesOffset =
219 get_word (abfd, (bfd_byte *) src -> externalReferencesOffset);
220 dst -> numberOfExternalReferences =
221 get_word (abfd, (bfd_byte *) src -> numberOfExternalReferences);
222 dst -> publicsOffset =
223 get_word (abfd, (bfd_byte *) src -> publicsOffset);
224 dst -> numberOfPublics =
225 get_word (abfd, (bfd_byte *) src -> numberOfPublics);
226 dst -> debugInfoOffset =
227 get_word (abfd, (bfd_byte *) src -> debugInfoOffset);
228 dst -> numberOfDebugRecords =
229 get_word (abfd, (bfd_byte *) src -> numberOfDebugRecords);
230 dst -> codeStartOffset =
231 get_word (abfd, (bfd_byte *) src -> codeStartOffset);
232 dst -> exitProcedureOffset =
233 get_word (abfd, (bfd_byte *) src -> exitProcedureOffset);
234 dst -> checkUnloadProcedureOffset =
235 get_word (abfd, (bfd_byte *) src -> checkUnloadProcedureOffset);
237 get_word (abfd, (bfd_byte *) src -> moduleType);
239 get_word (abfd, (bfd_byte *) src -> flags);
242 /* Read and swap in the variable length header. All the fields must
243 exist in the NLM, and must exist in the order they are read here. */
246 DEFUN (nlm_swap_variable_header_in, (abfd),
249 unsigned char temp [TARGET_LONG_SIZE];
251 /* Read the description length and text members. */
253 if (bfd_read ((PTR) &nlm_variable_header (abfd) -> descriptionLength,
254 sizeof (nlm_variable_header (abfd) -> descriptionLength),
256 sizeof (nlm_variable_header (abfd) -> descriptionLength))
258 bfd_error = system_call_error;
261 if (bfd_read ((PTR) nlm_variable_header (abfd) -> descriptionText,
262 nlm_variable_header (abfd) -> descriptionLength + 1,
264 nlm_variable_header (abfd) -> descriptionLength + 1)
266 bfd_error = system_call_error;
270 /* Read and convert the stackSize field. */
272 if (bfd_read ((PTR) &temp, sizeof (temp), 1, abfd) != sizeof (temp))
274 bfd_error = system_call_error;
277 nlm_variable_header (abfd) -> stackSize = get_word (abfd, (bfd_byte *) temp);
279 /* Read and convert the reserved field. */
281 if (bfd_read ((PTR) &temp, sizeof (temp), 1, abfd) != sizeof (temp))
283 bfd_error = system_call_error;
286 nlm_variable_header (abfd) -> reserved = get_word (abfd, (bfd_byte *) temp);
288 /* Read the oldThreadName field. This field is a fixed length string. */
290 if (bfd_read ((PTR) nlm_variable_header (abfd) -> oldThreadName,
291 sizeof (nlm_variable_header (abfd) -> oldThreadName),
293 sizeof (nlm_variable_header (abfd) -> oldThreadName))
295 bfd_error = system_call_error;
299 /* Read the screen name length and text members. */
301 if (bfd_read ((PTR) &nlm_variable_header (abfd) -> screenNameLength,
302 sizeof (nlm_variable_header (abfd) -> screenNameLength),
304 sizeof (nlm_variable_header (abfd) -> screenNameLength))
306 bfd_error = system_call_error;
309 if (bfd_read ((PTR) nlm_variable_header (abfd) -> screenName,
310 nlm_variable_header (abfd) -> screenNameLength + 1,
312 nlm_variable_header (abfd) -> screenNameLength + 1)
314 bfd_error = system_call_error;
318 /* Read the thread name length and text members. */
320 if (bfd_read ((PTR) &nlm_variable_header (abfd) -> threadNameLength,
321 sizeof (nlm_variable_header (abfd) -> threadNameLength),
323 sizeof (nlm_variable_header (abfd) -> threadNameLength))
325 bfd_error = system_call_error;
328 if (bfd_read ((PTR) nlm_variable_header (abfd) -> threadName,
329 nlm_variable_header (abfd) -> threadNameLength + 1,
331 nlm_variable_header (abfd) -> threadNameLength + 1)
333 bfd_error = system_call_error;
339 /* Read and swap in the contents of all the auxiliary headers. Because of
340 the braindead design, we have to do strcmps on strings of indeterminate
341 length to figure out what each auxiliary header is. Even worse, we have
342 no way of knowing how many auxiliary headers there are or where the end
343 of the auxiliary headers are, except by finding something that doesn't
344 look like a known auxiliary header. This means that the first new type
345 of auxiliary header added will break all existing tools that don't
349 DEFUN (nlm_swap_auxiliary_headers_in, (abfd),
352 unsigned char temp [TARGET_LONG_SIZE];
353 unsigned char tempstr [16];
358 position = bfd_tell (abfd);
359 if (bfd_read ((PTR) tempstr, sizeof (tempstr), 1, abfd) !=
362 bfd_error = system_call_error;
365 if (bfd_seek (abfd, position, SEEK_SET) == -1)
367 bfd_error = system_call_error;
370 if (strncmp (tempstr, "VeRsIoN#", 8) == 0)
372 Nlm_External_Version_Header thdr;
373 if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
375 bfd_error = system_call_error;
378 memcpy (nlm_version_header (abfd) -> stamp, thdr.stamp,
379 sizeof (thdr.stamp));
380 nlm_version_header (abfd) -> majorVersion =
381 get_word (abfd, (bfd_byte *) thdr.majorVersion);
382 nlm_version_header (abfd) -> minorVersion =
383 get_word (abfd, (bfd_byte *) thdr.minorVersion);
384 nlm_version_header (abfd) -> revision =
385 get_word (abfd, (bfd_byte *) thdr.revision);
386 nlm_version_header (abfd) -> year =
387 get_word (abfd, (bfd_byte *) thdr.year);
388 nlm_version_header (abfd) -> month =
389 get_word (abfd, (bfd_byte *) thdr.month);
390 nlm_version_header (abfd) -> day =
391 get_word (abfd, (bfd_byte *) thdr.day);
393 else if (strncmp (tempstr, "MeSsAgEs", 8) == 0)
395 Nlm_External_Extended_Header thdr;
396 if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
398 bfd_error = system_call_error;
401 memcpy (nlm_extended_header (abfd) -> stamp, thdr.stamp,
402 sizeof (thdr.stamp));
403 nlm_extended_header (abfd) -> languageID =
404 get_word (abfd, (bfd_byte *) thdr.languageID);
405 nlm_extended_header (abfd) -> messageFileOffset =
406 get_word (abfd, (bfd_byte *) thdr.messageFileOffset);
407 nlm_extended_header (abfd) -> messageFileLength =
408 get_word (abfd, (bfd_byte *) thdr.messageFileLength);
409 nlm_extended_header (abfd) -> messageCount =
410 get_word (abfd, (bfd_byte *) thdr.messageCount);
411 nlm_extended_header (abfd) -> helpFileOffset =
412 get_word (abfd, (bfd_byte *) thdr.helpFileOffset);
413 nlm_extended_header (abfd) -> helpFileLength =
414 get_word (abfd, (bfd_byte *) thdr.helpFileLength);
415 nlm_extended_header (abfd) -> RPCDataOffset =
416 get_word (abfd, (bfd_byte *) thdr.RPCDataOffset);
417 nlm_extended_header (abfd) -> RPCDataLength =
418 get_word (abfd, (bfd_byte *) thdr.RPCDataLength);
419 nlm_extended_header (abfd) -> sharedCodeOffset =
420 get_word (abfd, (bfd_byte *) thdr.sharedCodeOffset);
421 nlm_extended_header (abfd) -> sharedCodeLength =
422 get_word (abfd, (bfd_byte *) thdr.sharedCodeLength);
423 nlm_extended_header (abfd) -> sharedDataOffset =
424 get_word (abfd, (bfd_byte *) thdr.sharedDataOffset);
425 nlm_extended_header (abfd) -> sharedDataLength =
426 get_word (abfd, (bfd_byte *) thdr.sharedDataLength);
427 nlm_extended_header (abfd) -> sharedRelocationFixupOffset =
428 get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupOffset);
429 nlm_extended_header (abfd) -> sharedRelocationFixupCount =
430 get_word (abfd, (bfd_byte *) thdr.sharedRelocationFixupCount);
431 nlm_extended_header (abfd) -> sharedExternalReferenceOffset =
432 get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceOffset);
433 nlm_extended_header (abfd) -> sharedExternalReferenceCount =
434 get_word (abfd, (bfd_byte *) thdr.sharedExternalReferenceCount);
435 nlm_extended_header (abfd) -> sharedPublicsOffset =
436 get_word (abfd, (bfd_byte *) thdr.sharedPublicsOffset);
437 nlm_extended_header (abfd) -> sharedPublicsCount =
438 get_word (abfd, (bfd_byte *) thdr.sharedPublicsCount);
439 nlm_extended_header (abfd) -> SharedInitializationOffset =
440 get_word (abfd, (bfd_byte *) thdr.sharedInitializationOffset);
441 nlm_extended_header (abfd) -> SharedExitProcedureOffset =
442 get_word (abfd, (bfd_byte *) thdr.SharedExitProcedureOffset);
443 nlm_extended_header (abfd) -> productID =
444 get_word (abfd, (bfd_byte *) thdr.productID);
445 nlm_extended_header (abfd) -> reserved0 =
446 get_word (abfd, (bfd_byte *) thdr.reserved0);
447 nlm_extended_header (abfd) -> reserved1 =
448 get_word (abfd, (bfd_byte *) thdr.reserved1);
449 nlm_extended_header (abfd) -> reserved2 =
450 get_word (abfd, (bfd_byte *) thdr.reserved2);
451 nlm_extended_header (abfd) -> reserved3 =
452 get_word (abfd, (bfd_byte *) thdr.reserved3);
453 nlm_extended_header (abfd) -> reserved4 =
454 get_word (abfd, (bfd_byte *) thdr.reserved4);
455 nlm_extended_header (abfd) -> reserved5 =
456 get_word (abfd, (bfd_byte *) thdr.reserved5);
458 else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
460 Nlm_External_Custom_Header thdr;
461 if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
463 bfd_error = system_call_error;
466 memcpy (nlm_custom_header (abfd) -> stamp, thdr.stamp,
467 sizeof (thdr.stamp));
468 nlm_custom_header (abfd) -> dataLength =
469 get_word (abfd, (bfd_byte *) thdr.dataLength);
470 nlm_custom_header (abfd) -> debugRecOffset =
471 get_word (abfd, (bfd_byte *) thdr.debugRecOffset);
472 nlm_custom_header (abfd) -> debugRecLength =
473 get_word (abfd, (bfd_byte *) thdr.debugRecLength);
475 else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0)
477 Nlm_External_Copyright_Header thdr;
478 if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr))
480 bfd_error = system_call_error;
483 memcpy (nlm_copyright_header (abfd) -> stamp, thdr.stamp,
484 sizeof (thdr.stamp));
485 nlm_copyright_header (abfd) -> copyrightMessageLength =
486 get_word (abfd, (bfd_byte *) thdr.copyrightMessageLength);
487 /* The copyright message is a variable length string. */
488 if (bfd_read ((PTR) nlm_copyright_header (abfd) -> copyrightMessage,
489 nlm_copyright_header (abfd) -> copyrightMessageLength + 1,
491 nlm_copyright_header (abfd) -> copyrightMessageLength + 1)
493 bfd_error = system_call_error;
504 /* We read the NLM's public symbols and use it to generate a bfd symbol
505 table (hey, it's better than nothing) on a one-for-one basis. Thus
506 use the number of public symbols as the number of bfd symbols we will
507 have once we actually get around to reading them in.
509 Return the number of bytes required to hold the symtab vector, based on
510 the count plus 1, since we will NULL terminate the vector allocated based
514 DEFUN (nlm_get_symtab_upper_bound, (abfd), bfd * abfd)
516 Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form */
517 unsigned int symcount;
518 unsigned int symtab_size = 0;
520 i_fxdhdrp = nlm_fixed_header (abfd);
521 symcount = i_fxdhdrp -> numberOfPublics;
522 symtab_size = (symcount + 1) * (sizeof (asymbol));
523 return (symtab_size);
526 /* Note that bfd_get_symcount is guaranteed to be zero if slurping the
527 symbol table fails. */
530 DEFUN (nlm_get_symtab, (abfd, alocation),
534 nlm_slurp_symbol_table (abfd, alocation);
535 return (bfd_get_symcount (abfd));
539 DEFUN (nlm_make_empty_symbol, (abfd), /* FIXME! */
542 asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
543 new -> the_bfd = abfd;
548 DEFUN (nlm_get_symbol_info, (ignore_abfd, symbol, ret),
549 bfd * ignore_abfd AND
553 bfd_symbol_info (symbol, ret);
557 DEFUN (nlm_set_arch_mach, (abfd, arch, machine),
559 enum bfd_architecture arch AND
560 unsigned long machine)
565 /* Slurp in nlm symbol table.
567 In the external (in-file) form, NLM export records are variable length,
568 with the following form:
570 1 byte length of the symbol name (N)
571 N bytes the symbol name
572 4 bytes the symbol offset from start of it's section
574 Note that we currently ignore the internal debug records. There is
575 a lot of duplication between the export records and the internal debug
576 records. We may in the future, want to merge the information from the
577 debug records with the information from the export records to produce
578 a more complete symbol table, treating additional information from the
579 debug records as static symbols. (FIXME)
581 If SYMPTRS is non-NULL, the bfd symbols are copied to where it points.
583 When we return, the bfd symcount is either zero or contains the correct
588 DEFUN (nlm_slurp_symbol_table, (abfd, symptrs),
590 asymbol **symptrs) /* Buffer for generated bfd symbols */
592 Nlm_Internal_Fixed_Header *i_fxdhdrp; /* Nlm file header, internal form */
593 int symcount; /* Number of external NLM symbols */
595 nlm_symbol_type *sym; /* Pointer to current bfd symbol */
596 nlm_symbol_type *symbase; /* Buffer for generated bfd symbols */
597 char symlength; /* Symbol length read into here */
598 long symoffset; /* Symbol offset read into here */
600 if (bfd_get_outsymbols (abfd) != NULL)
605 /* Read each raw NLM symbol, using the information to create a canonical bfd
608 Note that we allocate the initial bfd canonical symbol buffer based on a
609 one-to-one mapping of the NLM symbols to canonical symbols. We actually
610 use all the NLM symbols, so there will be no space left over at the end.
611 When we have all the symbols, we build the caller's pointer vector. */
613 abfd -> symcount = 0;
614 i_fxdhdrp = nlm_fixed_header (abfd);
615 symcount = i_fxdhdrp -> numberOfPublics;
620 if (bfd_seek (abfd, i_fxdhdrp -> publicsOffset, SEEK_SET) == -1)
622 bfd_error = system_call_error;
625 symbase = (nlm_symbol_type *)
626 bfd_zalloc (abfd, symcount * sizeof (nlm_symbol_type));
629 /* We use the bfd's symcount directly as the control count, so that early
630 termination of the loop leaves the symcount correct for the symbols that
633 while (abfd -> symcount < symcount)
635 if (bfd_read ((PTR) &symlength, sizeof (symlength), 1, abfd)
636 != sizeof (symlength))
638 bfd_error = system_call_error;
641 sym -> symbol.the_bfd = abfd;
642 sym -> symbol.name = bfd_alloc (abfd, symlength + 1);
643 if (bfd_read ((PTR) sym -> symbol.name, symlength, 1, abfd)
646 bfd_error = system_call_error;
649 if (bfd_read ((PTR) &symoffset, sizeof (symoffset), 1, abfd)
650 != sizeof (symoffset))
652 bfd_error = system_call_error;
655 sym -> symbol.flags = BSF_GLOBAL | BSF_EXPORT;
656 sym -> symbol.value = get_word (abfd, (bfd_byte *) &symoffset);
657 if (sym -> symbol.value & MSB)
659 sym -> symbol.value &= ~MSB;
660 sym -> symbol.flags |= BSF_FUNCTION;
661 sym -> symbol.section =
662 bfd_get_section_by_name (abfd, NLM_CODE_NAME);
666 sym -> symbol.section =
667 bfd_get_section_by_name (abfd, NLM_INITIALIZED_DATA_NAME);
673 /* Fill in the user's symbol pointer vector if needed. */
678 symcount = abfd -> symcount;
679 while (symcount-- > 0)
681 *symptrs++ = &sym -> symbol;
684 *symptrs = NULL; /* Final NULL pointer */