* elf32-sh.c (sh_elf_relocate_section): Don't complain about
authorKaz Kojima <kkojima@rr.iij4u.or.jp>
Thu, 28 Nov 2002 08:37:15 +0000 (08:37 +0000)
committerKaz Kojima <kkojima@rr.iij4u.or.jp>
Thu, 28 Nov 2002 08:37:15 +0000 (08:37 +0000)
        unresolved debugging relocs in dynamic applications.
* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
* ld-sh/refdbg-0-dso.d: New test.
* ld-sh/refdbg-1.d: Likewise.
* ld-sh/refdbg.s: Likewise.
* ld-sh/refdbglib.s: Likewise.

bfd/ChangeLog
bfd/elf32-sh.c
bfd/elf64-sh64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-sh/refdbg-0-dso.d [new file with mode: 0644]
ld/testsuite/ld-sh/refdbg-1.d [new file with mode: 0644]
ld/testsuite/ld-sh/refdbg.s [new file with mode: 0644]
ld/testsuite/ld-sh/refdbglib.s [new file with mode: 0644]

index 1823e3a83799f57b5e4b5fd7ab976ff0c093ba67..f0b8dc68352b50d14b7b8da611094b9de6de04fc 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-28  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * elf32-sh.c (sh_elf_relocate_section): Don't complain about
+        unresolved debugging relocs in dynamic applications.
+       * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+
 2002-11-26  Alan Modra  <amodra@bigpond.net.au>
 
        * elf-eh-frame.c (ENSURE_NO_RELOCS): Disregard R_*_NONE relocs.
index f52245bcc3409558bb4ea72d23a1ae8df6557c7d..c7c078ceaf4436da8137b84aaf75d5803d8f3555 100644 (file)
@@ -4753,6 +4753,13 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                          || ((input_section->flags & SEC_DEBUGGING) != 0
                              && (h->elf_link_hash_flags
                                  & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
+                 /* Dynamic relocs are not propagated for SEC_DEBUGGING
+                    sections because such sections are not SEC_ALLOC and
+                    thus ld.so will not process them.  */
+                 || (sec->output_section == NULL
+                     && ((input_section->flags & SEC_DEBUGGING) != 0
+                         && (h->elf_link_hash_flags
+                             & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
                  || (sec->output_section == NULL
                      && (sh_elf_hash_entry (h)->tls_type == GOT_TLS_IE
                          || sh_elf_hash_entry (h)->tls_type == GOT_TLS_GD)))
index da02505d5c538081a09b92a3a8dc70eb70716b9a..590c13369cd653fae191db3c49a5635d9ab33931 100644 (file)
@@ -1680,7 +1680,14 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
                             sections against symbols defined externally
                             in shared libraries.  We can't do anything
                             with them here.  */
-                         || (input_section->flags & SEC_DEBUGGING) != 0)))
+                         || (input_section->flags & SEC_DEBUGGING) != 0))
+                 /* Dynamic relocs are not propagated for SEC_DEBUGGING
+                    sections because such sections are not SEC_ALLOC and
+                    thus ld.so will not process them.  */
+                 || (sec->output_section == NULL
+                     && ((input_section->flags & SEC_DEBUGGING) != 0
+                         && (h->elf_link_hash_flags
+                             & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
                relocation = 0;
              else if (sec->output_section == NULL)
                {
index 4a56a90451ef3f7e9fc0a7391d4a571aacc808e1..27a09ff8e431692455a234705bf6cdcd186bdc31 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-28  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * ld-sh/refdbg-0-dso.d: New test.
+       * ld-sh/refdbg-1.d: Likewise.
+       * ld-sh/refdbg.s: Likewise.
+       * ld-sh/refdbglib.s: Likewise.
+
 2002-11-22  Alan Modra  <amodra@bigpond.net.au>
 
        * ld-elf/elf.exp: Remove sec64k test.
diff --git a/ld/testsuite/ld-sh/refdbg-0-dso.d b/ld/testsuite/ld-sh/refdbg-0-dso.d
new file mode 100644 (file)
index 0000000..c38fe3e
--- /dev/null
@@ -0,0 +1,9 @@
+#source: refdbglib.s
+#as: -little
+#ld: -shared -EL
+#objdump: -drj.text
+#target: sh*-*-linux* sh*-*-netbsd*
+
+.*: +file format elf32-sh.*
+
+#pass
diff --git a/ld/testsuite/ld-sh/refdbg-1.d b/ld/testsuite/ld-sh/refdbg-1.d
new file mode 100644 (file)
index 0000000..461788e
--- /dev/null
@@ -0,0 +1,10 @@
+#source: refdbg.s
+#as: -little
+#ld: -EL tmpdir/refdbg-0-dso.so
+#objdump: -sj.debug_info
+#target: sh*-*-linux* sh*-*-netbsd*
+
+.*: +file format elf32-sh.*
+
+Contents of section \.debug_info:
+ 0+0 0+0 +.*
diff --git a/ld/testsuite/ld-sh/refdbg.s b/ld/testsuite/ld-sh/refdbg.s
new file mode 100644 (file)
index 0000000..129d689
--- /dev/null
@@ -0,0 +1,11 @@
+       .text
+       .align 2
+       .globl  _start
+       .type   _start,@function
+_start:
+       rts
+       nop
+
+       .comm   foo,4,4
+       .section        .debug_info,"",@progbits
+       .ualong foo
diff --git a/ld/testsuite/ld-sh/refdbglib.s b/ld/testsuite/ld-sh/refdbglib.s
new file mode 100644 (file)
index 0000000..31244ac
--- /dev/null
@@ -0,0 +1,8 @@
+       .text
+       .global foo
+       .data
+       .align 2
+       .type   foo, @object
+       .size   foo, 4
+foo:
+       .long   1