summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/bfd
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-12-02 09:39:02 +0000
committerobrien <obrien@FreeBSD.org>2002-12-02 09:39:02 +0000
commitb0507dc8c419be586c4d83efe2e02bbeb2adbce8 (patch)
tree8924adb5a18aba536a65e549b162368c1f5aef5a /contrib/binutils/bfd
parentc9b52f01365db6f2d42c4191addadeabf1e1791f (diff)
downloadFreeBSD-src-b0507dc8c419be586c4d83efe2e02bbeb2adbce8.zip
FreeBSD-src-b0507dc8c419be586c4d83efe2e02bbeb2adbce8.tar.gz
Update HEAD with the stock files.
Diffstat (limited to 'contrib/binutils/bfd')
-rw-r--r--contrib/binutils/bfd/elf32-i386.c2
-rw-r--r--contrib/binutils/bfd/elf64-alpha.c2
-rw-r--r--contrib/binutils/bfd/elflink.h98
3 files changed, 56 insertions, 46 deletions
diff --git a/contrib/binutils/bfd/elf32-i386.c b/contrib/binutils/bfd/elf32-i386.c
index d1061f7..51765ab 100644
--- a/contrib/binutils/bfd/elf32-i386.c
+++ b/contrib/binutils/bfd/elf32-i386.c
@@ -18,8 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* $FreeBSD$ */
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
diff --git a/contrib/binutils/bfd/elf64-alpha.c b/contrib/binutils/bfd/elf64-alpha.c
index 2d9edf0..7397ed1 100644
--- a/contrib/binutils/bfd/elf64-alpha.c
+++ b/contrib/binutils/bfd/elf64-alpha.c
@@ -19,8 +19,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* $FreeBSD$ */
-
/* We need a published ABI spec for this. Until one comes out, don't
assume this'll remain unchanged forever. */
diff --git a/contrib/binutils/bfd/elflink.h b/contrib/binutils/bfd/elflink.h
index 25519b1..6887e50 100644
--- a/contrib/binutils/bfd/elflink.h
+++ b/contrib/binutils/bfd/elflink.h
@@ -921,6 +921,7 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
boolean size_change_ok;
char *shortname;
struct elf_link_hash_entry *hi;
+ struct bfd_link_hash_entry *bh;
struct elf_backend_data *bed;
boolean collect;
boolean dynamic;
@@ -979,11 +980,12 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
if (! override)
{
+ bh = &hi->root;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr,
- (bfd_vma) 0, name, false, collect,
- (struct bfd_link_hash_entry **) &hi)))
+ (bfd_vma) 0, name, false, collect, &bh)))
return false;
+ hi = (struct elf_link_hash_entry *) bh;
}
else
{
@@ -1098,11 +1100,12 @@ elf_add_default_symbol (abfd, info, h, name, sym, psec, value,
}
else
{
+ bh = &hi->root;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, shortname, BSF_INDIRECT,
- bfd_ind_section_ptr, (bfd_vma) 0, name, false,
- collect, (struct bfd_link_hash_entry **) &hi)))
+ bfd_ind_section_ptr, (bfd_vma) 0, name, false, collect, &bh)))
return false;
+ hi = (struct elf_link_hash_entry *) bh;
/* If there is a duplicate definition somewhere, then HI may not
point to an indirect symbol. We will have reported an error
@@ -1295,6 +1298,14 @@ elf_link_add_object_symbols (abfd, info)
const char *name;
bfd_size_type oldsize;
bfd_size_type strindex;
+ struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
+
+ /* ld --just-symbols and dynamic objects don't mix very well.
+ Test for --just-symbols by looking at info set up by
+ _bfd_elf_link_just_syms. */
+ if ((s = abfd->sections) != NULL
+ && elf_section_data (s)->sec_info_type == ELF_INFO_TYPE_JUST_SYMS)
+ goto error_return;
/* Find the name to use in a DT_NEEDED entry that refers to this
object. If the object has a DT_SONAME entry, we use it.
@@ -1324,8 +1335,6 @@ elf_link_add_object_symbols (abfd, info)
Elf_External_Dyn *extdynend;
int elfsec;
unsigned long shlink;
- int rpath;
- int runpath;
dynbuf = (Elf_External_Dyn *) bfd_malloc (s->_raw_size);
if (dynbuf == NULL)
@@ -1342,8 +1351,6 @@ elf_link_add_object_symbols (abfd, info)
extdyn = dynbuf;
extdynend = extdyn + s->_raw_size / sizeof (Elf_External_Dyn);
- rpath = 0;
- runpath = 0;
for (; extdyn < extdynend; extdyn++)
{
Elf_Internal_Dyn dyn;
@@ -1387,13 +1394,6 @@ elf_link_add_object_symbols (abfd, info)
char *fnm, *anm;
unsigned int tagv = dyn.d_un.d_val;
- /* When we see DT_RPATH before DT_RUNPATH, we have
- to clear runpath. Do _NOT_ bfd_release, as that
- frees all more recently bfd_alloc'd blocks as
- well. */
- if (rpath && hash_table->runpath)
- hash_table->runpath = NULL;
-
amt = sizeof (struct bfd_link_needed_list);
n = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt);
fnm = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
@@ -1407,13 +1407,11 @@ elf_link_add_object_symbols (abfd, info)
n->name = anm;
n->by = abfd;
n->next = NULL;
- for (pn = & hash_table->runpath;
+ for (pn = & runpath;
*pn != NULL;
pn = &(*pn)->next)
;
*pn = n;
- runpath = 1;
- rpath = 0;
}
/* Ignore DT_RPATH if we have seen DT_RUNPATH. */
if (!runpath && dyn.d_tag == DT_RPATH)
@@ -1439,18 +1437,32 @@ elf_link_add_object_symbols (abfd, info)
n->name = anm;
n->by = abfd;
n->next = NULL;
- for (pn = & hash_table->runpath;
+ for (pn = & rpath;
*pn != NULL;
pn = &(*pn)->next)
;
*pn = n;
- rpath = 1;
}
}
free (dynbuf);
}
+ /* DT_RUNPATH overrides DT_RPATH. Do _NOT_ bfd_release, as that
+ frees all more recently bfd_alloc'd blocks as well. */
+ if (runpath)
+ rpath = runpath;
+
+ if (rpath)
+ {
+ struct bfd_link_needed_list **pn;
+ for (pn = & hash_table->runpath;
+ *pn != NULL;
+ pn = &(*pn)->next)
+ ;
+ *pn = rpath;
+ }
+
/* We do not want to include any of the sections in a dynamic
object in the output file. We hack by simply clobbering the
list of sections in the BFD. This could be handled more
@@ -1926,19 +1938,17 @@ elf_link_add_object_symbols (abfd, info)
might be needed here. */
if (isym->st_other != 0)
{
+ unsigned char hvis, symvis, other;
+
+ /* Take the balance of OTHER from the definition. */
+ other = (definition ? isym->st_other : h->other);
+ other &= ~ ELF_ST_VISIBILITY (-1);
+
/* Combine visibilities, using the most constraining one. */
- unsigned char hvis = ELF_ST_VISIBILITY (h->other);
- unsigned char symvis = ELF_ST_VISIBILITY (isym->st_other);
-
- if (symvis && (hvis > symvis || hvis == 0))
- h->other = isym->st_other;
-
- /* If neither has visibility, use the st_other of the
- definition. This is an arbitrary choice, since the
- other bits have no general meaning. */
- if (!symvis && !hvis
- && (definition || h->other == 0))
- h->other = isym->st_other;
+ hvis = ELF_ST_VISIBILITY (h->other);
+ symvis = ELF_ST_VISIBILITY (isym->st_other);
+
+ h->other = other | (hvis > symvis ? hvis : symvis);
}
/* Set a flag in the hash table entry indicating the type of
@@ -2292,6 +2302,7 @@ elf_link_create_dynamic_sections (abfd, info)
flagword flags;
register asection *s;
struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
struct elf_backend_data *bed;
if (! is_elf_hash_table (info))
@@ -2384,12 +2395,12 @@ elf_link_create_dynamic_sections (abfd, info)
creating a .dynamic section. We don't want to define it if there
is no .dynamic section, since on some ELF platforms the start up
code examines it to decide how to initialize the process. */
- h = NULL;
+ bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, "_DYNAMIC", BSF_GLOBAL, s, (bfd_vma) 0,
- (const char *) NULL, false, get_elf_backend_data (abfd)->collect,
- (struct bfd_link_hash_entry **) &h)))
+ (const char *) 0, false, get_elf_backend_data (abfd)->collect, &bh)))
return false;
+ h = (struct elf_link_hash_entry *) bh;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -3326,19 +3337,20 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
unsigned int cdeps;
struct bfd_elf_version_deps *n;
struct elf_link_hash_entry *h;
+ struct bfd_link_hash_entry *bh;
cdeps = 0;
for (n = t->deps; n != NULL; n = n->next)
++cdeps;
/* Add a symbol representing this version. */
- h = NULL;
+ bh = NULL;
if (! (_bfd_generic_link_add_one_symbol
(info, dynobj, t->name, BSF_GLOBAL, bfd_abs_section_ptr,
(bfd_vma) 0, (const char *) NULL, false,
- get_elf_backend_data (dynobj)->collect,
- (struct bfd_link_hash_entry **) &h)))
+ get_elf_backend_data (dynobj)->collect, &bh)))
return false;
+ h = (struct elf_link_hash_entry *) bh;
h->elf_link_hash_flags &= ~ ELF_LINK_NON_ELF;
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
h->type = STT_OBJECT;
@@ -3886,9 +3898,12 @@ elf_fix_symbol_flags (h, eif)
{
struct elf_link_hash_entry *weakdef;
+ weakdef = h->weakdef;
+ if (h->root.type == bfd_link_hash_indirect)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
BFD_ASSERT (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak);
- weakdef = h->weakdef;
BFD_ASSERT (weakdef->root.type == bfd_link_hash_defined
|| weakdef->root.type == bfd_link_hash_defweak);
BFD_ASSERT (weakdef->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC);
@@ -6335,11 +6350,10 @@ elf_link_output_extsym (h, data)
sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
}
- /* If a symbol is not defined locally, we clear the visibility
- field. */
+ /* If a symbol is not defined locally, we clear the visibility field. */
if (! finfo->info->relocateable
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
- sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other);
+ sym.st_other &= ~ ELF_ST_VISIBILITY (-1);
/* If this symbol should be put in the .dynsym section, then put it
there now. We already know the symbol index. We also fill in
OpenPOWER on IntegriCloud