projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use size_t rather than bfd_size_type
[deliverable/binutils-gdb.git]
/
ld
/
plugin.c
diff --git
a/ld/plugin.c
b/ld/plugin.c
index b48ce86a6f1ecc4d1561171d212a8526d91270c2..c951995dccb3104b741925e3604c0311e37134d6 100644
(file)
--- a/
ld/plugin.c
+++ b/
ld/plugin.c
@@
-1,5
+1,5
@@
/* Plugin control for the GNU linker.
/* Plugin control for the GNU linker.
- Copyright (C) 2010-201
5
Free Software Foundation, Inc.
+ Copyright (C) 2010-201
6
Free Software Foundation, Inc.
This file is part of the GNU Binutils.
This file is part of the GNU Binutils.
@@
-295,16
+295,18
@@
static bfd *
plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
{
bfd *abfd;
plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
{
bfd *abfd;
+ bfd_boolean bfd_plugin_target;
bfd_use_reserved_id = 1;
bfd_use_reserved_id = 1;
+ bfd_plugin_target = bfd_plugin_target_p (srctemplate->xvec);
abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL),
abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL),
-
link_info.output_bfd
);
+
bfd_plugin_target ? link_info.output_bfd : srctemplate
);
if (abfd != NULL)
{
abfd->flags |= BFD_LINKER_CREATED | BFD_PLUGIN;
if (!bfd_make_writable (abfd))
goto report_error;
if (abfd != NULL)
{
abfd->flags |= BFD_LINKER_CREATED | BFD_PLUGIN;
if (!bfd_make_writable (abfd))
goto report_error;
- if (!
bfd_plugin_target_p (srctemplate->xvec)
)
+ if (!
bfd_plugin_target
)
{
bfd_set_arch_info (abfd, bfd_get_arch_info (srctemplate));
bfd_set_gp_size (abfd, bfd_get_gp_size (srctemplate));
{
bfd_set_arch_info (abfd, bfd_get_arch_info (srctemplate));
bfd_set_gp_size (abfd, bfd_get_gp_size (srctemplate));
@@
-611,9
+613,9
@@
is_visible_from_outside (struct ld_plugin_symbol *lsym,
{
struct bfd_sym_chain *sym;
{
struct bfd_sym_chain *sym;
- if (
link_info.relocatable
)
+ if (
bfd_link_relocatable (&link_info)
)
return TRUE;
return TRUE;
- if (link_info.export_dynamic ||
!link_info.executable
)
+ if (link_info.export_dynamic ||
bfd_link_dll (&link_info)
)
{
/* Check if symbol is hidden by version script. */
if (bfd_hide_sym_by_version (link_info.version_info,
{
/* Check if symbol is hidden by version script. */
if (bfd_hide_sym_by_version (link_info.version_info,
@@
-672,7
+674,24
@@
get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms,
syms[n].name, FALSE, FALSE, TRUE);
if (!blhe)
{
syms[n].name, FALSE, FALSE, TRUE);
if (!blhe)
{
- res = LDPR_UNKNOWN;
+ /* The plugin is called to claim symbols in an archive element
+ from plugin_object_p. But those symbols aren't needed to
+ create output. They are defined and referenced only within
+ IR. */
+ switch (syms[n].def)
+ {
+ default:
+ abort ();
+ case LDPK_UNDEF:
+ case LDPK_WEAKUNDEF:
+ res = LDPR_UNDEF;
+ break;
+ case LDPK_DEF:
+ case LDPK_WEAKDEF:
+ case LDPK_COMMON:
+ res = LDPR_PREVAILING_DEF_IRONLY;
+ break;
+ }
goto report_symbol;
}
goto report_symbol;
}
@@
-772,10
+791,14
@@
get_symbols_v2 (const void *handle, int nsyms, struct ld_plugin_symbol *syms)
static enum ld_plugin_status
add_input_file (const char *pathname)
{
static enum ld_plugin_status
add_input_file (const char *pathname)
{
+ lang_input_statement_type *is;
+
ASSERT (called_plugin);
ASSERT (called_plugin);
- if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_file_enum,
- NULL))
+ is = lang_add_input_file (xstrdup (pathname), lang_input_file_is_file_enum,
+ NULL);
+ if (!is)
return LDPS_ERR;
return LDPS_ERR;
+ is->flags.lto_output = 1;
return LDPS_OK;
}
return LDPS_OK;
}
@@
-783,10
+806,14
@@
add_input_file (const char *pathname)
static enum ld_plugin_status
add_input_library (const char *pathname)
{
static enum ld_plugin_status
add_input_library (const char *pathname)
{
+ lang_input_statement_type *is;
+
ASSERT (called_plugin);
ASSERT (called_plugin);
- if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_l_enum,
- NULL))
+ is = lang_add_input_file (xstrdup (pathname), lang_input_file_is_l_enum,
+ NULL);
+ if (!is)
return LDPS_ERR;
return LDPS_ERR;
+ is->flags.lto_output = 1;
return LDPS_OK;
}
return LDPS_OK;
}
@@
-814,18
+841,24
@@
message (int level, const char *format, ...)
putchar ('\n');
break;
case LDPL_WARNING:
putchar ('\n');
break;
case LDPL_WARNING:
- vfinfo (stdout, format, args, TRUE);
- putchar ('\n');
+ {
+ char *newfmt = concat ("%P: warning: ", format, "\n",
+ (const char *) NULL);
+ vfinfo (stdout, newfmt, args, TRUE);
+ free (newfmt);
+ }
break;
case LDPL_FATAL:
case LDPL_ERROR:
default:
{
break;
case LDPL_FATAL:
case LDPL_ERROR:
default:
{
- char *newfmt = ACONCAT ((level == LDPL_FATAL ? "%P%F: " : "%P%X: ",
- format, "\n", (const char *) NULL));
+ char *newfmt = concat (level == LDPL_FATAL ? "%P%F" : "%P%X",
+ ": error: ", format, "\n",
+ (const char *) NULL);
fflush (stdout);
vfinfo (stderr, newfmt, args, TRUE);
fflush (stderr);
fflush (stdout);
vfinfo (stderr, newfmt, args, TRUE);
fflush (stderr);
+ free (newfmt);
}
break;
}
}
break;
}
@@
-860,11
+893,10
@@
set_tv_header (struct ld_plugin_tv *tv)
TVU(val) = major * 100 + minor;
break;
case LDPT_LINKER_OUTPUT:
TVU(val) = major * 100 + minor;
break;
case LDPT_LINKER_OUTPUT:
- TVU(val) = (link_info.relocatable
- ? LDPO_REL
- : (link_info.executable
- ? (link_info.pie ? LDPO_PIE : LDPO_EXEC)
- : LDPO_DYN));
+ TVU(val) = (bfd_link_relocatable (&link_info) ? LDPO_REL
+ : bfd_link_pde (&link_info) ? LDPO_EXEC
+ : bfd_link_pie (&link_info) ? LDPO_PIE
+ : LDPO_DYN);
break;
case LDPT_OUTPUT_NAME:
TVU(string) = output_filename;
break;
case LDPT_OUTPUT_NAME:
TVU(string) = output_filename;
@@
-991,7
+1023,7
@@
plugin_load_plugins (void)
register_ld_plugin_object_p (plugin_object_p);
#if HAVE_MMAP && HAVE_GETPAGESIZE
register_ld_plugin_object_p (plugin_object_p);
#if HAVE_MMAP && HAVE_GETPAGESIZE
- plugin_pagesize = getpagesize ();
;
+ plugin_pagesize = getpagesize ();
#endif
}
#endif
}
@@
-1001,8
+1033,6
@@
plugin_call_claim_file (const struct ld_plugin_input_file *file, int *claimed)
{
plugin_t *curplug = plugins_list;
*claimed = FALSE;
{
plugin_t *curplug = plugins_list;
*claimed = FALSE;
- if (no_more_claiming)
- return 0;
while (curplug && !*claimed)
{
if (curplug->claim_file_handler)
while (curplug && !*claimed)
{
if (curplug->claim_file_handler)
This page took
0.025392 seconds
and
4
git commands to generate.