1 /* Copyright (C) 1991 Free Software Foundation, Inc.
4 This file is part of GLD, the Gnu Linker.
6 GLD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GLD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GLD; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
40 /* Somewhere above, sys/stat.h got included . . . . */
41 #if !defined(S_ISDIR) && defined(S_IFDIR)
42 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
47 static char *get_emulation ();
48 static void set_scripts_dir ();
51 extern boolean lang_has_input_file;
52 extern boolean force_make_executable;
53 extern boolean relaxing;
54 extern boolean had_script;
59 char *output_filename = "a.out";
61 /* Name this program was invoked by. */
64 /* The file that we're creating */
67 /* set if -y on the command line */
70 /* The local symbol prefix */
73 /* Set by -G argument, for MIPS ECOFF target. */
74 int g_switch_value = 8;
76 /* Count the number of global symbols multiply defined. */
77 int multiple_def_count;
79 /* Count the number of symbols defined through common declarations.
80 This count is referenced in symdef_library, linear_library, and
81 modified by enter_global_ref.
83 It is incremented when a symbol is created as a common, and
84 decremented when the common declaration is overridden
86 Another way of thinking of it is that this is a count of
87 all ldsym_types with a ->scoms field */
89 unsigned int commons_pending;
91 /* Count the number of global symbols referenced and not defined.
92 common symbols are not included in this count. */
94 unsigned int undefined_global_sym_count;
96 /* Nonzero means print names of input files as processed. */
99 /* Nonzero means same, but note open failures, too. */
100 boolean trace_file_tries;
102 /* 1 => write load map. */
106 /* Indicates whether output file will be b.out (default) or coff */
107 enum target_flavour output_flavor = BFD_BOUT_FORMAT;
110 /* A count of the total number of local symbols ever seen - by adding
111 the symbol_count field of each newly read afile.*/
113 unsigned int total_symbols_seen;
115 /* A count of the number of read files - the same as the number of elements
118 unsigned int total_files_seen;
120 args_type command_line;
122 ld_config_type config;
131 program_name = argv[0];
135 /* Initialize the data about options. */
138 trace_files = trace_file_tries = false;
140 config.relocateable_output = false;
141 command_line.force_common_definition = false;
143 init_bfd_error_vector ();
145 ldfile_add_arch ("");
149 config.make_executable = true;
150 force_make_executable = false;
153 /* Initialize the cumulative counts of symbols. */
154 undefined_global_sym_count = 0;
155 multiple_def_count = 0;
158 config.magic_demand_paged = true;
159 config.text_read_only = true;
160 config.make_executable = true;
162 emulation = get_emulation (argc, argv);
163 ldemul_choose_mode (emulation);
164 default_target = ldemul_choose_target ();
166 ldemul_before_parse ();
167 lang_has_input_file = false;
168 parse_args (argc, argv);
170 if (had_script == false)
172 /* Read the emulation's appropriate default script. */
174 char *s = ldemul_get_script (&isfile);
178 /* sizeof counts the terminating NUL. */
179 size_t size = strlen (s) + sizeof ("-T ");
180 char *buf = (char *) ldmalloc(size);
181 sprintf (buf, "-T %s", s);
189 if (config.relocateable_output && command_line.relax)
191 einfo ("%P%F: -relax and -r may not be used together\n");
195 if (lang_has_input_file == false)
197 einfo ("%P%F: No input files\n");
202 info ("%P: mode %s\n", emulation);
205 ldemul_after_parse ();
208 if (config.map_filename)
210 if (strcmp (config.map_filename, "-") == 0)
212 config.map_file = stdout;
216 config.map_file = fopen (config.map_filename, FOPEN_WT);
217 if (config.map_file == (FILE *) NULL)
219 einfo ("%P%F: cannot open map file %s: %E\n",
220 config.map_filename);
228 /* Print error messages for any missing symbols, for any warning
229 symbols, and possibly multiple definitions */
232 if (config.text_read_only)
234 /* Look for a text section and mark the readonly attribute in it */
235 asection *found = bfd_get_section_by_name (output_bfd, ".text");
237 if (found != (asection *) NULL)
239 found->flags |= SEC_READONLY;
243 if (config.relocateable_output)
244 output_bfd->flags &= ~EXEC_P;
246 output_bfd->flags |= EXEC_P;
250 /* Even if we're producing relocateable output, some non-fatal errors should
251 be reported in the exit status. (What non-fatal errors, if any, do we
252 want to ignore for relocateable output?) */
254 if (config.make_executable == false && force_make_executable == false)
256 if (trace_files == true)
258 einfo ("%P: Link errors found, deleting executable `%s'\n",
262 if (output_bfd->iostream)
263 fclose ((FILE *) (output_bfd->iostream));
265 unlink (output_filename);
270 bfd_close (output_bfd);
276 /* We need to find any explicitly given emulation in order to initialize the
277 state that's needed by the lex&yacc argument parser (parse_args). */
280 get_emulation (argc, argv)
288 check_v960 (argc, argv);
289 emulation = "gld960";
290 for (i = 1; i < argc; i++)
292 if (!strcmp (argv[i], "-Fcoff"))
294 emulation = "lnk960";
295 output_flavor = BFD_COFF_FORMAT;
300 emulation = (char *) getenv (EMULATION_ENVIRON);
301 if (emulation == NULL)
302 emulation = DEFAULT_EMULATION;
305 for (i = 1; i < argc; i++)
307 if (!strncmp (argv[i], "-m", 2))
309 if (argv[i][2] == '\0')
314 emulation = argv[i + 1];
319 einfo("%P%F missing argument to -m\n");
325 emulation = &argv[i][2];
333 /* If directory DIR contains an "ldscripts" subdirectory,
334 add DIR to the library search path and return true,
335 else return false. */
338 check_for_scripts_dir (dir)
346 dirlen = strlen (dir);
347 /* sizeof counts the terminating NUL. */
348 buf = (char *) ldmalloc (dirlen + sizeof("/ldscripts"));
349 sprintf (buf, "%s/ldscripts", dir);
351 res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
354 ldfile_add_library_path (dir);
358 /* Set the default directory for finding script files.
359 Libraries will be searched for here too, but that's ok.
360 We look for the "ldscripts" directory in:
362 SCRIPTDIR (passed from Makefile)
363 the dir where this program is (for using it from the build tree)
364 the dir where this program is/../lib (for installing the tool suite elsewhere) */
372 if (check_for_scripts_dir (SCRIPTDIR))
373 return; /* We've been installed normally. */
375 /* Look for "ldscripts" in the dir where our binary is. */
376 end = strrchr (program_name, '/');
379 dirlen = end - program_name;
380 /* Make a copy of program_name in dir.
381 Leave room for later "/../lib". */
382 dir = (char *) ldmalloc (dirlen + 8);
383 strncpy (dir, program_name, dirlen);
389 dir = (char *) ldmalloc (dirlen + 8);
393 if (check_for_scripts_dir (dir))
394 return; /* Don't free dir. */
396 /* Look for "ldscripts" in <the dir where our binary is>/../lib. */
397 strcpy (dir + dirlen, "/../lib");
398 if (check_for_scripts_dir (dir))
401 free (dir); /* Well, we tried. */
405 read_entry_symbols (desc, entry)
407 struct lang_input_statement_struct *entry;
409 if (entry->asymbols == (asymbol **) NULL)
411 bfd_size_type table_size = get_symtab_upper_bound (desc);
413 entry->asymbols = (asymbol **) ldmalloc (table_size);
414 entry->symbol_count = bfd_canonicalize_symtab (desc, entry->asymbols);
419 * turn this item into a reference
426 asymbol *sym = *nlist_p;
430 sym->section = &bfd_und_section;
431 sym->udata = (PTR) (sp->srefs_chain);
432 sp->srefs_chain = nlist_p;
436 This function is called for each name which is seen which has a global
437 scope. It enters the name into the global symbol table in the correct
438 symbol on the correct chain. Remember that each ldsym_type has three
439 chains attatched, one of all definitions of a symbol, one of all
440 references of a symbol and one of all common definitions of a symbol.
442 When the function is over, the supplied is left connected to the bfd
443 to which is was born, with its udata field pointing to the next member
444 on the chain in which it has been inserted.
446 A certain amount of jigery pokery is necessary since commons come
447 along and upset things, we only keep one item in the common chain; the
448 one with the biggest size seen sofar. When another common comes along
449 it either bumps the previous definition into the ref chain, since it
450 is bigger, or gets turned into a ref on the spot since the one on the
451 common chain is already bigger. If a real definition comes along then
452 the common gets bumped off anyway.
454 Whilst all this is going on we keep a count of the number of multiple
455 definitions seen, undefined global symbols and pending commons.
459 enter_global_ref (nlist_p, name)
460 asymbol ** nlist_p; /* pointer into symbol table from incoming bfd */
461 CONST char *name; /* name of symbol in linker table */
463 asymbol *sym = *nlist_p;
466 /* Lookup the name from the incoming bfd's symbol table in the
467 linker's global symbol table */
470 flagword this_symbol_flags = sym->flags;
472 sp = ldsym_get (name);
475 /* If this symbol already has udata, it means that something strange
478 The strange thing is that we've had an undefined symbol resolved by
479 an alias, but the thing the alias defined wasn't in the file. So
480 the symbol got a udata entry, but the file wasn't loaded. Then
481 later on the file was loaded, but we don't need to do this
489 if (flag_is_constructor (this_symbol_flags))
491 /* Add this constructor to the list we keep */
492 ldlang_add_constructor (sp);
493 /* Turn any commons into refs */
494 if (sp->scoms_chain != (asymbol **) NULL)
496 refize (sp, sp->scoms_chain);
502 if (bfd_is_com_section (sym->section))
504 /* If we have a definition of this symbol already then
505 this common turns into a reference. Also we only
506 ever point to the largest common, so if we
507 have a common, but it's bigger that the new symbol
508 the turn this into a reference too. */
511 /* This is a common symbol, but we already have a definition
512 for it, so just link it into the ref chain as if
513 it were a reference */
514 if (config.warn_common)
515 multiple_warn("%C: warning: common of `%s' overridden by definition\n",
517 "%C: warning: defined here\n",
519 refize (sp, nlist_p);
521 else if (sp->scoms_chain)
523 /* If we have a previous common, keep only the biggest */
524 if ((*(sp->scoms_chain))->value > sym->value)
526 /* other common is bigger, throw this one away */
527 if (config.warn_common)
528 multiple_warn("%C: warning: common of `%s' overridden by larger common\n",
530 "%C: warning: larger common is here\n",
532 refize (sp, nlist_p);
534 else if (sp->scoms_chain != nlist_p)
536 /* other common is smaller, throw that away */
537 if (config.warn_common)
539 if ((*(sp->scoms_chain))->value < sym->value)
540 multiple_warn("%C: warning: common of `%s' overriding smaller common\n",
542 "%C: warning: smaller common is here\n",
545 multiple_warn("%C: warning: multiple common of `%s'\n",
547 "%C: warning: previous common is here\n",
550 refize (sp, sp->scoms_chain);
551 sp->scoms_chain = nlist_p;
556 /* This is the first time we've seen a common, so remember it
557 - if it was undefined before, we know it's defined now. If
558 the symbol has been marked as really being a constructor,
559 then treat this as a ref. */
560 if (sp->flags & SYM_CONSTRUCTOR)
562 /* Turn this into a ref */
563 refize (sp, nlist_p);
567 /* treat like a common */
569 undefined_global_sym_count--;
572 sp->scoms_chain = nlist_p;
576 else if (sym->section != &bfd_und_section)
578 /* This is the definition of a symbol, add to def chain */
579 if (sp->sdefs_chain && (*(sp->sdefs_chain))->section != sym->section)
581 /* Multiple definition */
582 multiple_warn("%X%C: multiple definition of `%s'\n",
584 "%X%C: first defined here\n",
586 multiple_def_count++;
590 sym->udata = (PTR) (sp->sdefs_chain);
591 sp->sdefs_chain = nlist_p;
593 /* A definition overrides a common symbol */
596 if (config.warn_common)
597 multiple_warn("%C: warning: definition of `%s' overriding common\n",
599 "%C: warning: common is here\n",
601 refize (sp, sp->scoms_chain);
605 else if (sp->srefs_chain && relaxing == false)
607 /* If previously was undefined, then remember as defined */
608 undefined_global_sym_count--;
613 if (sp->scoms_chain == (asymbol **) NULL
614 && sp->srefs_chain == (asymbol **) NULL
615 && sp->sdefs_chain == (asymbol **) NULL)
617 /* And it's the first time we've seen it */
618 undefined_global_sym_count++;
621 refize (sp, nlist_p);
625 ASSERT (sp->sdefs_chain == 0 || sp->scoms_chain == 0);
626 ASSERT (sp->scoms_chain == 0 || (*(sp->scoms_chain))->udata == 0);
632 enter_file_symbols (entry)
633 lang_input_statement_type *entry;
637 entry->common_section =
638 bfd_make_section_old_way (entry->the_bfd, "COMMON");
639 entry->common_section->flags = SEC_NEVER_LOAD;
640 ldlang_add_file (entry);
643 if (trace_files || trace_file_tries)
645 info ("%I\n", entry);
648 total_symbols_seen += entry->symbol_count;
650 if (entry->symbol_count)
652 for (q = entry->asymbols; *q; q++)
656 if (had_y && p->name)
658 /* look up the symbol anyway to see if the trace bit was
660 ldsym_type *s = ldsym_get (p->name);
661 if (s->flags & SYM_Y)
663 einfo ("%B: %s %T\n", entry->the_bfd,
664 p->section == &bfd_und_section ? "reference to" : "definition of ",
669 if (p->section == &bfd_ind_section)
673 else if (p->flags & BSF_WARNING)
677 else if (p->section == &bfd_und_section
678 || (p->flags & BSF_GLOBAL)
679 || bfd_is_com_section (p->section)
680 || (p->flags & BSF_CONSTRUCTOR))
686 if (p->flags & BSF_INDIRECT)
690 else if (p->flags & BSF_WARNING)
694 else if (p->section == &bfd_und_section
695 || (p->flags & BSF_GLOBAL)
696 || bfd_is_com_section (p->section)
697 || (p->flags & BSF_CONSTRUCTOR))
699 enter_global_ref (q, p->name);
709 /* Searching libraries */
711 struct lang_input_statement_struct *decode_library_subfile ();
712 void linear_library (), symdef_library ();
714 /* Search the library ENTRY, already open on descriptor DESC.
715 This means deciding which library members to load,
716 making a chain of `struct lang_input_statement_struct' for those members,
717 and entering their global symbols in the hash table. */
720 search_library (entry)
721 struct lang_input_statement_struct *entry;
724 /* No need to load a library if no undefined symbols */
725 if (!undefined_global_sym_count)
728 if (bfd_has_map (entry->the_bfd))
729 symdef_library (entry);
731 linear_library (entry);
738 gnu960_check_format (abfd, format)
744 if ((bfd_check_format (abfd, format) == true)
745 && (abfd->xvec->flavour == output_flavor))
757 ldmain_open_file_read_symbol (entry)
758 struct lang_input_statement_struct *entry;
760 if (entry->asymbols == (asymbol **) NULL
761 && entry->real == true
762 && entry->filename != (char *) NULL)
764 ldfile_open_file (entry);
768 if (gnu960_check_format (entry->the_bfd, bfd_object))
770 if (bfd_check_format (entry->the_bfd, bfd_object))
773 entry->the_bfd->usrdata = (PTR) entry;
776 read_entry_symbols (entry->the_bfd, entry);
778 /* look through the sections in the file and see if any of them
780 ldlang_check_for_constructors (entry);
782 enter_file_symbols (entry);
785 else if (gnu960_check_format (entry->the_bfd, bfd_archive))
787 else if (bfd_check_format (entry->the_bfd, bfd_archive))
790 entry->the_bfd->usrdata = (PTR) entry;
792 entry->subfiles = (lang_input_statement_type *) NULL;
793 search_library (entry);
797 einfo ("%F%B: malformed input file (not rel or archive) \n",
804 /* Construct and return a lang_input_statement_struct for a library member.
805 The library's lang_input_statement_struct is library_entry,
806 and the library is open on DESC.
807 SUBFILE_OFFSET is the byte index in the library of this member's header.
808 We store the length of the member into *LENGTH_LOC. */
810 lang_input_statement_type *
811 decode_library_subfile (library_entry, subfile_offset)
812 struct lang_input_statement_struct *library_entry;
815 register struct lang_input_statement_struct *subentry;
818 /* First, check if we already have a loaded
819 lang_input_statement_struct for this library subfile. If so,
820 just return it. Otherwise, allocate some space and build a new one. */
822 if (subfile_offset->usrdata
823 && ((struct lang_input_statement_struct *) subfile_offset->usrdata)->
826 subentry = (struct lang_input_statement_struct *) subfile_offset->usrdata;
831 (struct lang_input_statement_struct *)
832 ldmalloc ((bfd_size_type) (sizeof (struct lang_input_statement_struct)));
834 subentry->filename = subfile_offset->filename;
835 subentry->local_sym_name = subfile_offset->filename;
836 subentry->asymbols = 0;
837 subentry->the_bfd = subfile_offset;
838 subentry->subfiles = 0;
840 subentry->superfile = library_entry;
841 subentry->is_archive = false;
843 subentry->just_syms_flag = false;
844 subentry->loaded = false;
850 boolean subfile_wanted_p ();
852 clear_syms (entry, offset)
853 struct lang_input_statement_struct *entry;
857 unsigned long indx = bfd_get_next_mapent (entry->the_bfd,
861 while (indx != BFD_NO_MORE_SYMBOLS)
863 if (car->file_offset == offset)
867 indx = bfd_get_next_mapent (entry->the_bfd, indx, &car);
872 /* Search a library that has a map
875 symdef_library (entry)
876 struct lang_input_statement_struct *entry;
879 register struct lang_input_statement_struct *prev = 0;
881 boolean not_finished = true;
883 while (not_finished == true)
885 carsym *exported_library_name;
886 bfd *prev_archive_member_bfd = 0;
888 int idx = bfd_get_next_mapent (entry->the_bfd,
890 &exported_library_name);
892 not_finished = false;
894 while (idx != BFD_NO_MORE_SYMBOLS && undefined_global_sym_count)
897 if (exported_library_name->name)
900 ldsym_type *sp = ldsym_get_soft (exported_library_name->name);
902 /* If we find a symbol that appears to be needed, think carefully
903 about the archive member that the symbol is in. */
904 /* So - if it exists, and is referenced somewhere and is
906 if (sp && sp->srefs_chain && !sp->sdefs_chain)
908 bfd *archive_member_bfd = bfd_get_elt_at_index (entry->the_bfd, idx);
909 struct lang_input_statement_struct *archive_member_lang_input_statement_struct;
912 if (archive_member_bfd && gnu960_check_format (archive_member_bfd, bfd_object))
914 if (archive_member_bfd && bfd_check_format (archive_member_bfd, bfd_object))
918 /* Don't think carefully about any archive member
919 more than once in a given pass. */
920 if (prev_archive_member_bfd != archive_member_bfd)
923 prev_archive_member_bfd = archive_member_bfd;
925 /* Read the symbol table of the archive member. */
927 if (archive_member_bfd->usrdata != (PTR) NULL)
930 archive_member_lang_input_statement_struct = (lang_input_statement_type *) archive_member_bfd->usrdata;
935 archive_member_lang_input_statement_struct =
936 decode_library_subfile (entry, archive_member_bfd);
937 archive_member_bfd->usrdata = (PTR) archive_member_lang_input_statement_struct;
941 if (archive_member_lang_input_statement_struct == 0)
943 einfo ("%F%I contains invalid archive member %s\n",
947 if (archive_member_lang_input_statement_struct->loaded == false)
950 read_entry_symbols (archive_member_bfd, archive_member_lang_input_statement_struct);
951 /* Now scan the symbol table and decide whether to load. */
954 if (subfile_wanted_p (archive_member_lang_input_statement_struct) == true)
957 /* This member is needed; load it.
958 Since we are loading something on this pass,
959 we must make another pass through the symdef data. */
963 enter_file_symbols (archive_member_lang_input_statement_struct);
966 prev->chain = archive_member_lang_input_statement_struct;
968 entry->subfiles = archive_member_lang_input_statement_struct;
971 prev = archive_member_lang_input_statement_struct;
974 /* Clear out this member's symbols from the symdef data
975 so that following passes won't waste time on them. */
976 clear_syms (entry, exported_library_name->file_offset);
977 archive_member_lang_input_statement_struct->loaded = true;
984 idx = bfd_get_next_mapent (entry->the_bfd, idx, &exported_library_name);
990 linear_library (entry)
991 struct lang_input_statement_struct *entry;
993 boolean more_to_do = true;
994 register struct lang_input_statement_struct *prev = 0;
996 if (entry->complained == false)
998 if (entry->the_bfd->xvec->flavour != bfd_target_ieee_flavour)
1001 /* IEEE can use table of contents, so this message is bogus */
1002 einfo ("%P: library %s has bad table of contents, rerun ranlib\n",
1003 entry->the_bfd->filename);
1005 entry->complained = true;
1011 bfd *archive = bfd_openr_next_archived_file (entry->the_bfd, 0);
1016 /* Don't check this file if it's already been read in
1019 if (!archive->usrdata ||
1020 !((lang_input_statement_type *) (archive->usrdata))->loaded)
1023 if (gnu960_check_format (archive, bfd_object))
1025 if (bfd_check_format (archive, bfd_object))
1028 register struct lang_input_statement_struct *subentry;
1030 subentry = decode_library_subfile (entry,
1033 archive->usrdata = (PTR) subentry;
1036 if (subentry->loaded == false)
1038 read_entry_symbols (archive, subentry);
1040 if (subfile_wanted_p (subentry) == true)
1042 enter_file_symbols (subentry);
1045 prev->chain = subentry;
1047 entry->subfiles = subentry;
1051 subentry->loaded = true;
1056 archive = bfd_openr_next_archived_file (entry->the_bfd, archive);
1063 /* ENTRY is an entry for a file inside an archive
1064 Its symbols have been read into core, but not entered into the
1066 Return nonzero if we ought to load this file */
1069 subfile_wanted_p (entry)
1070 struct lang_input_statement_struct *entry;
1074 if (entry->symbol_count == 0)
1077 for (q = entry->asymbols; *q; q++)
1081 /* If the symbol has an interesting definition, we could
1082 potentially want it. */
1084 if (p->flags & BSF_INDIRECT)
1086 /** add_indirect(q);*/
1089 if (bfd_is_com_section (p->section)
1090 || (p->flags & BSF_GLOBAL)
1091 || (p->flags & BSF_INDIRECT))
1093 register ldsym_type *sp = ldsym_get_soft (p->name);
1095 /* If this symbol has not been hashed,
1096 we can't be looking for it. */
1097 if (sp != (ldsym_type *) NULL
1098 && sp->sdefs_chain == (asymbol **) NULL)
1100 if (sp->srefs_chain != (asymbol **) NULL
1101 || sp->scoms_chain != (asymbol **) NULL)
1103 /* This is a symbol we are looking for. It is
1104 either not yet defined or common. If this is a
1105 common symbol, then if the symbol in the object
1106 file is common, we need to combine sizes. But if
1107 we already have a common symbol, and the symbol
1108 in the object file is not common, we don't want
1109 the object file: it is providing a definition for
1110 a symbol that we already have a definition for
1111 (this is the else condition below). */
1112 if (bfd_is_com_section (p->section))
1115 /* If the symbol in the table is a constructor, we won't to
1116 anything fancy with it */
1117 if ((sp->flags & SYM_CONSTRUCTOR) == 0)
1119 /* This libary member has something to
1120 say about this element. We should
1121 remember if its a new size */
1122 /* Move something from the ref list to the com list */
1123 if (sp->scoms_chain)
1125 /* Already a common symbol, maybe update it */
1126 if (p->value > (*(sp->scoms_chain))->value)
1128 (*(sp->scoms_chain))->value = p->value;
1133 /* Take a value from the ref chain
1134 Here we are moving a symbol from the owning bfd
1135 to another bfd. We must set up the
1136 common_section portion of the bfd thing */
1140 sp->scoms_chain = sp->srefs_chain;
1142 (asymbol **) ((*(sp->srefs_chain))->udata);
1143 (*(sp->scoms_chain))->udata = (PTR) NULL;
1145 (*(sp->scoms_chain))->section = p->section;
1146 (*(sp->scoms_chain))->flags = 0;
1147 /* Remember the size of this item */
1148 sp->scoms_chain[0]->value = p->value;
1150 undefined_global_sym_count--;
1153 asymbol *com = *(sp->scoms_chain);
1155 if (((lang_input_statement_type *)
1156 (bfd_asymbol_bfd (com)->usrdata))->common_section ==
1159 ((lang_input_statement_type *)
1160 (bfd_asymbol_bfd (com)->usrdata))->common_section =
1161 bfd_make_section_old_way (bfd_asymbol_bfd (com), "COMMON");
1165 ASSERT (p->udata == 0);
1167 else if (sp->scoms_chain == (asymbol **) NULL)
1171 info ("%I needed due to %s\n", entry, sp->name);
1187 ldsym_type *lookup = ldsym_get (text);
1188 lookup->flags |= SYM_Y;