]> git.pld-linux.org Git - packages/binutils.git/blob - binutils-elf_remove_property.patch
927e5eee7a224cae7e14006aac2569204ed0ee75
[packages/binutils.git] / binutils-elf_remove_property.patch
1 From df010caac3b33b1d38b6d67024091854c3f77c77 Mon Sep 17 00:00:00 2001
2 From: "H.J. Lu" <hjl.tools@gmail.com>
3 Date: Mon, 24 Jun 2019 11:08:40 -0700
4 Subject: [PATCH] elf: Remove the property after reporting its removal
5
6 commit d2ef37ebd9f771d06edf1fdea37970f60b242b2d
7 Author: H.J. Lu <hjl.tools@gmail.com>
8 Date:   Fri Dec 7 08:30:30 2018 -0800
9
10     elf: Report property change when merging properties
11
12 failed to remove the property after reporting it has been removed.  This
13 patch corrects it.
14
15 bfd/
16
17         PR ld/24721
18         * elf-properties.c (elf_merge_gnu_property_list): Remove the
19         property after reporting property removal.
20
21 ld/
22
23         PR ld/24721
24         * testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
25         * testsuite/ld-x86-64/pr24721-x32.d: New file.
26         * testsuite/ld-x86-64/pr24721.d: Likewise.
27         * testsuite/ld-x86-64/pr24721.map: Likewise.
28         * testsuite/ld-x86-64/pr24721a.s: Likewise.
29         * testsuite/ld-x86-64/pr24721b.s: Likewise.
30
31 (cherry picked from commit f93ab3a0b8039a1667a666f013cca50b03d67f9b)
32 ---
33  bfd/ChangeLog                        |  6 ++++++
34  bfd/elf-properties.c                 | 10 ++++------
35  ld/ChangeLog                         | 10 ++++++++++
36  ld/testsuite/ld-x86-64/pr24721-x32.d |  6 ++++++
37  ld/testsuite/ld-x86-64/pr24721.d     |  6 ++++++
38  ld/testsuite/ld-x86-64/pr24721.map   |  3 +++
39  ld/testsuite/ld-x86-64/pr24721a.s    | 34 ++++++++++++++++++++++++++++++++++
40  ld/testsuite/ld-x86-64/pr24721b.s    |  6 ++++++
41  ld/testsuite/ld-x86-64/x86-64.exp    |  2 ++
42  9 files changed, 77 insertions(+), 6 deletions(-)
43  create mode 100644 ld/testsuite/ld-x86-64/pr24721-x32.d
44  create mode 100644 ld/testsuite/ld-x86-64/pr24721.d
45  create mode 100644 ld/testsuite/ld-x86-64/pr24721.map
46  create mode 100644 ld/testsuite/ld-x86-64/pr24721a.s
47  create mode 100644 ld/testsuite/ld-x86-64/pr24721b.s
48
49 diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
50 index 5e48d75..4a9907f 100644
51 --- a/bfd/elf-properties.c
52 +++ b/bfd/elf-properties.c
53 @@ -322,12 +322,10 @@ elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *first_pbfd,
54                          (bfd_vma) p->property.pr_type, first_pbfd, abfd);
55                   }
56               }
57 -           else
58 -             {
59 -               /* Remove this property.  */
60 -               *lastp = p->next;
61 -               continue;
62 -             }
63 +
64 +           /* Remove this property.  */
65 +           *lastp = p->next;
66 +           continue;
67           }
68         else if (number_p)
69           {
70 diff --git a/ld/testsuite/ld-x86-64/pr24721-x32.d b/ld/testsuite/ld-x86-64/pr24721-x32.d
71 new file mode 100644
72 index 0000000..9b067ef
73 --- /dev/null
74 +++ b/ld/testsuite/ld-x86-64/pr24721-x32.d
75 @@ -0,0 +1,6 @@
76 +#source: pr24721a.s
77 +#source: pr24721b.s
78 +#as: --x32 -mx86-used-note=no
79 +#ld: -r -m elf32_x86_64 -Map tmpdir/pr24721.map
80 +#readelf: -n
81 +#map: pr24721.map
82 diff --git a/ld/testsuite/ld-x86-64/pr24721.d b/ld/testsuite/ld-x86-64/pr24721.d
83 new file mode 100644
84 index 0000000..efa88db
85 --- /dev/null
86 +++ b/ld/testsuite/ld-x86-64/pr24721.d
87 @@ -0,0 +1,6 @@
88 +#source: pr24721a.s
89 +#source: pr24721b.s
90 +#as: --64 -defsym __64_bit__=1 -mx86-used-note=no
91 +#ld: -r -melf_x86_64 -Map tmpdir/pr24721.map
92 +#readelf: -n
93 +#map: pr24721.map
94 diff --git a/ld/testsuite/ld-x86-64/pr24721.map b/ld/testsuite/ld-x86-64/pr24721.map
95 new file mode 100644
96 index 0000000..9e63fff
97 --- /dev/null
98 +++ b/ld/testsuite/ld-x86-64/pr24721.map
99 @@ -0,0 +1,3 @@
100 +#...
101 +Removed property 0xc0000002 to merge tmpdir/pr24721a.o \(0x1\) and tmpdir/pr24721b.o \(not found\)
102 +#pass
103 diff --git a/ld/testsuite/ld-x86-64/pr24721a.s b/ld/testsuite/ld-x86-64/pr24721a.s
104 new file mode 100644
105 index 0000000..b229d19
106 --- /dev/null
107 +++ b/ld/testsuite/ld-x86-64/pr24721a.s
108 @@ -0,0 +1,34 @@
109 +       .text
110 +       .globl foo
111 +       .type foo,@function
112 +       .p2align 4
113 +foo:
114 +       ret
115 +
116 +       .section ".note.gnu.property", "a"
117 +.ifdef __64_bit__
118 +       .p2align 3
119 +.else
120 +       .p2align 2
121 +.endif
122 +       .long 1f - 0f           /* name length */
123 +       .long 5f - 2f           /* data length */
124 +       .long 5                 /* note type */
125 +0:     .asciz "GNU"            /* vendor name */
126 +1:
127 +.ifdef __64_bit__
128 +       .p2align 3
129 +.else
130 +       .p2align 2
131 +.endif
132 +2:     .long 0xc0000002        /* pr_type.  */
133 +       .long 4f - 3f           /* pr_datasz.  */
134 +3:
135 +       .long 0x1
136 +4:
137 +.ifdef __64_bit__
138 +       .p2align 3
139 +.else
140 +       .p2align 2
141 +.endif
142 +5:
143 diff --git a/ld/testsuite/ld-x86-64/pr24721b.s b/ld/testsuite/ld-x86-64/pr24721b.s
144 new file mode 100644
145 index 0000000..3d11691
146 --- /dev/null
147 +++ b/ld/testsuite/ld-x86-64/pr24721b.s
148 @@ -0,0 +1,6 @@
149 +       .text
150 +       .globl bar
151 +       .type bar,@function
152 +       .p2align 4
153 +bar:
154 +       ret
155 diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
156 index 9a76486..707ab89 100644
157 --- a/ld/testsuite/ld-x86-64/x86-64.exp
158 +++ b/ld/testsuite/ld-x86-64/x86-64.exp
159 @@ -432,6 +432,8 @@ run_dump_test "pr24458b"
160  run_dump_test "pr23854"
161  run_dump_test "pr23930"
162  run_dump_test "pr23930-x32"
163 +run_dump_test "pr24721"
164 +run_dump_test "pr24721-x32"
165  
166  if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
167      return
168 -- 
169 2.9.3
170
This page took 0.033456 seconds and 2 git commands to generate.