1 /* Copyright (C) 1991 Free Software Foundation, Inc.
2 Written by Steve Chamberlain steve@cygnus.com
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. */
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. */
173 char *scriptname = ldemul_get_script ();
174 /* sizeof counts the terminating NUL. */
175 size_t size = strlen (scriptname) + sizeof ("-T /ldscripts/");
176 char *buf = (char *) ldmalloc(size);
177 /* The initial slash prevents finding the script in `.' first. */
178 sprintf (buf, "-T /ldscripts/%s", scriptname);
183 if (config.relocateable_output && command_line.relax)
185 einfo ("%P%F: -relax and -r may not be used together\n");
189 if (lang_has_input_file == false)
191 einfo ("%P%F: No input files\n");
196 info ("%P: mode %s\n", emulation);
199 ldemul_after_parse ();
202 if (config.map_filename)
204 if (strcmp (config.map_filename, "-") == 0)
206 config.map_file = stdout;
210 config.map_file = fopen (config.map_filename, FOPEN_WT);
211 if (config.map_file == (FILE *) NULL)
213 einfo ("%P%F: cannot open map file %s: %E\n",
214 config.map_filename);
222 /* Print error messages for any missing symbols, for any warning
223 symbols, and possibly multiple definitions */
226 if (config.text_read_only)
228 /* Look for a text section and mark the readonly attribute in it */
229 asection *found = bfd_get_section_by_name (output_bfd, ".text");
231 if (found != (asection *) NULL)
233 found->flags |= SEC_READONLY;
237 if (config.relocateable_output)
238 output_bfd->flags &= ~EXEC_P;
240 output_bfd->flags |= EXEC_P;
244 /* Even if we're producing relocateable output, some non-fatal errors should
245 be reported in the exit status. (What non-fatal errors, if any, do we
246 want to ignore for relocateable output?) */
248 if (config.make_executable == false && force_make_executable == false)
250 if (trace_files == true)
252 einfo ("%P: Link errors found, deleting executable `%s'\n",
256 if (output_bfd->iostream)
257 fclose ((FILE *) (output_bfd->iostream));
259 unlink (output_filename);
264 bfd_close (output_bfd);
270 /* We need to find any explicitly given emulation in order to initialize the
271 state that's needed by the lex&yacc argument parser (parse_args). */
274 get_emulation (argc, argv)
282 check_v960 (argc, argv);
283 emulation = "gld960";
284 for (i = 1; i < argc; i++)
286 if (!strcmp (argv[i], "-Fcoff"))
288 emulation = "lnk960";
289 output_flavor = BFD_COFF_FORMAT;
294 emulation = (char *) getenv (EMULATION_ENVIRON);
295 if (emulation == NULL)
296 emulation = DEFAULT_EMULATION;
299 for (i = 1; i < argc; i++)
301 if (!strncmp (argv[i], "-m", 2))
303 if (argv[i][2] == '\0')
308 emulation = argv[i + 1];
313 einfo("%P%F missing argument to -m\n");
319 emulation = &argv[i][2];
327 /* If directory DIR contains an "ldscripts" subdirectory,
328 add DIR to the library search path and return true,
329 else return false. */
332 check_for_scripts_dir (dir)
340 dirlen = strlen (dir);
341 /* sizeof counts the terminating NUL. */
342 buf = (char *) ldmalloc (dirlen + sizeof("/ldscripts"));
343 sprintf (buf, "%s/ldscripts", dir);
345 res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
348 ldfile_add_library_path (dir);
352 /* Set the default directory for finding script files.
353 Libraries will be searched for here too, but that's ok.
354 We look for the "ldscripts" directory in:
356 SCRIPTDIR (passed from Makefile)
357 the dir where this program is (for using it from the build tree)
358 the dir where this program is/../lib (for installing the tool suite elsewhere) */
366 if (check_for_scripts_dir (SCRIPTDIR))
367 return; /* We've been installed normally. */
369 /* Look for "ldscripts" in the dir where our binary is. */
370 end = strrchr (program_name, '/');
373 dirlen = end - program_name;
374 /* Make a copy of program_name in dir.
375 Leave room for later "/../lib". */
376 dir = (char *) ldmalloc (dirlen + 8);
377 strncpy (dir, program_name, dirlen);
383 dir = (char *) ldmalloc (dirlen + 8);
387 if (check_for_scripts_dir (dir))
388 return; /* Don't free dir. */
390 /* Look for "ldscripts" in <the dir where our binary is>/../lib. */
391 strcpy (dir + dirlen, "/../lib");
392 if (check_for_scripts_dir (dir))
395 free (dir); /* Well, we tried. */
399 read_entry_symbols (desc, entry)
401 struct lang_input_statement_struct *entry;
403 if (entry->asymbols == (asymbol **) NULL)
405 bfd_size_type table_size = get_symtab_upper_bound (desc);
407 entry->asymbols = (asymbol **) ldmalloc (table_size);
408 entry->symbol_count = bfd_canonicalize_symtab (desc, entry->asymbols);
413 * turn this item into a reference
420 asymbol *sym = *nlist_p;
424 sym->section = &bfd_und_section;
425 sym->udata = (PTR) (sp->srefs_chain);
426 sp->srefs_chain = nlist_p;
430 This function is called for each name which is seen which has a global
431 scope. It enters the name into the global symbol table in the correct
432 symbol on the correct chain. Remember that each ldsym_type has three
433 chains attatched, one of all definitions of a symbol, one of all
434 references of a symbol and one of all common definitions of a symbol.
436 When the function is over, the supplied is left connected to the bfd
437 to which is was born, with its udata field pointing to the next member
438 on the chain in which it has been inserted.
440 A certain amount of jigery pokery is necessary since commons come
441 along and upset things, we only keep one item in the common chain; the
442 one with the biggest size seen sofar. When another common comes along
443 it either bumps the previous definition into the ref chain, since it
444 is bigger, or gets turned into a ref on the spot since the one on the
445 common chain is already bigger. If a real definition comes along then
446 the common gets bumped off anyway.
448 Whilst all this is going on we keep a count of the number of multiple
449 definitions seen, undefined global symbols and pending commons.
453 enter_global_ref (nlist_p, name)
454 asymbol ** nlist_p; /* pointer into symbol table from incoming bfd */
455 CONST char *name; /* name of symbol in linker table */
457 asymbol *sym = *nlist_p;
460 /* Lookup the name from the incoming bfd's symbol table in the
461 linker's global symbol table */
464 flagword this_symbol_flags = sym->flags;
466 sp = ldsym_get (name);
469 /* If this symbol already has udata, it means that something strange
472 The strange thing is that we've had an undefined symbol resolved by
473 an alias, but the thing the alias defined wasn't in the file. So
474 the symbol got a udata entry, but the file wasn't loaded. Then
475 later on the file was loaded, but we don't need to do this
483 if (flag_is_constructor (this_symbol_flags))
485 /* Add this constructor to the list we keep */
486 ldlang_add_constructor (sp);
487 /* Turn any commons into refs */
488 if (sp->scoms_chain != (asymbol **) NULL)
490 refize (sp, sp->scoms_chain);
498 if (bfd_is_com_section (sym->section))
500 /* If we have a definition of this symbol already then
501 this common turns into a reference. Also we only
502 ever point to the largest common, so if we
503 have a common, but it's bigger that the new symbol
504 the turn this into a reference too. */
507 /* This is a common symbol, but we already have a definition
508 for it, so just link it into the ref chain as if
509 it were a reference */
510 refize (sp, nlist_p);
512 else if (sp->scoms_chain)
514 /* If we have a previous common, keep only the biggest */
515 if ((*(sp->scoms_chain))->value > sym->value)
517 /* other common is bigger, throw this one away */
518 refize (sp, nlist_p);
520 else if (sp->scoms_chain != nlist_p)
522 /* other common is smaller, throw that away */
523 refize (sp, sp->scoms_chain);
524 sp->scoms_chain = nlist_p;
529 /* This is the first time we've seen a common, so remember it
530 - if it was undefined before, we know it's defined now. If
531 the symbol has been marked as really being a constructor,
532 then treat this as a ref
534 if (sp->flags & SYM_CONSTRUCTOR)
536 /* Turn this into a ref */
537 refize (sp, nlist_p);
541 /* treat like a common */
543 undefined_global_sym_count--;
546 sp->scoms_chain = nlist_p;
551 else if (sym->section != &bfd_und_section)
553 /* This is the definition of a symbol, add to def chain */
554 if (sp->sdefs_chain && (*(sp->sdefs_chain))->section != sym->section)
556 /* Multiple definition */
557 asymbol *sy = *(sp->sdefs_chain);
558 lang_input_statement_type *stat =
559 (lang_input_statement_type *) bfd_asymbol_bfd (sy)->usrdata;
560 lang_input_statement_type *stat1 =
561 (lang_input_statement_type *) bfd_asymbol_bfd (sym)->usrdata;
562 asymbol **stat1_symbols = stat1 ? stat1->asymbols : 0;
563 asymbol **stat_symbols = stat ? stat->asymbols : 0;
565 multiple_def_count++;
566 einfo ("%X%C: multiple definition of `%T'\n",
567 bfd_asymbol_bfd (sym), sym->section, stat1_symbols, sym->value, sym);
569 einfo ("%X%C: first seen here\n",
570 bfd_asymbol_bfd (sy), sy->section, stat_symbols, sy->value);
574 sym->udata = (PTR) (sp->sdefs_chain);
575 sp->sdefs_chain = nlist_p;
577 /* A definition overrides a common symbol */
580 refize (sp, sp->scoms_chain);
584 else if (sp->srefs_chain && relaxing == false)
586 /* If previously was undefined, then remember as defined */
587 undefined_global_sym_count--;
592 if (sp->scoms_chain == (asymbol **) NULL
593 && sp->srefs_chain == (asymbol **) NULL
594 && sp->sdefs_chain == (asymbol **) NULL)
596 /* And it's the first time we've seen it */
597 undefined_global_sym_count++;
601 refize (sp, nlist_p);
605 ASSERT (sp->sdefs_chain == 0 || sp->scoms_chain == 0);
606 ASSERT (sp->scoms_chain == 0 || (*(sp->scoms_chain))->udata == 0);
612 enter_file_symbols (entry)
613 lang_input_statement_type *entry;
617 entry->common_section =
618 bfd_make_section_old_way (entry->the_bfd, "COMMON");
619 entry->common_section->flags = SEC_NEVER_LOAD;
620 ldlang_add_file (entry);
623 if (trace_files || trace_file_tries)
625 info ("%I\n", entry);
628 total_symbols_seen += entry->symbol_count;
630 if (entry->symbol_count)
632 for (q = entry->asymbols; *q; q++)
636 if (had_y && p->name)
638 /* look up the symbol anyway to see if the trace bit was
640 ldsym_type *s = ldsym_get (p->name);
641 if (s->flags & SYM_Y)
643 einfo ("%B: %s %T\n", entry->the_bfd,
644 p->section == &bfd_und_section ? "reference to" : "definition of ",
649 if (p->section == &bfd_ind_section)
653 else if (p->flags & BSF_WARNING)
657 else if (p->section == &bfd_und_section
658 || (p->flags & BSF_GLOBAL)
659 || bfd_is_com_section (p->section)
660 || (p->flags & BSF_CONSTRUCTOR))
666 if (p->flags & BSF_INDIRECT)
670 else if (p->flags & BSF_WARNING)
674 else if (p->section == &bfd_und_section
675 || (p->flags & BSF_GLOBAL)
676 || bfd_is_com_section (p->section)
677 || (p->flags & BSF_CONSTRUCTOR))
679 enter_global_ref (q, p->name);
689 /* Searching libraries */
691 struct lang_input_statement_struct *decode_library_subfile ();
692 void linear_library (), symdef_library ();
694 /* Search the library ENTRY, already open on descriptor DESC.
695 This means deciding which library members to load,
696 making a chain of `struct lang_input_statement_struct' for those members,
697 and entering their global symbols in the hash table. */
700 search_library (entry)
701 struct lang_input_statement_struct *entry;
704 /* No need to load a library if no undefined symbols */
705 if (!undefined_global_sym_count)
708 if (bfd_has_map (entry->the_bfd))
709 symdef_library (entry);
711 linear_library (entry);
718 gnu960_check_format (abfd, format)
724 if ((bfd_check_format (abfd, format) == true)
725 && (abfd->xvec->flavour == output_flavor))
737 ldmain_open_file_read_symbol (entry)
738 struct lang_input_statement_struct *entry;
740 if (entry->asymbols == (asymbol **) NULL
741 && entry->real == true
742 && entry->filename != (char *) NULL)
744 ldfile_open_file (entry);
748 if (gnu960_check_format (entry->the_bfd, bfd_object))
750 if (bfd_check_format (entry->the_bfd, bfd_object))
753 entry->the_bfd->usrdata = (PTR) entry;
756 read_entry_symbols (entry->the_bfd, entry);
758 /* look through the sections in the file and see if any of them
760 ldlang_check_for_constructors (entry);
762 enter_file_symbols (entry);
765 else if (gnu960_check_format (entry->the_bfd, bfd_archive))
767 else if (bfd_check_format (entry->the_bfd, bfd_archive))
770 entry->the_bfd->usrdata = (PTR) entry;
772 entry->subfiles = (lang_input_statement_type *) NULL;
773 search_library (entry);
777 einfo ("%F%B: malformed input file (not rel or archive) \n",
784 /* Construct and return a lang_input_statement_struct for a library member.
785 The library's lang_input_statement_struct is library_entry,
786 and the library is open on DESC.
787 SUBFILE_OFFSET is the byte index in the library of this member's header.
788 We store the length of the member into *LENGTH_LOC. */
790 lang_input_statement_type *
791 decode_library_subfile (library_entry, subfile_offset)
792 struct lang_input_statement_struct *library_entry;
795 register struct lang_input_statement_struct *subentry;
798 /* First, check if we already have a loaded
799 lang_input_statement_struct for this library subfile. If so,
800 just return it. Otherwise, allocate some space and build a new one. */
802 if (subfile_offset->usrdata
803 && ((struct lang_input_statement_struct *) subfile_offset->usrdata)->
806 subentry = (struct lang_input_statement_struct *) subfile_offset->usrdata;
811 (struct lang_input_statement_struct *)
812 ldmalloc ((bfd_size_type) (sizeof (struct lang_input_statement_struct)));
814 subentry->filename = subfile_offset->filename;
815 subentry->local_sym_name = subfile_offset->filename;
816 subentry->asymbols = 0;
817 subentry->the_bfd = subfile_offset;
818 subentry->subfiles = 0;
820 subentry->superfile = library_entry;
821 subentry->is_archive = false;
823 subentry->just_syms_flag = false;
824 subentry->loaded = false;
830 boolean subfile_wanted_p ();
832 clear_syms (entry, offset)
833 struct lang_input_statement_struct *entry;
837 unsigned long indx = bfd_get_next_mapent (entry->the_bfd,
841 while (indx != BFD_NO_MORE_SYMBOLS)
843 if (car->file_offset == offset)
847 indx = bfd_get_next_mapent (entry->the_bfd, indx, &car);
852 /* Search a library that has a map
855 symdef_library (entry)
856 struct lang_input_statement_struct *entry;
859 register struct lang_input_statement_struct *prev = 0;
861 boolean not_finished = true;
863 while (not_finished == true)
865 carsym *exported_library_name;
866 bfd *prev_archive_member_bfd = 0;
868 int idx = bfd_get_next_mapent (entry->the_bfd,
870 &exported_library_name);
872 not_finished = false;
874 while (idx != BFD_NO_MORE_SYMBOLS && undefined_global_sym_count)
877 if (exported_library_name->name)
880 ldsym_type *sp = ldsym_get_soft (exported_library_name->name);
882 /* If we find a symbol that appears to be needed, think carefully
883 about the archive member that the symbol is in. */
884 /* So - if it exists, and is referenced somewhere and is
886 if (sp && sp->srefs_chain && !sp->sdefs_chain)
888 bfd *archive_member_bfd = bfd_get_elt_at_index (entry->the_bfd, idx);
889 struct lang_input_statement_struct *archive_member_lang_input_statement_struct;
892 if (archive_member_bfd && gnu960_check_format (archive_member_bfd, bfd_object))
894 if (archive_member_bfd && bfd_check_format (archive_member_bfd, bfd_object))
898 /* Don't think carefully about any archive member
899 more than once in a given pass. */
900 if (prev_archive_member_bfd != archive_member_bfd)
903 prev_archive_member_bfd = archive_member_bfd;
905 /* Read the symbol table of the archive member. */
907 if (archive_member_bfd->usrdata != (PTR) NULL)
910 archive_member_lang_input_statement_struct = (lang_input_statement_type *) archive_member_bfd->usrdata;
915 archive_member_lang_input_statement_struct =
916 decode_library_subfile (entry, archive_member_bfd);
917 archive_member_bfd->usrdata = (PTR) archive_member_lang_input_statement_struct;
921 if (archive_member_lang_input_statement_struct == 0)
923 einfo ("%F%I contains invalid archive member %s\n",
927 if (archive_member_lang_input_statement_struct->loaded == false)
930 read_entry_symbols (archive_member_bfd, archive_member_lang_input_statement_struct);
931 /* Now scan the symbol table and decide whether to load. */
934 if (subfile_wanted_p (archive_member_lang_input_statement_struct) == true)
937 /* This member is needed; load it.
938 Since we are loading something on this pass,
939 we must make another pass through the symdef data. */
943 enter_file_symbols (archive_member_lang_input_statement_struct);
946 prev->chain = archive_member_lang_input_statement_struct;
948 entry->subfiles = archive_member_lang_input_statement_struct;
951 prev = archive_member_lang_input_statement_struct;
954 /* Clear out this member's symbols from the symdef data
955 so that following passes won't waste time on them. */
956 clear_syms (entry, exported_library_name->file_offset);
957 archive_member_lang_input_statement_struct->loaded = true;
964 idx = bfd_get_next_mapent (entry->the_bfd, idx, &exported_library_name);
970 linear_library (entry)
971 struct lang_input_statement_struct *entry;
973 boolean more_to_do = true;
974 register struct lang_input_statement_struct *prev = 0;
976 if (entry->complained == false)
978 if (entry->the_bfd->xvec->flavour != bfd_target_ieee_flavour)
981 /* IEEE can use table of contents, so this message is bogus */
982 einfo ("%P: library %s has bad table of contents, rerun ranlib\n",
983 entry->the_bfd->filename);
985 entry->complained = true;
991 bfd *archive = bfd_openr_next_archived_file (entry->the_bfd, 0);
996 /* Don't check this file if it's already been read in
999 if (!archive->usrdata ||
1000 !((lang_input_statement_type *) (archive->usrdata))->loaded)
1003 if (gnu960_check_format (archive, bfd_object))
1005 if (bfd_check_format (archive, bfd_object))
1008 register struct lang_input_statement_struct *subentry;
1010 subentry = decode_library_subfile (entry,
1013 archive->usrdata = (PTR) subentry;
1016 if (subentry->loaded == false)
1018 read_entry_symbols (archive, subentry);
1020 if (subfile_wanted_p (subentry) == true)
1022 enter_file_symbols (subentry);
1025 prev->chain = subentry;
1027 entry->subfiles = subentry;
1031 subentry->loaded = true;
1036 archive = bfd_openr_next_archived_file (entry->the_bfd, archive);
1043 /* ENTRY is an entry for a file inside an archive
1044 Its symbols have been read into core, but not entered into the
1046 Return nonzero if we ought to load this file */
1049 subfile_wanted_p (entry)
1050 struct lang_input_statement_struct *entry;
1054 if (entry->symbol_count == 0)
1057 for (q = entry->asymbols; *q; q++)
1061 /* If the symbol has an interesting definition, we could
1062 potentially want it. */
1064 if (p->flags & BSF_INDIRECT)
1066 /** add_indirect(q);*/
1069 if (bfd_is_com_section (p->section)
1070 || (p->flags & BSF_GLOBAL)
1071 || (p->flags & BSF_INDIRECT))
1073 register ldsym_type *sp = ldsym_get_soft (p->name);
1075 /* If this symbol has not been hashed,
1076 we can't be looking for it. */
1077 if (sp != (ldsym_type *) NULL
1078 && sp->sdefs_chain == (asymbol **) NULL)
1080 if (sp->srefs_chain != (asymbol **) NULL
1081 || sp->scoms_chain != (asymbol **) NULL)
1083 /* This is a symbol we are looking for. It is
1084 either not yet defined or common. If this is a
1085 common symbol, then if the symbol in the object
1086 file is common, we need to combine sizes. But if
1087 we already have a common symbol, and the symbol
1088 in the object file is not common, we don't want
1089 the object file: it is providing a definition for
1090 a symbol that we already have a definition for
1091 (this is the else condition below). */
1092 if (bfd_is_com_section (p->section))
1095 /* If the symbol in the table is a constructor, we won't to
1096 anything fancy with it */
1097 if ((sp->flags & SYM_CONSTRUCTOR) == 0)
1099 /* This libary member has something to
1100 say about this element. We should
1101 remember if its a new size */
1102 /* Move something from the ref list to the com list */
1103 if (sp->scoms_chain)
1105 /* Already a common symbol, maybe update it */
1106 if (p->value > (*(sp->scoms_chain))->value)
1108 (*(sp->scoms_chain))->value = p->value;
1113 /* Take a value from the ref chain
1114 Here we are moving a symbol from the owning bfd
1115 to another bfd. We must set up the
1116 common_section portion of the bfd thing */
1120 sp->scoms_chain = sp->srefs_chain;
1122 (asymbol **) ((*(sp->srefs_chain))->udata);
1123 (*(sp->scoms_chain))->udata = (PTR) NULL;
1125 (*(sp->scoms_chain))->section = p->section;
1126 (*(sp->scoms_chain))->flags = 0;
1127 /* Remember the size of this item */
1128 sp->scoms_chain[0]->value = p->value;
1130 undefined_global_sym_count--;
1133 asymbol *com = *(sp->scoms_chain);
1135 if (((lang_input_statement_type *)
1136 (bfd_asymbol_bfd (com)->usrdata))->common_section ==
1139 ((lang_input_statement_type *)
1140 (bfd_asymbol_bfd (com)->usrdata))->common_section =
1141 bfd_make_section_old_way (bfd_asymbol_bfd (com), "COMMON");
1145 ASSERT (p->udata == 0);
1147 else if (sp->scoms_chain == (asymbol **) NULL)
1151 info ("%I needed due to %s\n", entry, sp->name);
1167 ldsym_type *lookup = ldsym_get (text);
1168 lookup->flags |= SYM_Y;