]> git.pld-linux.org Git - packages/binutils.git/blob - x86_crash.patch
469243fb0d28319d01b1cb30b95ee09093c46008
[packages/binutils.git] / x86_crash.patch
1 From ae1cab7d3f39686d9c7ddadbac297e9ae76ffccf Mon Sep 17 00:00:00 2001
2 From: "H.J. Lu" <hjl.tools@gmail.com>
3 Date: Tue, 15 Feb 2022 15:03:02 -0800
4 Subject: [PATCH] i386: Update I386_NEED_DYNAMIC_RELOC_TYPE_P for DT_TEXTREL
5
6 Update I386_NEED_DYNAMIC_RELOC_TYPE_P to allow R_386_TLS_IE for relocation
7 in read-only section.
8
9 bfd/
10
11         PR ld/28894
12         * elfxx-x86.h (I386_NEED_DYNAMIC_RELOC_TYPE_P): Allow
13         R_386_TLS_IE.
14
15 ld/
16         PR ld/28894
17         * testsuite/ld-i386/i386.exp: Run pr28894.
18         * testsuite/ld-i386/pr28894.d: New file.
19         * testsuite/ld-i386/pr28894.s: Likewise.
20
21 (cherry picked from commit 3319ba7a8d6a42ba071d691789bc184632399331)
22 ---
23  bfd/elfxx-x86.h                | 1 +
24  ld/testsuite/ld-i386/i386.exp  | 1 +
25  ld/testsuite/ld-i386/pr28894.d | 3 +++
26  ld/testsuite/ld-i386/pr28894.s | 7 +++++++
27  4 files changed, 12 insertions(+)
28  create mode 100644 ld/testsuite/ld-i386/pr28894.d
29  create mode 100644 ld/testsuite/ld-i386/pr28894.s
30
31 diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
32 index 3219f363a9a..77fb1ad72bc 100644
33 --- a/bfd/elfxx-x86.h
34 +++ b/bfd/elfxx-x86.h
35 @@ -80,6 +80,7 @@
36  #define I386_NEED_DYNAMIC_RELOC_TYPE_P(TYPE) \
37    (I386_SIZE_TYPE_P (TYPE) \
38     || I386_RELATIVE_RELOC_TYPE_P (TYPE) \
39 +   || (TYPE) == R_386_TLS_IE \
40     || (TYPE) == R_386_TLS_LE \
41     || (TYPE) == R_386_TLS_LE_32)
42  #define X86_NEED_DYNAMIC_RELOC_TYPE_P(IS_X86_64, TYPE) \
43 diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
44 index d997c757325..fadbd160420 100644
45 --- a/ld/testsuite/ld-i386/i386.exp
46 +++ b/ld/testsuite/ld-i386/i386.exp
47 @@ -510,6 +510,7 @@ run_dump_test "pr27491-4"
48  run_dump_test "dt-relr-1a"
49  run_dump_test "dt-relr-1b"
50  run_dump_test "pr28870"
51 +run_dump_test "pr28894"
52  
53  if { !([istarget "i?86-*-linux*"]
54         || [istarget "i?86-*-gnu*"]
55 diff --git a/ld/testsuite/ld-i386/pr28894.d b/ld/testsuite/ld-i386/pr28894.d
56 new file mode 100644
57 index 00000000000..a8d1111eb1f
58 --- /dev/null
59 +++ b/ld/testsuite/ld-i386/pr28894.d
60 @@ -0,0 +1,3 @@
61 +#as: --32
62 +#ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
63 +#error: .*warning: creating DT_TEXTREL in a shared object
64 diff --git a/ld/testsuite/ld-i386/pr28894.s b/ld/testsuite/ld-i386/pr28894.s
65 new file mode 100644
66 index 00000000000..1d3e3f37f3e
67 --- /dev/null
68 +++ b/ld/testsuite/ld-i386/pr28894.s
69 @@ -0,0 +1,7 @@
70 +       .text
71 +       addl    foo@INDNTPOFF, %eax
72 +       .section .tbss,"awT",@nobits
73 +       .globl  foo
74 +       .hidden foo
75 +foo:
76 +       .byte 0
77 -- 
78 2.27.0
79
This page took 0.028807 seconds and 2 git commands to generate.