From: Alan Modra Date: Tue, 8 Feb 2022 00:03:17 +0000 (+1030) Subject: Remove bfd ELF_RELROPAGESIZE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7d6aa4b321f2722512be7422394629eec526448b;p=binutils-gdb.git Remove bfd ELF_RELROPAGESIZE Now that ld properly aligns the end of the relro segment, the hack to make relro work on powerpc can disappear. bfd/ * bfd.c (bfd_emul_get_commonpagesize): Remove relro param. Don't return bed->relropagesize. * elf-bfd.h (struct elf_backend_data): Remove relropagesize. * elfxx-target.h (ELF_RELROPAGESIZE): Remove. * elf32-ppc.c (ELF_RELROPAGESIZE): Don't define. * elf64-ppc.c: Likewise. * bfd-in2.h: Regenerate. ld/ * ldemul.c (after_parse_default): Adjust bfd_emul_get_commonpagesize call. --- diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 8e815bab624..3b2a4f49a9b 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7273,7 +7273,7 @@ bool bfd_alt_mach_code (bfd *abfd, int alternative); bfd_vma bfd_emul_get_maxpagesize (const char *); -bfd_vma bfd_emul_get_commonpagesize (const char *, bool); +bfd_vma bfd_emul_get_commonpagesize (const char *); char *bfd_demangle (bfd *, const char *, int); diff --git a/bfd/bfd.c b/bfd/bfd.c index d83371333fe..913ce2d6abe 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -2344,7 +2344,7 @@ FUNCTION bfd_emul_get_commonpagesize SYNOPSIS - bfd_vma bfd_emul_get_commonpagesize (const char *, bool); + bfd_vma bfd_emul_get_commonpagesize (const char *); DESCRIPTION Returns the common page size, in bytes, as determined by @@ -2355,7 +2355,7 @@ RETURNS */ bfd_vma -bfd_emul_get_commonpagesize (const char *emul, bool relro) +bfd_emul_get_commonpagesize (const char *emul) { const bfd_target *target; @@ -2366,10 +2366,7 @@ bfd_emul_get_commonpagesize (const char *emul, bool relro) const struct elf_backend_data *bed; bed = xvec_get_elf_backend_data (target); - if (relro) - return bed->relropagesize; - else - return bed->commonpagesize; + return bed->commonpagesize; } return 0; } diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 1d3ae76339a..889a4746371 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -946,9 +946,6 @@ struct elf_backend_data /* The common page size for this backend. */ bfd_vma commonpagesize; - /* The value of commonpagesize to use when -z relro for this backend. */ - bfd_vma relropagesize; - /* The p_align value for this backend. If it is set, p_align of PT_LOAD alignment will be to p_align by default. */ bfd_vma p_align; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 53051308eb1..42273ca06fe 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -10373,7 +10373,6 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, #define ELF_MACHINE_CODE EM_PPC #define ELF_MAXPAGESIZE 0x10000 #define ELF_COMMONPAGESIZE 0x1000 -#define ELF_RELROPAGESIZE ELF_MAXPAGESIZE #define elf_info_to_howto ppc_elf_info_to_howto #ifdef EM_CYGNUS_POWERPC diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 7b7bfa19506..dd79c05bb61 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -75,7 +75,6 @@ static bfd_vma opd_entry_value #define ELF_MACHINE_CODE EM_PPC64 #define ELF_MAXPAGESIZE 0x10000 #define ELF_COMMONPAGESIZE 0x1000 -#define ELF_RELROPAGESIZE ELF_MAXPAGESIZE #define elf_info_to_howto ppc64_elf_info_to_howto #define elf_backend_want_got_sym 0 diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index e31985ef777..0579f64d1a0 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -379,10 +379,6 @@ #define ELF_COMMONPAGESIZE ELF_MAXPAGESIZE #endif -#ifndef ELF_RELROPAGESIZE -#define ELF_RELROPAGESIZE ELF_COMMONPAGESIZE -#endif - #ifndef ELF_MINPAGESIZE #define ELF_MINPAGESIZE ELF_COMMONPAGESIZE #endif @@ -390,15 +386,9 @@ #if ELF_COMMONPAGESIZE > ELF_MAXPAGESIZE # error ELF_COMMONPAGESIZE > ELF_MAXPAGESIZE #endif -#if ELF_RELROPAGESIZE > ELF_MAXPAGESIZE -# error ELF_RELROPAGESIZE > ELF_MAXPAGESIZE -#endif #if ELF_MINPAGESIZE > ELF_COMMONPAGESIZE # error ELF_MINPAGESIZE > ELF_COMMONPAGESIZE #endif -#if ELF_MINPAGESIZE > ELF_RELROPAGESIZE -# error ELF_MINPAGESIZE > ELF_RELROPAGESIZE -#endif #ifndef ELF_P_ALIGN #define ELF_P_ALIGN 0 @@ -822,7 +812,6 @@ static const struct elf_backend_data elfNN_bed = ELF_MAXPAGESIZE, /* maxpagesize */ ELF_MINPAGESIZE, /* minpagesize */ ELF_COMMONPAGESIZE, /* commonpagesize */ - ELF_RELROPAGESIZE, /* commonpagesize to use with -z relro */ ELF_P_ALIGN, /* p_align */ ELF_DYNAMIC_SEC_FLAGS, /* dynamic_sec_flags */ elf_backend_arch_data, diff --git a/ld/ldemul.c b/ld/ldemul.c index 5c5adef06bb..85c00ded75e 100644 --- a/ld/ldemul.c +++ b/ld/ldemul.c @@ -235,8 +235,7 @@ after_parse_default (void) if (link_info.maxpagesize == 0) link_info.maxpagesize = bfd_emul_get_maxpagesize (default_target); if (link_info.commonpagesize == 0) - link_info.commonpagesize = bfd_emul_get_commonpagesize (default_target, - link_info.relro); + link_info.commonpagesize = bfd_emul_get_commonpagesize (default_target); } void