Subversion Repositories Kolibri OS

Rev

Rev 5211 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5211 Rev 6324
Line 1... Line 1...
1
/* Linker file opening and searching.
1
/* Linker file opening and searching.
2
   Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
-
 
3
   2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
-
 
4
   Free Software Foundation, Inc.
2
   Copyright (C) 1991-2015 Free Software Foundation, Inc.
Line 5... Line 3...
5
 
3
 
Line 6... Line 4...
6
   This file is part of the GNU Binutils.
4
   This file is part of the GNU Binutils.
7
 
5
 
Line 142... Line 140...
142
    }
140
    }
Line 143... Line 141...
143
 
141
 
144
  /* Linker needs to decompress sections.  */
142
  /* Linker needs to decompress sections.  */
Line -... Line 143...
-
 
143
  entry->the_bfd->flags |= BFD_DECOMPRESS;
-
 
144
 
-
 
145
  /* This is a linker input BFD.  */
-
 
146
  entry->the_bfd->is_linker_input = 1;
-
 
147
 
-
 
148
#ifdef ENABLE_PLUGINS
-
 
149
  if (entry->flags.lto_output)
-
 
150
    entry->the_bfd->lto_output = 1;
145
  entry->the_bfd->flags |= BFD_DECOMPRESS;
151
#endif
146
 
152
 
147
  /* If we are searching for this file, see if the architecture is
153
  /* If we are searching for this file, see if the architecture is
148
     compatible with the output file.  If it isn't, keep searching.
154
     compatible with the output file.  If it isn't, keep searching.
149
     If we can't open the file as an object file, stop the search
155
     If we can't open the file as an object file, stop the search
Line 301... Line 307...
301
     also ignore corefiles, because that's just weird.  It is
307
     also ignore corefiles, because that's just weird.  It is
302
     a needed side-effect of calling  bfd_check_format with
308
     a needed side-effect of calling  bfd_check_format with
303
     bfd_object that it sets the bfd's arch and mach, which
309
     bfd_object that it sets the bfd's arch and mach, which
304
     will be needed when and if we want to bfd_create a new
310
     will be needed when and if we want to bfd_create a new
305
     one using this one as a template.  */
311
     one using this one as a template.  */
306
  if (bfd_check_format (entry->the_bfd, bfd_object)
-
 
307
      && plugin_active_plugins_p ()
312
  if (link_info.lto_plugin_active
308
      && !no_more_claiming)
313
      && !no_more_claiming
309
    {
-
 
310
      int fd = open (attempt, O_RDONLY | O_BINARY);
314
      && bfd_check_format (entry->the_bfd, bfd_object))
311
      if (fd >= 0)
-
 
312
	{
-
 
313
	  struct ld_plugin_input_file file;
-
 
314
 
-
 
315
	  file.name = attempt;
-
 
316
	  file.offset = 0;
-
 
317
	  file.filesize = lseek (fd, 0, SEEK_END);
-
 
318
	  file.fd = fd;
-
 
319
	  plugin_maybe_claim (&file, entry);
315
    plugin_maybe_claim (entry);
320
	}
-
 
321
    }
-
 
322
#endif /* ENABLE_PLUGINS */
316
#endif /* ENABLE_PLUGINS */
Line 323... Line 317...
323
 
317
 
324
  /* It opened OK, the format checked out, and the plugins have had
318
  /* It opened OK, the format checked out, and the plugins have had
325
     their chance to claim it, so this is success.  */
319
     their chance to claim it, so this is success.  */
Line 361... Line 355...
361
 
355
 
362
  for (search = search_head; search != NULL; search = search->next)
356
  for (search = search_head; search != NULL; search = search->next)
363
    {
357
    {
Line 364... Line 358...
364
      char *string;
358
      char *string;
365
 
359
 
366
      if (entry->flags.dynamic && ! link_info.relocatable)
360
      if (entry->flags.dynamic && !bfd_link_relocatable (&link_info))
367
	{
361
	{
368
	  if (ldemul_open_dynamic_archive (arch, search, entry))
362
	  if (ldemul_open_dynamic_archive (arch, search, entry))
Line 369... Line 363...
369
	    return TRUE;
363
	    return TRUE;
370
	}
364
	}
371
 
365
 
372
      if (entry->flags.maybe_archive)
366
      if (entry->flags.maybe_archive && !entry->flags.full_name_provided)
373
	string = concat (search->name, slash, lib, entry->filename,
367
	string = concat (search->name, slash, lib, entry->filename,
374
			 arch, suffix, (const char *) NULL);
368
			 arch, suffix, (const char *) NULL);