A patch for ELF_ST_VISIBILITY
H . J . Lu
hjl@valinux.com
Tue May 23 07:08:00 GMT 2000
I checked in this patch into CVS. Let know if there is any problem.
Thanks.
--
H.J. Lu (hjl@gnu.org)
---
2000-05-23 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_relocate_section): Don't allow the
undefined symbol with the non-default visibility attributes.
* elf-hppa.h (elf_hppa_relocate_section): Likewise.
* elf32-arm.h (elf32_arm_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
* elf32-mips.c (mips_elf_calculate_relocation): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
* elf64-ia64.c (elf64_ia64_relocate_section): Likewise.
* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
Index: elf-hppa.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf-hppa.h,v
retrieving revision 1.4
diff -u -p -r1.4 elf-hppa.h
--- elf-hppa.h 2000/05/21 21:51:03 1.4
+++ elf-hppa.h 2000/05/23 13:52:04
@@ -1341,7 +1341,8 @@ elf_hppa_relocate_section (output_bfd, i
relocation = 0;
}
/* Allow undefined symbols in shared libraries. */
- else if (info->shared && !info->no_undefined)
+ else if (info->shared && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
{
if (info->symbolic)
(*info->callbacks->undefined_symbol)
Index: elf32-arm.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-arm.h,v
retrieving revision 1.4
diff -u -p -r1.4 elf32-arm.h
--- elf32-arm.h 2000/04/12 17:27:27 1.4
+++ elf32-arm.h 2000/05/23 13:52:45
@@ -1838,14 +1838,17 @@ elf32_arm_relocate_section (output_bfd,
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
if (!((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
Index: elf32-i370.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i370.c,v
retrieving revision 1.5
diff -u -p -r1.5 elf32-i370.c
--- elf32-i370.c 2000/03/12 17:40:13 1.5
+++ elf32-i370.c 2000/05/23 13:53:47
@@ -1413,7 +1413,8 @@ i370_elf_relocate_section (output_bfd, i
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared)
+ else if (info->shared
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
Index: elf32-i386.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i386.c,v
retrieving revision 1.13
diff -u -p -r1.13 elf32-i386.c
--- elf32-i386.c 2000/05/02 17:23:17 1.13
+++ elf32-i386.c 2000/05/22 21:26:04
@@ -1390,14 +1390,17 @@ elf_i386_relocate_section (output_bfd, i
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
Index: elf32-m68k.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-m68k.c,v
retrieving revision 1.5
diff -u -p -r1.5 elf32-m68k.c
--- elf32-m68k.c 2000/05/02 17:23:17 1.5
+++ elf32-m68k.c 2000/05/23 13:43:05
@@ -1479,14 +1479,17 @@ elf_m68k_relocate_section (output_bfd, i
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
if (!(info->callbacks->undefined_symbol
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
Index: elf32-mcore.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-mcore.c,v
retrieving revision 1.3
diff -u -p -r1.3 elf32-mcore.c
--- elf32-mcore.c 2000/03/12 17:40:13 1.3
+++ elf32-mcore.c 2000/05/23 13:44:42
@@ -532,7 +532,8 @@ mcore_elf_relocate_section (output_bfd,
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared)
+ else if (info->shared
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
Index: elf32-mips.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-mips.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-mips.c
--- elf32-mips.c 2000/04/16 17:13:29 1.6
+++ elf32-mips.c 2000/05/23 13:45:25
@@ -5930,7 +5930,8 @@ mips_elf_calculate_relocation (abfd,
and check to see if they exist by looking at their
addresses. */
symbol = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
symbol = 0;
else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0)
{
@@ -5948,7 +5949,8 @@ mips_elf_calculate_relocation (abfd,
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.root.string, input_bfd,
input_section, relocation->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return bfd_reloc_undefined;
symbol = 0;
}
Index: elf32-ppc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-ppc.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-ppc.c
--- elf32-ppc.c 2000/05/02 17:23:17 1.6
+++ elf32-ppc.c 2000/05/23 13:46:41
@@ -3104,7 +3104,9 @@ ppc_elf_relocate_section (output_bfd, in
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
@@ -3114,7 +3116,8 @@ ppc_elf_relocate_section (output_bfd, in
input_section,
rel->r_offset,
(!info->shared
- || info->no_undefined)))
+ || info->no_undefined
+ ELF_ST_VISIBILITY (h->other))))
return false;
relocation = 0;
}
Index: elf32-sparc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-sparc.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-sparc.c
--- elf32-sparc.c 2000/03/12 17:40:13 1.6
+++ elf32-sparc.c 2000/05/23 13:47:12
@@ -1213,14 +1213,17 @@ elf32_sparc_relocate_section (output_bfd
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
Index: elf64-alpha.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-alpha.c,v
retrieving revision 1.12
diff -u -p -r1.12 elf64-alpha.c
--- elf64-alpha.c 2000/04/03 17:08:23 1.12
+++ elf64-alpha.c 2000/05/23 13:47:42
@@ -3475,14 +3475,17 @@ elf64_alpha_relocate_section (output_bfd
}
else if (h->root.root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
if (!((*info->callbacks->undefined_symbol)
(info, h->root.root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
Index: elf64-ia64.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-ia64.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 elf64-ia64.c
--- elf64-ia64.c 2000/04/23 16:40:31 1.1.1.1
+++ elf64-ia64.c 2000/05/23 13:48:22
@@ -2863,14 +2863,17 @@ elf64_ia64_relocate_section (output_bfd,
}
else if (h->root.type == bfd_link_hash_undefweak)
undef_weak_ref = true;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
;
else
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
ret_val = false;
continue;
Index: elf64-sparc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-sparc.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf64-sparc.c
--- elf64-sparc.c 2000/03/12 17:40:13 1.6
+++ elf64-sparc.c 2000/05/23 13:48:48
@@ -2049,14 +2049,17 @@ sparc64_elf_relocate_section (output_bfd
}
else if (h->root.type == bfd_link_hash_undefweak)
relocation = 0;
- else if (info->shared && !info->symbolic && !info->no_undefined)
+ else if (info->shared && !info->symbolic
+ && !info->no_undefined
+ && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
relocation = 0;
else
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, rel->r_offset,
- (!info->shared || info->no_undefined))))
+ (!info->shared || info->no_undefined
+ || ELF_ST_VISIBILITY (h->other)))))
return false;
relocation = 0;
}
More information about the Binutils
mailing list