From 866f48b717574d0bcf220751e0626e60432eb207 Mon Sep 17 00:00:00 2001 From: Kaz Kojima Date: Sat, 2 Aug 2003 13:46:44 +0000 Subject: [PATCH] * elf32-sh.c (sh_elf_check_relocs): Don't set DF_TEXTREL here. * ld-sh/shared-2.d, ld-sh/textrel1.s, ld-sh/textrel2.s: New test. --- bfd/ChangeLog | 4 ++++ bfd/elf32-sh.c | 2 -- ld/testsuite/ChangeLog | 4 ++++ ld/testsuite/ld-sh/shared-2.d | 20 ++++++++++++++++++++ ld/testsuite/ld-sh/textrel1.s | 11 +++++++++++ ld/testsuite/ld-sh/textrel2.s | 7 +++++++ 6 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 ld/testsuite/ld-sh/shared-2.d create mode 100644 ld/testsuite/ld-sh/textrel1.s create mode 100644 ld/testsuite/ld-sh/textrel2.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cf9c4536838..1b4b2ccc733 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2003-08-02 Kaz Kojima + + * elf32-sh.c (sh_elf_check_relocs): Don't set DF_TEXTREL here. + 2003-08-01 H.J. Lu * elfxx-ia64.c (get_got): Align the .got section at 8 bytes. diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 39fb14c6a1a..541786581d6 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -6497,8 +6497,6 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, sreloc, 2)) return FALSE; } - if (sec->flags & SEC_READONLY) - info->flags |= DF_TEXTREL; elf_section_data (sec)->sreloc = sreloc; } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 5ce50c4110d..fb5c4a1d9cd 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-08-02 Kaz Kojima + + * ld-sh/shared-2.d, ld-sh/textrel1.s, ld-sh/textrel2.s: New test. + 2003-08-02 Alan Modra * ld-d10v/reloc-001.d: Adjust for objdump -d change. diff --git a/ld/testsuite/ld-sh/shared-2.d b/ld/testsuite/ld-sh/shared-2.d new file mode 100644 index 00000000000..12175caecb2 --- /dev/null +++ b/ld/testsuite/ld-sh/shared-2.d @@ -0,0 +1,20 @@ +#source: textrel1.s +#source: textrel2.s +#as: -little +#ld: -shared -EL +#readelf: -d +#target: sh*-*-elf sh*-*-linux* sh*-*-netbsd* + +# Make sure that there is no unnecessary DT_TEXTREL entry. + +Dynamic segment at offset 0x[0-9a-f]+ contains 9 entries: + Tag Type Name/Value + 0x00000004 \(HASH\) 0x[0-9a-f]+ + 0x00000005 \(STRTAB\) 0x[0-9a-f]+ + 0x00000006 \(SYMTAB\) 0x[0-9a-f]+ + 0x0000000a \(STRSZ\) [0-9]+ \(bytes\) + 0x0000000b \(SYMENT\) 16 \(bytes\) + 0x00000007 \(RELA\) 0x[0-9a-f]+ + 0x00000008 \(RELASZ\) 12 \(bytes\) + 0x00000009 \(RELAENT\) 12 \(bytes\) + 0x00000000 \(NULL\) 0x0 diff --git a/ld/testsuite/ld-sh/textrel1.s b/ld/testsuite/ld-sh/textrel1.s new file mode 100644 index 00000000000..eda4804bc5e --- /dev/null +++ b/ld/testsuite/ld-sh/textrel1.s @@ -0,0 +1,11 @@ + .text + .align 5 + .globl f +f: + mov.l .L1,r0 + rts + nop + .align 2 +.L1: .long g - f + .long foo@GOT + diff --git a/ld/testsuite/ld-sh/textrel2.s b/ld/testsuite/ld-sh/textrel2.s new file mode 100644 index 00000000000..1846a6b7211 --- /dev/null +++ b/ld/testsuite/ld-sh/textrel2.s @@ -0,0 +1,7 @@ + .text + .align 5 + .globl g + .hidden g +g: + rts + nop -- 2.30.2