From 15f40dfc73fc065fd6f203ea56fc8edbcd6736f0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 11 Aug 2003 14:26:11 +0000 Subject: [PATCH] * elf32-i386.c (elf_i386_relocate_section): Make undefined symbols fatal if -pie. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. (ppc_elf_relocate_section) : Issue fatal error on undefined symbols if -pie. * elf32-sh.c (sh_elf_relocate_section): Likewise. --- bfd/ChangeLog | 17 +++++++++++++++++ bfd/elf32-i386.c | 2 +- bfd/elf32-ppc.c | 6 +++--- bfd/elf32-s390.c | 2 +- bfd/elf32-sh.c | 4 ++-- bfd/elf32-sparc.c | 2 +- bfd/elf64-alpha.c | 2 +- bfd/elf64-ppc.c | 2 +- bfd/elf64-s390.c | 2 +- bfd/elf64-sparc.c | 2 +- bfd/elf64-x86-64.c | 2 +- bfd/elfxx-ia64.c | 2 +- 12 files changed, 31 insertions(+), 14 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0709dc3ec5..93cd6c0161 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2003-08-11 Jakub Jelinek + + * elf32-i386.c (elf_i386_relocate_section): Make undefined symbols + fatal if -pie. + * elf32-s390.c (elf_s390_relocate_section): Likewise. + * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. + * elf64-alpha.c (elf64_alpha_relocate_section): Likewise. + * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. + * elf64-s390.c (elf_s390_relocate_section): Likewise. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. + * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. + * elf32-ppc.c (ppc_elf_relocate_section): Likewise. + (ppc_elf_relocate_section) : Issue fatal error + on undefined symbols if -pie. + * elf32-sh.c (sh_elf_relocate_section): Likewise. + 2003-08-11 Alan Modra * elf64-ppc.c (ppc64_elf_relocate_section): Add special case for crt1.o diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 23020b417b..77b5e369bc 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2186,7 +2186,7 @@ elf_i386_relocate_section (bfd *output_bfd, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; } diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index b820638a58..b78a64c0cf 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4760,7 +4760,7 @@ ppc_elf_relocate_section (bfd *output_bfd, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_offset, (!info->shared + rel->r_offset, (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; @@ -5529,7 +5529,7 @@ ppc_elf_relocate_section (bfd *output_bfd, + sym_sec->output_offset); } } - else if (info->shared + else if (!info->executable && !info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) ; @@ -5538,7 +5538,7 @@ ppc_elf_relocate_section (bfd *output_bfd, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; continue; diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 85e9ab6ae0..bead5d0275 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -2365,7 +2365,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; relocation = 0; diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ac410c2842..b509536e47 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -4764,7 +4764,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, } else if (h->root.type == bfd_link_hash_undefweak) relocation = 0; - else if (info->shared + else if (! info->executable && ! info->no_undefined && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) relocation = 0; @@ -4773,7 +4773,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; relocation = 0; diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index 136d80e37d..d8ad11d77a 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -2218,7 +2218,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 1d35a6d5d0..4511f71cb5 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -4481,7 +4481,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (!((*info->callbacks->undefined_symbol) (info, h->root.root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->root.other))))) return FALSE; continue; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 966dc431cd..4291f9bb01 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -7384,7 +7384,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, { if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, - rel->r_offset, (!info->shared + rel->r_offset, (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 23ca8aade0..0a5e472467 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2335,7 +2335,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; relocation = 0; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 25c609fc59..d554134b34 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2106,7 +2106,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 39d5abbe6f..970d742d0d 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1861,7 +1861,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; relocation = 0; diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index fe1490ac9a..3175b815f3 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -3893,7 +3893,7 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (! ((*info->callbacks->undefined_symbol) (info, h->root.root.string, input_bfd, input_section, rel->r_offset, - (!info->shared || info->no_undefined + (info->executable || info->no_undefined || ELF_ST_VISIBILITY (h->other))))) return FALSE; continue;