From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH 3/4] Remove bfd ELF_RELROPAGESIZE
Date: Tue, 8 Feb 2022 11:38:32 +1030 [thread overview]
Message-ID: <20220208010833.2103874-4-amodra@gmail.com> (raw)
In-Reply-To: <20220208010833.2103874-1-amodra@gmail.com>
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 a2f294da983..9b82353f573 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 7223c497d07..f9c808dd294 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
next prev parent reply other threads:[~2022-02-08 1:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 1:08 [PATCH 0/4] PR28824, relro security issues Alan Modra
2022-02-08 1:08 ` [PATCH 1/4] " Alan Modra
2022-02-08 1:08 ` [PATCH 2/4] PR28824, relro security issues, x86 keep COMMONPAGESIZE relro Alan Modra
2022-02-14 2:18 ` Alan Modra
2022-02-14 3:13 ` H.J. Lu
2022-02-08 1:08 ` Alan Modra [this message]
2022-02-08 1:08 ` [PATCH 4/4] Don't pass around expld.dataseg pointer Alan Modra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220208010833.2103874-4-amodra@gmail.com \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).