Line 237... |
Line 237... |
if (bfd_make_writable (abfd)
|
if (bfd_make_writable (abfd)
|
&& bfd_copy_private_bfd_data (srctemplate, abfd))
|
&& bfd_copy_private_bfd_data (srctemplate, abfd))
|
{
|
{
|
flagword flags;
|
flagword flags;
|
|
|
/* Create sections to own the symbols. */
|
/* Create section to own the symbols. */
|
flags = (SEC_CODE | SEC_HAS_CONTENTS | SEC_READONLY
|
flags = (SEC_CODE | SEC_HAS_CONTENTS | SEC_READONLY
|
| SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_EXCLUDE);
|
| SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_EXCLUDE);
|
if (bfd_make_section_anyway_with_flags (abfd, ".text", flags))
|
if (bfd_make_section_anyway_with_flags (abfd, ".text", flags))
|
return abfd;
|
return abfd;
|
}
|
}
|
Line 282... |
Line 282... |
case LDPK_WEAKDEF:
|
case LDPK_WEAKDEF:
|
flags = BSF_WEAK;
|
flags = BSF_WEAK;
|
/* FALLTHRU */
|
/* FALLTHRU */
|
case LDPK_DEF:
|
case LDPK_DEF:
|
flags |= BSF_GLOBAL;
|
flags |= BSF_GLOBAL;
|
|
if (ldsym->comdat_key)
|
|
{
|
|
char *name = concat (".gnu.linkonce.t.", ldsym->comdat_key,
|
|
(const char *) NULL);
|
|
section = bfd_get_section_by_name (abfd, name);
|
|
if (section != NULL)
|
|
free (name);
|
|
else
|
|
{
|
|
flagword sflags;
|
|
|
|
sflags = (SEC_CODE | SEC_HAS_CONTENTS | SEC_READONLY
|
|
| SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_EXCLUDE
|
|
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD);
|
|
section = bfd_make_section_anyway_with_flags (abfd, name, sflags);
|
|
if (section == NULL)
|
|
return LDPS_ERR;
|
|
}
|
|
}
|
|
else
|
section = bfd_get_section_by_name (abfd, ".text");
|
section = bfd_get_section_by_name (abfd, ".text");
|
break;
|
break;
|
|
|
case LDPK_WEAKUNDEF:
|
case LDPK_WEAKUNDEF:
|
flags = BSF_WEAK;
|
flags = BSF_WEAK;
|
Line 378... |
Line 398... |
add_symbols (void *handle, int nsyms, const struct ld_plugin_symbol *syms)
|
add_symbols (void *handle, int nsyms, const struct ld_plugin_symbol *syms)
|
{
|
{
|
asymbol **symptrs;
|
asymbol **symptrs;
|
bfd *abfd = handle;
|
bfd *abfd = handle;
|
int n;
|
int n;
|
|
|
ASSERT (called_plugin);
|
ASSERT (called_plugin);
|
symptrs = xmalloc (nsyms * sizeof *symptrs);
|
symptrs = xmalloc (nsyms * sizeof *symptrs);
|
for (n = 0; n < nsyms; n++)
|
for (n = 0; n < nsyms; n++)
|
{
|
{
|
enum ld_plugin_status rv;
|
enum ld_plugin_status rv;
|
asymbol *bfdsym = bfd_make_empty_symbol (abfd);
|
asymbol *bfdsym;
|
|
|
|
bfdsym = bfd_make_empty_symbol (abfd);
|
symptrs[n] = bfdsym;
|
symptrs[n] = bfdsym;
|
rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n);
|
rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n);
|
if (rv != LDPS_OK)
|
if (rv != LDPS_OK)
|
return rv;
|
return rv;
|
}
|
}
|