* [PATCH] i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL
@ 2022-02-15 23:07 H.J. Lu
2022-02-15 23:12 ` H.J. Lu
0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2022-02-15 23:07 UTC (permalink / raw)
To: binutils
Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation
in read-only section.
bfd/
PR ld/28894
* elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow
R_386_TLS_IE.
ld/
PR ld/28894
* testsuite/ld-i386/i386.exp: Run pr28894.
* testsuite/ld-i386/pr28894.d: New file.
* testsuite/ld-i386/pr28894.s: Likewise.
---
bfd/elfxx-x86.h | 1 +
ld/testsuite/ld-i386/i386.exp | 1 +
ld/testsuite/ld-i386/pr28894.d | 3 +++
ld/testsuite/ld-i386/pr28894.s | 7 +++++++
4 files changed, 12 insertions(+)
create mode 100644 ld/testsuite/ld-i386/pr28894.d
create mode 100644 ld/testsuite/ld-i386/pr28894.s
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index 3219f363a9a..77fb1ad72bc 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -80,6 +80,7 @@
#define I386_NEED_DYNAMIC_RELOC_TYPE_P(TYPE) \
(I386_SIZE_TYPE_P (TYPE) \
|| I386_RELATIVE_RELOC_TYPE_P (TYPE) \
+ || (TYPE) == R_386_TLS_IE \
|| (TYPE) == R_386_TLS_LE \
|| (TYPE) == R_386_TLS_LE_32)
#define X86_NEED_DYNAMIC_RELOC_TYPE_P(IS_X86_64, TYPE) \
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index d997c757325..fadbd160420 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -510,6 +510,7 @@ run_dump_test "pr27491-4"
run_dump_test "dt-relr-1a"
run_dump_test "dt-relr-1b"
run_dump_test "pr28870"
+run_dump_test "pr28894"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-i386/pr28894.d b/ld/testsuite/ld-i386/pr28894.d
new file mode 100644
index 00000000000..a8d1111eb1f
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr28894.d
@@ -0,0 +1,3 @@
+#as: --32
+#ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
+#error: .*warning: creating DT_TEXTREL in a shared object
diff --git a/ld/testsuite/ld-i386/pr28894.s b/ld/testsuite/ld-i386/pr28894.s
new file mode 100644
index 00000000000..1d3e3f37f3e
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr28894.s
@@ -0,0 +1,7 @@
+ .text
+ addl foo@INDNTPOFF, %eax
+ .section .tbss,"awT",@nobits
+ .globl foo
+ .hidden foo
+foo:
+ .byte 0
--
2.35.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL
2022-02-15 23:07 [PATCH] i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL H.J. Lu
@ 2022-02-15 23:12 ` H.J. Lu
0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2022-02-15 23:12 UTC (permalink / raw)
To: Binutils
On Tue, Feb 15, 2022 at 3:07 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation
> in read-only section.
>
> bfd/
>
> PR ld/28894
> * elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow
> R_386_TLS_IE.
>
> ld/
> PR ld/28894
> * testsuite/ld-i386/i386.exp: Run pr28894.
> * testsuite/ld-i386/pr28894.d: New file.
> * testsuite/ld-i386/pr28894.s: Likewise.
> ---
> bfd/elfxx-x86.h | 1 +
> ld/testsuite/ld-i386/i386.exp | 1 +
> ld/testsuite/ld-i386/pr28894.d | 3 +++
> ld/testsuite/ld-i386/pr28894.s | 7 +++++++
> 4 files changed, 12 insertions(+)
> create mode 100644 ld/testsuite/ld-i386/pr28894.d
> create mode 100644 ld/testsuite/ld-i386/pr28894.s
>
> diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
> index 3219f363a9a..77fb1ad72bc 100644
> --- a/bfd/elfxx-x86.h
> +++ b/bfd/elfxx-x86.h
> @@ -80,6 +80,7 @@
> #define I386_NEED_DYNAMIC_RELOC_TYPE_P(TYPE) \
> (I386_SIZE_TYPE_P (TYPE) \
> || I386_RELATIVE_RELOC_TYPE_P (TYPE) \
> + || (TYPE) == R_386_TLS_IE \
> || (TYPE) == R_386_TLS_LE \
> || (TYPE) == R_386_TLS_LE_32)
> #define X86_NEED_DYNAMIC_RELOC_TYPE_P(IS_X86_64, TYPE) \
> diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
> index d997c757325..fadbd160420 100644
> --- a/ld/testsuite/ld-i386/i386.exp
> +++ b/ld/testsuite/ld-i386/i386.exp
> @@ -510,6 +510,7 @@ run_dump_test "pr27491-4"
> run_dump_test "dt-relr-1a"
> run_dump_test "dt-relr-1b"
> run_dump_test "pr28870"
> +run_dump_test "pr28894"
>
> if { !([istarget "i?86-*-linux*"]
> || [istarget "i?86-*-gnu*"]
> diff --git a/ld/testsuite/ld-i386/pr28894.d b/ld/testsuite/ld-i386/pr28894.d
> new file mode 100644
> index 00000000000..a8d1111eb1f
> --- /dev/null
> +++ b/ld/testsuite/ld-i386/pr28894.d
> @@ -0,0 +1,3 @@
> +#as: --32
> +#ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
> +#error: .*warning: creating DT_TEXTREL in a shared object
> diff --git a/ld/testsuite/ld-i386/pr28894.s b/ld/testsuite/ld-i386/pr28894.s
> new file mode 100644
> index 00000000000..1d3e3f37f3e
> --- /dev/null
> +++ b/ld/testsuite/ld-i386/pr28894.s
> @@ -0,0 +1,7 @@
> + .text
> + addl foo@INDNTPOFF, %eax
> + .section .tbss,"awT",@nobits
> + .globl foo
> + .hidden foo
> +foo:
> + .byte 0
> --
> 2.35.1
>
I am backporting this to 2.38 branch.
--
H.J.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-15 23:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 23:07 [PATCH] i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL H.J. Lu
2022-02-15 23:12 ` H.J. Lu
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).