pr24276
authorMatthias Klose <doko@debian.org>
Thu, 21 Mar 2019 14:49:23 +0000 (14:49 +0000)
committerMatthias Klose <doko@debian.org>
Thu, 21 Mar 2019 14:49:23 +0000 (14:49 +0000)
Skip symbol defined by linker when checking copy reloc on protected
symbol.

bfd/

PR ld/24276
* elf64-x86-64.c (elf_x86_64_check_relocs): Skip symbol defined
by linker when checking copy reloc on protected symbol.

ld/

PR ld/24276
* testsuite/ld-i386/i386.exp: Run PR ld/24276 test.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr24276.dso: New file.
* testsuite/ld-i386/pr24276.warn: Likewise.
* testsuite/ld-x86-64/pr24276.dso: Likewise.
* testsuite/ld-x86-64/pr24276.warn: Likewise.

Gbp-Pq: Name pr24276.diff

bfd/elf64-x86-64.c
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr24276.dso [new file with mode: 0644]
ld/testsuite/ld-i386/pr24276.warn [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr24276.dso [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr24276.warn [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index e265cf324e48d24f8357397e9dae73683cedfa17..dec3287d60858149b840fdc995bee126bc7c3957 100644 (file)
@@ -2238,6 +2238,8 @@ check_pic:
              bfd_boolean no_copyreloc_p
                = (info->nocopyreloc
                   || (h != NULL
+                      && !h->root.linker_def
+                      && !h->root.ldscript_def
                       && eh->def_protected
                       && elf_has_no_copy_on_protected (h->root.u.def.section->owner)));
              if ((sec->flags & SEC_ALLOC) != 0
index 56c95367e1cc0170d7b887ac67fb4db1c01f3c78..e56d15f513fc6d2546cc655e34b20da2ae336d0c 100644 (file)
@@ -785,6 +785,15 @@ if { [isnative]
            {{objdump {-dw} pr19319.dd}} \
            "pr19319" \
        ] \
+       [list \
+           "Build pr24276.so" \
+           "-shared -nostdlib -nostartfiles \
+            -Ltmpdir $srcdir/$subdir/pr24276.dso" \
+           "-Wa,-mx86-used-note=yes" \
+           { pr19319b.S } \
+           {{warning_output pr24276.warn}} \
+           "pr24276.so" \
+       ] \
        [list \
            "Build property 1" \
            "" \
diff --git a/ld/testsuite/ld-i386/pr24276.dso b/ld/testsuite/ld-i386/pr24276.dso
new file mode 100644 (file)
index 0000000..9add115
--- /dev/null
@@ -0,0 +1,9 @@
+INPUT(pr19319.so)
+SECTIONS {
+  my_section : {
+    __start_my_section = .;
+    *(my_section);
+    __stop_my_section = .;
+
+  }
+}
diff --git a/ld/testsuite/ld-i386/pr24276.warn b/ld/testsuite/ld-i386/pr24276.warn
new file mode 100644 (file)
index 0000000..5fcfa34
--- /dev/null
@@ -0,0 +1 @@
+.*contains output sections.*
diff --git a/ld/testsuite/ld-x86-64/pr24276.dso b/ld/testsuite/ld-x86-64/pr24276.dso
new file mode 100644 (file)
index 0000000..9add115
--- /dev/null
@@ -0,0 +1,9 @@
+INPUT(pr19319.so)
+SECTIONS {
+  my_section : {
+    __start_my_section = .;
+    *(my_section);
+    __stop_my_section = .;
+
+  }
+}
diff --git a/ld/testsuite/ld-x86-64/pr24276.warn b/ld/testsuite/ld-x86-64/pr24276.warn
new file mode 100644 (file)
index 0000000..5fcfa34
--- /dev/null
@@ -0,0 +1 @@
+.*contains output sections.*
index ac41d8ea49101a28e6fbc971a479a73aab9def8b..cdd549b149fdc6526f141c0d0d07d08636c70137 100644 (file)
@@ -923,6 +923,15 @@ if { [isnative] && [which $CC] != 0 } {
            {{objdump {-dw} pr19319.dd}} \
            "pr19319" \
        ] \
+       [list \
+           "Build pr24276.so" \
+           "-shared -nostdlib -nostartfiles \
+            -Ltmpdir $srcdir/$subdir/pr24276.dso" \
+           "-Wa,-mx86-used-note=yes" \
+           { pr19319b.S } \
+           {{warning_output pr24276.warn}} \
+           "pr24276.so" \
+       ] \
        [list \
            "Build property 1" \
            "" \