diff options
16 files changed, 3349 insertions, 124 deletions
diff --git a/sys-devel/binutils/ChangeLog b/sys-devel/binutils/ChangeLog index ebfc5ef71e86..52fddb11c8ee 100644 --- a/sys-devel/binutils/ChangeLog +++ b/sys-devel/binutils/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for sys-devel/binutils # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/ChangeLog,v 1.36 2003/03/01 22:19:43 lostlogic Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/ChangeLog,v 1.37 2003/03/09 02:51:07 azarah Exp $ + +*binutils-2.13.90.0.18-r1 (08 Mar 2003) + + 08 Mar 2003; Martin Schlemmer <azarah@gentoo.org> binutils-2.13.90.0.18-r1.ebuild : + Update patches from Redhat. 18 Feb 2003; Zach Welch <zwelch@gentoo.org> : Added arm to keywords. diff --git a/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild b/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild new file mode 100644 index 000000000000..b08f145c74b4 --- /dev/null +++ b/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild @@ -0,0 +1,177 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils/binutils-2.13.90.0.18-r1.ebuild,v 1.1 2003/03/09 02:51:07 azarah Exp $ + +IUSE="nls bootstrap build" + +# NOTE to Maintainer: ChangeLog states that it no longer use perl to build +# the manpages, but seems this is incorrect .... + +inherit eutils libtool flag-o-matic + +# Generate borked binaries. Bug #6730 +filter-flags "-fomit-frame-pointer -fssa" + +S="${WORKDIR}/${P}" +DESCRIPTION="Tools necessary to build programs" +SRC_URI="ftp://ftp.kernel.org/pub/linux/devel/binutils/${P}.tar.bz2 + ftp://ftp.kernel.org/pub/linux/devel/binutils/test/${P}.tar.bz2 + mirror://gentoo/${PN}-2.13.90.0.18-20030206.patch.bz2" +HOMEPAGE="http://sources.redhat.com/binutils/" + +SLOT="0" +LICENSE="GPL-2|LGPL-2" +KEYWORDS="~x86 ~ppc ~alpha ~sparc ~mips ~hppa ~arm" + +DEPEND="virtual/glibc + >=sys-apps/portage-2.0.21 + nls? ( sys-devel/gettext ) + || ( sys-devel/perl + ( !build? ( sys-devel/perl ) ) + ( !bootstrap? ( sys-devel/perl ) ) + )" +# This is a hairy one. Basically depend on sys-devel/perl +# if "build" or "bootstrap" not in USE. + + +# filter CFLAGS=".. -O2 .." on arm +if [ "${ARCH}" = "arm" ]; then + CFLAGS="$(echo "${CFLAGS}" | sed -e 's,-O[2-9] ,-O1 ,')" +fi + +src_unpack() { + + unpack ${A} + + cd ${S} + # Various patches from Redhat/Mandrake... + epatch ${DISTDIR}/${PN}-2.13.90.0.18-20030206.patch.bz2 + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.10-glibc21.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-sparc-nonpic.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.10-ia64-brl.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-eh-frame-ro.patch + use x86 &> /dev/null \ + && epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.16-array-sects-compat.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-ltconfig-multilib.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-searchdir.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-libpath-suffix.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-alpha-relax.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-s390-noreladyn.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-eh-frame-hdr.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-compatsym.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-ppc64-tls1.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-ppc64-tls2.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-s390-file-loc.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.18-sub-same.patch + epatch ${FILESDIR}/2.13/${PN}-2.13.90.0.10-x86_64-gotpcrel.patch + + # Add patches for mips + if [ "${ARCH}" = "mips" ] + then + cd ${S} + chmod +x mips/README + ./mips/README + fi +} + +src_compile() { + local myconf="" + + use nls && \ + myconf="${myconf} --without-included-gettext" || \ + myconf="${myconf} --disable-nls" + + # Fix /usr/lib/libbfd.la + elibtoolize --portage + + ./configure --enable-shared \ + --enable-64-bit-bfd \ + --prefix=/usr \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --host=${CHOST} \ + ${myconf} || die + + make configure-bfd || die + make headers -C bfd || die + emake tooldir="${ROOT}/usr/bin" \ + all || die + + if [ -z "`use build`" ] + then + if [ -z "`use bootstrap`" ] + then + # Nuke the manpages to recreate them (only use this if we have perl) + find . -name '*.1' -exec rm -f {} \; || : + fi + # Make the info pages (makeinfo included with gcc is used) + make info || die + fi +} + +src_install() { + + make prefix=${D}/usr \ + mandir=${D}/usr/share/man \ + infodir=${D}/usr/share/info \ + install || die + + insinto /usr/include + doins include/libiberty.h + + # c++filt is included with gcc -- what are these GNU people thinking? + # but not the manpage, so leave that! + rm -f ${D}/usr/bin/c++filt #${D}/usr/share/man/man1/c++filt* + + # By default strip has a symlink going from /usr/${CHOST}/bin/strip to + # /usr/bin/strip we should reverse it: + + rm ${D}/usr/${CHOST}/bin/strip; mv ${D}/usr/bin/strip ${D}/usr/${CHOST}/bin/strip + # The strip symlink gets created in the loop below + + # By default ar, as, ld, nm, ranlib and strip are in two places; create + # symlinks. This will reduce the size of the tbz2 significantly. We also + # move all the stuff in /usr/bin to /usr/${CHOST}/bin and create the + # appropriate symlinks. Things are cleaner that way. + cd ${D}/usr/bin + local x="" + for x in * strip + do + if [ ! -e ../${CHOST}/bin/${x} ] + then + mv ${x} ../${CHOST}/bin/${x} + else + rm -f ${x} + fi + ln -s ../${CHOST}/bin/${x} ${x} + done + + cd ${S} + if [ -z "`use build`" ] + then + make prefix=${D}/usr \ + mandir=${D}/usr/share/man \ + infodir=${D}/usr/share/info \ + install-info || die + + dodoc COPYING* README + docinto bfd + dodoc bfd/ChangeLog* bfd/COPYING bfd/README bfd/PORTING bfd/TODO + docinto binutils + dodoc binutils/ChangeLog binutils/NEWS binutils/README + docinto gas + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/COPYING gas/NEWS gas/README* + docinto gprof + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO + docinto ld + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO + docinto libiberty + dodoc libiberty/ChangeLog* libiberty/COPYING.LIB libiberty/README + docinto opcodes + dodoc opcodes/ChangeLog* + # Install pre-generated manpages .. currently we do not ... + else + rm -rf ${D}/usr/share/man + fi +} + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-alpha-relax.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-alpha-relax.patch new file mode 100644 index 000000000000..a9bd3bceffa0 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-alpha-relax.patch @@ -0,0 +1,23 @@ +2003-02-06 Jakub Jelinek <jakub@redhat.com> + + * elf64-alpha.c (elf64_alpha_relax_section): Don't crash if + local_got_entries is NULL. + +--- bfd/elf64-alpha.c.jj 2003-02-06 10:53:56.000000000 -0500 ++++ bfd/elf64-alpha.c 2003-02-06 10:53:56.000000000 -0500 +@@ -2184,7 +2184,13 @@ elf64_alpha_relax_section (abfd, sec, li + + info.h = NULL; + info.other = isym->st_other; +- info.first_gotent = &local_got_entries[r_symndx]; ++ if (local_got_entries) ++ info.first_gotent = &local_got_entries[r_symndx]; ++ else ++ { ++ info.first_gotent = &info.gotent; ++ info.gotent = NULL; ++ } + } + else + { + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-compatsym.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-compatsym.patch new file mode 100644 index 000000000000..447d208e6877 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-compatsym.patch @@ -0,0 +1,397 @@ +2003-02-10 Jakub Jelinek <jakub@redhat.com> + +bfd/ + * elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO. +ld/testsuite/ + * ld-shared/shared.exp: Run on s390*-*-linux* and x86_64-*-linux* too. + xfail tests linking non-pic code into shared libs on x86_64-*-linux*. + * ld-elfvsb/elfvsb.exp: Likewise. + * ld-elfvers/vers.exp: Likewise. Add vers24a, vers24b and vers24c + tests. + * ld-elfvers/vers3.ver: Allow VERS_2.0 to come before GLIBC_* + version. + * ld-elfvers/vers19.ver: Likewise. + * ld-elfvers/vers24a.c: New test. + * ld-elfvers/vers24b.c: New test. + * ld-elfvers/vers24c.c: New test. + * ld-elfvers/vers24.map: New test. + * ld-elfvers/vers24.rd: New test. + * lib/ld-lib.exp (run_ld_link_tests): Add optional 7th argument + cflags. If source files have .c extension, compile them first. + +--- bfd/elflink.h.jj 2003-02-05 18:24:42.000000000 -0500 ++++ bfd/elflink.h 2003-02-10 10:42:05.000000000 -0500 +@@ -1168,6 +1168,8 @@ elf_link_add_object_symbols (abfd, info) + Elf_External_Versym *extversym = NULL; + Elf_External_Versym *ever; + struct elf_link_hash_entry *weaks; ++ struct elf_link_hash_entry **nondeflt_vers = NULL; ++ bfd_size_type nondeflt_vers_cnt = 0; + Elf_Internal_Sym *isymbuf = NULL; + Elf_Internal_Sym *isym; + Elf_Internal_Sym *isymend; +@@ -1997,6 +1999,23 @@ elf_link_add_object_symbols (abfd, info) + override, dt_needed)) + goto error_free_vers; + ++ if (definition && (abfd->flags & DYNAMIC) == 0) ++ { ++ char *p = strchr (name, ELF_VER_CHR); ++ if (p != NULL && p[1] != ELF_VER_CHR) ++ { ++ /* Queue non-default versions so that .symver x, x@FOO ++ aliases can be checked. */ ++ if (! nondeflt_vers) ++ { ++ amt = (isymend - isym + 1) ++ * sizeof (struct elf_link_hash_entry *); ++ nondeflt_vers = bfd_malloc (amt); ++ } ++ nondeflt_vers [nondeflt_vers_cnt++] = h; ++ } ++ } ++ + if (dynsym && h->dynindx == -1) + { + if (! _bfd_elf_link_record_dynamic_symbol (info, h)) +@@ -2071,6 +2090,55 @@ elf_link_add_object_symbols (abfd, info) + } + } + ++ /* Now that all the symbols from this input file are created, handle ++ .symver foo, foo@BAR such that any relocs against foo become foo@BAR. */ ++ if (nondeflt_vers != NULL) ++ { ++ bfd_size_type cnt, symidx; ++ ++ for (cnt = 0; cnt < nondeflt_vers_cnt; ++cnt) ++ { ++ struct elf_link_hash_entry *h = nondeflt_vers[cnt], *hi; ++ char *shortname, *p; ++ ++ p = strchr (h->root.root.string, ELF_VER_CHR); ++ if (p == NULL ++ || (h->root.type != bfd_link_hash_defined ++ && h->root.type != bfd_link_hash_defweak)) ++ continue; ++ ++ amt = p - h->root.root.string; ++ shortname = bfd_malloc (amt + 1); ++ memcpy (shortname, h->root.root.string, amt); ++ shortname[amt] = '\0'; ++ ++ hi = (struct elf_link_hash_entry *) ++ bfd_link_hash_lookup (info->hash, shortname, ++ FALSE, FALSE, FALSE); ++ if (hi != NULL ++ && hi->root.type == h->root.type ++ && hi->root.u.def.value == h->root.u.def.value ++ && hi->root.u.def.section == h->root.u.def.section) ++ { ++ (*bed->elf_backend_hide_symbol) (info, hi, TRUE); ++ hi->root.type = bfd_link_hash_indirect; ++ hi->root.u.i.link = (struct bfd_link_hash_entry *) h; ++ (*bed->elf_backend_copy_indirect_symbol) (bed, h, hi); ++ sym_hash = elf_sym_hashes (abfd); ++ if (sym_hash) ++ for (symidx = 0; symidx < extsymcount; ++symidx) ++ if (sym_hash[symidx] == hi) ++ { ++ sym_hash[symidx] = h; ++ break; ++ } ++ } ++ free (shortname); ++ } ++ free (nondeflt_vers); ++ nondeflt_vers = NULL; ++ } ++ + if (extversym != NULL) + { + free (extversym); +@@ -2277,6 +2346,8 @@ elf_link_add_object_symbols (abfd, info) + return TRUE; + + error_free_vers: ++ if (nondeflt_vers != NULL) ++ free (nondeflt_vers); + if (extversym != NULL) + free (extversym); + error_free_sym: +--- ld/testsuite/ld-elfvers/vers.exp.jj 2002-09-10 08:51:14.000000000 -0400 ++++ ld/testsuite/ld-elfvers/vers.exp 2003-02-09 17:59:11.000000000 -0500 +@@ -43,7 +43,9 @@ if { ![istarget hppa*64*-*-hpux*] \ + && ![istarget sparc*-*-linux*] \ + && ![istarget arm*-*-linux*] \ + && ![istarget mips*-*-linux*] \ +- && ![istarget alpha*-*-linux*] } { ++ && ![istarget alpha*-*-linux*] \ ++ && ![istarget s390*-*-linux*] \ ++ && ![istarget x86_64-*-linux*] } { + return + } + +@@ -719,7 +721,12 @@ build_vers_lib "vers1" vers1.c vers1 "" + # Test #2 - build a library, and link it against the library we built in step + # 1. + # +-build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym "" ++if [istarget x86_64-*-linux*] { ++ # x86_64 doesn't like non-pic shared libraries ++ xfail "vers2" ++} else { ++ build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym "" ++} + + # + # Test #3 - build an executable, and link it against vers1.so. +@@ -838,3 +845,21 @@ build_vers_lib "vers23b" vers23b.c vers2 + build_vers_lib "vers23c" vers23b.c vers23c "vers23a.so" vers23b.map vers23c.ver vers23b.dsym "" + build_exec "vers23d" vers23.c vers23d "tmpdir/vers23a.so tmpdir/vers23c.so" "" vers23.ver vers23d.dsym "" + build_exec "vers23" vers23.c vers23 "tmpdir/vers23a.so tmpdir/vers23b.o tmpdir/vers23b.so" "" vers23.ver vers23.dsym "" ++ ++# Test .symver x,x@VERS.0 ++set as_pic_flags "" ++if [istarget sparc*-*-*] { ++ set as_pic_flags "-K PIC" ++} ++run_ld_link_tests [list "\"vers24a\" ++ \"-shared --version-script $srcdir/$subdir/vers24.map\" ++ \"$as_pic_flags\" {vers24a.c vers24b.c} { { readelf -Wrs vers24.rd } } ++ \"libvers24a.so\" \"-fpic\""] ++run_ld_link_tests [list "\"vers24b\" ++ \"-shared --version-script $srcdir/$subdir/vers24.map\" ++ \"$as_pic_flags\" {vers24b.c vers24a.c} { { readelf -Wrs vers24.rd } } ++ \"libvers24b.so\" \"-fpic\""] ++run_ld_link_tests [list "\"vers24c\" ++ \"-shared --version-script $srcdir/$subdir/vers24.map\" ++ \"$as_pic_flags\" {vers24c.c} { { readelf -Wrs vers24.rd } } ++ \"libvers24c.so\" \"-fpic\""] +--- ld/testsuite/ld-elfvers/vers24a.c.jj 2003-02-08 16:00:04.000000000 -0500 ++++ ld/testsuite/ld-elfvers/vers24a.c 2003-02-08 17:27:53.000000000 -0500 +@@ -0,0 +1,5 @@ ++/* Test whether .symver x, x@foo ++ causes relocations against x within the same shared library ++ to become dynamic relocations against x@foo. */ ++int x = 12; ++__asm__ (".symver x, x@VERS.0"); +--- ld/testsuite/ld-elfvers/vers24b.c.jj 2003-02-08 16:00:15.000000000 -0500 ++++ ld/testsuite/ld-elfvers/vers24b.c 2003-02-07 17:43:02.000000000 -0500 +@@ -0,0 +1,5 @@ ++extern int x; ++void foo (void) ++{ ++ x = 24; ++} +--- ld/testsuite/ld-elfvers/vers24.map.jj 2003-02-08 16:00:32.000000000 -0500 ++++ ld/testsuite/ld-elfvers/vers24.map 2003-02-08 16:01:23.000000000 -0500 +@@ -0,0 +1,4 @@ ++VERS.0 { ++ global: x; foo; ++ local: *; ++}; +--- ld/testsuite/ld-elfvers/vers3.ver.jj 2001-07-11 09:48:54.000000000 -0400 ++++ ld/testsuite/ld-elfvers/vers3.ver 2003-02-09 17:57:40.000000000 -0500 +@@ -1,4 +1,4 @@ + Version References: + required from tmpdir/vers1.so: +- 0x0a7922b0 0x00 02 VERS_2.0 ++ 0x0a7922b0 0x00 0[23] VERS_2.0 + +--- ld/testsuite/ld-elfvers/vers24.rd.jj 2003-02-08 17:18:25.000000000 -0500 ++++ ld/testsuite/ld-elfvers/vers24.rd 2003-02-09 18:22:41.000000000 -0500 +@@ -0,0 +1,15 @@ ++Relocation section .* ++# Ensure there is a dynamic relocation against x ++#... ++[0-9a-f]+ +[0-9a-f]+ R_.* +x(| \+ 0) ++#... ++Symbol table '.dynsym' contains [0-9]+ entries: ++# And ensure the dynamic symbol table contains at least x@VERS.0 ++# and foo@@VERS.0 symbols ++#... ++ +[0-9]+: [0-9a-f]+ +(4 OBJECT +GLOBAL DEFAULT +[0-9]+ x|[0-9]+ FUNC +GLOBAL DEFAULT +[0-9]+ foo@)@VERS\.0 ++#... ++ +[0-9]+: [0-9a-f]+ +(4 OBJECT +GLOBAL DEFAULT +[0-9]+ x|[0-9]+ FUNC +GLOBAL DEFAULT +[0-9]+ foo@)@VERS\.0 ++#... ++Symbol table '.symtab' contains [0-9]+ entries: ++#pass +--- ld/testsuite/ld-elfvers/vers24c.c.jj 2003-02-08 17:29:10.000000000 -0500 ++++ ld/testsuite/ld-elfvers/vers24c.c 2003-02-08 17:29:04.000000000 -0500 +@@ -0,0 +1,9 @@ ++/* Test whether .symver x, x@foo ++ causes relocations against x within the same shared library ++ to become dynamic relocations against x@foo. */ ++int x = 12; ++__asm__ (".symver x, x@VERS.0"); ++void foo (void) ++{ ++ x = 24; ++} +--- ld/testsuite/ld-elfvers/vers19.ver.jj 2001-05-11 06:26:01.000000000 -0400 ++++ ld/testsuite/ld-elfvers/vers19.ver 2003-02-09 17:57:53.000000000 -0500 +@@ -1,3 +1,3 @@ + Version References: + required from vers17.so: +- 0x0a7922b0 0x00 02 VERS_2.0 ++ 0x0a7922b0 0x00 0[23] VERS_2.0 +--- ld/testsuite/ld-elfvsb/elfvsb.exp.jj 2002-07-30 10:20:17.000000000 -0400 ++++ ld/testsuite/ld-elfvsb/elfvsb.exp 2003-02-09 18:23:44.000000000 -0500 +@@ -1,5 +1,5 @@ + # Expect script for ld-visibility tests +-# Copyright 2000, 2001 Free Software Foundation, Inc. ++# Copyright 2000, 2001, 2003 Free Software Foundation, Inc. + # + # This file is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -35,7 +35,9 @@ if { ![istarget hppa*64*-*-hpux*] \ + && ![istarget powerpc-*-linux*] \ + && ![istarget arm*-*-linux*] \ + && ![istarget alpha*-*-linux*] \ +- && ![istarget sparc*-*-linux*] } { ++ && ![istarget sparc*-*-linux*] \ ++ && ![istarget s390*-*-linux*] \ ++ && ![istarget x86_64-*-linux*] } { + return + } + +@@ -255,6 +257,7 @@ proc visibility_run {visibility} { + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" + } ++ setup_xfail "x86_64-*-linux*" + + visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o elfvsb + +@@ -285,6 +288,7 @@ proc visibility_run {visibility} { + setup_xfail "alpha*-*-linux*" + setup_xfail "mips*-*-linux*" + } ++ setup_xfail "x86_64-*-linux*" + visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \ + mainnp.o sh1np.o sh2np.o elfvsb \ + "-T $srcdir/$subdir/elf-offset.ld" +@@ -341,6 +345,7 @@ proc visibility_run {visibility} { + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" + } ++ setup_xfail "x86_64-*-linux*" + visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o elfvsb + } + } else { +--- ld/testsuite/lib/ld-lib.exp.jj 2002-12-28 17:19:23.000000000 -0500 ++++ ld/testsuite/lib/ld-lib.exp 2003-02-08 16:15:19.000000000 -0500 +@@ -1,5 +1,5 @@ + # Support routines for LD testsuite. +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 ++# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + # Free Software Foundation, Inc. + # + # This file is free software; you can redistribute it and/or modify +@@ -978,9 +978,11 @@ proc file_contents { filename } { + return $contents + } + +-# List contains test-items with 3 items followed by 2 lists: ++# List contains test-items with 3 items followed by 2 lists, one item and ++# one optional item: + # 0:name 1:ld options 2:assembler options + # 3:filenames of assembler files 4: action and options. 5: name of output file ++# 6:compiler flags (optional) + + # Actions: + # objdump: Apply objdump options on result. Compare with regex (last arg). +@@ -996,14 +998,17 @@ proc run_ld_link_tests { ldtests } { + global srcdir + global subdir + global env ++ global CC ++ global CFLAGS + + foreach testitem $ldtests { + set testname [lindex $testitem 0] + set ld_options [lindex $testitem 1] + set as_options [lindex $testitem 2] +- set as_files [lindex $testitem 3] ++ set src_files [lindex $testitem 3] + set actions [lindex $testitem 4] + set binfile tmpdir/[lindex $testitem 5] ++ set cflags [lindex $testitem 6] + set objfiles {} + set is_unresolved 0 + set failed 0 +@@ -1011,16 +1016,25 @@ proc run_ld_link_tests { ldtests } { + # verbose -log "Testname is $testname" + # verbose -log "ld_options is $ld_options" + # verbose -log "as_options is $as_options" +-# verbose -log "as_files is $as_files" ++# verbose -log "src_files is $src_files" + # verbose -log "actions is $actions" + # verbose -log "binfile is $binfile" + + # Assemble each file in the test. +- foreach as_file $as_files { +- set objfile "tmpdir/[file rootname $as_file].o" ++ foreach src_file $src_files { ++ set objfile "tmpdir/[file rootname $src_file].o" + lappend objfiles $objfile + +- if ![ld_assemble $as "$as_options $srcdir/$subdir/$as_file" $objfile] { ++ if { [file extension $src_file] == ".c" } { ++ set as_file "tmpdir/[file rootname $src_file].s" ++ if ![ld_compile "$CC -S $CFLAGS $cflags" $srcdir/$subdir/$src_file $as_file] { ++ set is_unresolved 1 ++ break ++ } ++ } else { ++ set as_file "$srcdir/$subdir/$src_file" ++ } ++ if ![ld_assemble $as "$as_options $as_file" $objfile] { + set is_unresolved 1 + break + } +--- ld/testsuite/ld-shared/shared.exp.jj 2002-07-30 10:20:20.000000000 -0400 ++++ ld/testsuite/ld-shared/shared.exp 2003-02-09 18:00:00.000000000 -0500 +@@ -1,5 +1,5 @@ + # Expect script for ld-shared tests +-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 ++# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003 + # Free Software Foundation, Inc. + # + # This file is free software; you can redistribute it and/or modify +@@ -49,7 +49,9 @@ if { ![istarget hppa*64*-*-hpux*] \ + && ![istarget arm*-*-linux*] \ + && ![istarget alpha*-*-linux*] \ + && ![istarget rs6000*-*-aix*] \ +- && ![istarget powerpc*-*-aix*] } { ++ && ![istarget powerpc*-*-aix*] \ ++ && ![istarget s390*-*-linux*] \ ++ && ![istarget x86_64-*-linux*] } { + return + } + +@@ -198,6 +200,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $ + setup_xfail "*-*-sunos4*" + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" ++ setup_xfail "x86_64-*-linux*" + shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared + + # Test ELF shared library relocations with a non-zero load +@@ -210,6 +213,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $ + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" + setup_xfail "mips*-*-linux*" ++ setup_xfail "x86_64-*-linux*" + shared_test shnp "shared (non PIC, load offset)" \ + mainnp.o sh1np.o sh2np.o shared \ + "-T $srcdir/$subdir/elf-offset.ld" +@@ -251,6 +255,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $p + setup_xfail "*-*-sunos4*" + setup_xfail "ia64-*-linux*" + setup_xfail "alpha*-*-linux*" ++ setup_xfail "x86_64-*-linux*" + shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared + } + } else { diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-hdr.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-hdr.patch new file mode 100644 index 000000000000..b832e42fe3ee --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-hdr.patch @@ -0,0 +1,101 @@ +2003-02-06 Andreas Schwab <schwab@suse.de> + + * elf-eh-frame.c (get_DW_EH_PE_signed): Define. + (read_value): Add parameter is_signed, use signed extraction if + the value is signed. + (_bfd_elf_write_section_eh_frame): Pass signed flag of the + encoding to read_value. + +--- bfd/elf-eh-frame.c.~1.21.~ 2003-02-04 14:21:18.000000000 +0100 ++++ bfd/elf-eh-frame.c 2003-02-06 16:03:07.000000000 +0100 +@@ -33,7 +33,7 @@ static bfd_signed_vma read_signed_leb128 + static int get_DW_EH_PE_width + PARAMS ((int, int)); + static bfd_vma read_value +- PARAMS ((bfd *, bfd_byte *, int)); ++ PARAMS ((bfd *, bfd_byte *, int, int)); + static void write_value + PARAMS ((bfd *, bfd_byte *, bfd_vma, int)); + static int cie_compare +@@ -141,22 +141,42 @@ int get_DW_EH_PE_width (encoding, ptr_si + return 0; + } + ++#define get_DW_EH_PE_signed(encoding) (((encoding) & DW_EH_PE_signed) != 0) ++ + /* Read a width sized value from memory. */ + + static bfd_vma +-read_value (abfd, buf, width) ++read_value (abfd, buf, width, is_signed) + bfd *abfd; + bfd_byte *buf; + int width; ++ int is_signed; + { + bfd_vma value; + + switch (width) + { +- case 2: value = bfd_get_16 (abfd, buf); break; +- case 4: value = bfd_get_32 (abfd, buf); break; +- case 8: value = bfd_get_64 (abfd, buf); break; +- default: BFD_FAIL (); return 0; ++ case 2: ++ if (is_signed) ++ value = bfd_get_signed_16 (abfd, buf); ++ else ++ value = bfd_get_16 (abfd, buf); ++ break; ++ case 4: ++ if (is_signed) ++ value = bfd_get_signed_32 (abfd, buf); ++ else ++ value = bfd_get_32 (abfd, buf); ++ break; ++ case 8: ++ if (is_signed) ++ value = bfd_get_signed_64 (abfd, buf); ++ else ++ value = bfd_get_64 (abfd, buf); ++ break; ++ default: ++ BFD_FAIL (); ++ return 0; + } + + return value; +@@ -925,7 +945,9 @@ _bfd_elf_write_section_eh_frame (abfd, i + { + bfd_vma value; + +- value = read_value (abfd, buf, per_width); ++ value = read_value (abfd, buf, per_width, ++ get_DW_EH_PE_signed ++ (per_encoding)); + value += (sec_info->entry[i].offset + - sec_info->entry[i].new_offset); + write_value (abfd, buf, value, per_width); +@@ -961,7 +983,9 @@ _bfd_elf_write_section_eh_frame (abfd, i + buf += 4; + width = get_DW_EH_PE_width (sec_info->entry[i].fde_encoding, + ptr_size); +- address = value = read_value (abfd, buf, width); ++ address = value = read_value (abfd, buf, width, ++ get_DW_EH_PE_signed ++ (sec_info->entry[i].fde_encoding)); + if (value) + { + switch (sec_info->entry[i].fde_encoding & 0xf0) +@@ -1005,7 +1029,9 @@ _bfd_elf_write_section_eh_frame (abfd, i + buf += sec_info->entry[i].lsda_offset; + width = get_DW_EH_PE_width (sec_info->entry[i].lsda_encoding, + ptr_size); +- value = read_value (abfd, buf, width); ++ value = read_value (abfd, buf, width, ++ get_DW_EH_PE_signed ++ (sec_info->entry[i].lsda_encoding)); + if (value) + { + if ((sec_info->entry[i].lsda_encoding & 0xf0) + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-ro.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-ro.patch index b19486670df5..2e9d15bb7926 100644 --- a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-ro.patch +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-eh-frame-ro.patch @@ -36,31 +36,8 @@ * scripttempl/elf.sc (.eh_frame, .gcc_except_table): Move into text segment if all input sections are readonly. -diff -Naurp binutils-2.13.90.0.18.orig/ld/emultempl/elf32.em binutils-2.13.90.0.18/ld/emultempl/elf32.em ---- binutils-2.13.90.0.18.orig/ld/emultempl/elf32.em 2003-01-21 13:21:34.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/emultempl/elf32.em 2003-01-27 10:12:32.000000000 -0500 -@@ -1051,7 +1051,8 @@ output_rel_find (sec) - for (u = lang_output_section_statement.head; u; u = lookup->next) - { - lookup = &u->output_section_statement; -- if (strncmp (".rel", lookup->name, 4) == 0) -+ if (lookup->constraint != -1 -+ && strncmp (".rel", lookup->name, 4) == 0) - { - /* Don't place after .rel.plt as doing so results in wrong - dynamic tags. Also, place allocated reloc sections before -@@ -1291,7 +1292,7 @@ gld${EMULATION_NAME}_place_orphan (file, - (bfd_vma) 0, - (etree_type *) NULL, - (etree_type *) NULL, -- load_base); -+ load_base, 0); - - lang_add_section (&os->children, s, os, file); - -diff -Naurp binutils-2.13.90.0.18.orig/ld/emultempl/mmo.em binutils-2.13.90.0.18/ld/emultempl/mmo.em ---- binutils-2.13.90.0.18.orig/ld/emultempl/mmo.em 2002-12-16 15:22:53.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/emultempl/mmo.em 2003-01-27 10:10:42.000000000 -0500 +--- ld/emultempl/mmo.em.jj Mon Dec 16 15:22:53 2002 ++++ ld/emultempl/mmo.em Thu Feb 6 08:33:16 2003 @@ -56,6 +56,8 @@ output_prev_sec_find (os) u = lookup->next) { @@ -79,10 +56,9 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/emultempl/mmo.em binutils-2.13.90.0.18 lang_add_section (&os->children, s, os, file); -diff -Naurp binutils-2.13.90.0.18.orig/ld/emultempl/pe.em binutils-2.13.90.0.18/ld/emultempl/pe.em ---- binutils-2.13.90.0.18.orig/ld/emultempl/pe.em 2003-01-21 13:21:34.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/emultempl/pe.em 2003-01-27 10:10:42.000000000 -0500 -@@ -1507,6 +1507,8 @@ output_prev_sec_find (os) +--- ld/emultempl/pe.em.jj Thu Feb 6 08:07:12 2003 ++++ ld/emultempl/pe.em Thu Feb 6 08:33:16 2003 +@@ -1508,6 +1508,8 @@ output_prev_sec_find (os) u = lookup->next) { lookup = &u->output_section_statement; @@ -91,7 +67,7 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/emultempl/pe.em binutils-2.13.90.0.18/ if (lookup == os) return s; -@@ -1673,7 +1675,7 @@ gld_${EMULATION_NAME}_place_orphan (file +@@ -1674,7 +1676,7 @@ gld_${EMULATION_NAME}_place_orphan (file (bfd_vma) 0, (etree_type *) NULL, (etree_type *) NULL, @@ -100,9 +76,51 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/emultempl/pe.em binutils-2.13.90.0.18/ lang_add_section (&add_child, s, os, file); -diff -Naurp binutils-2.13.90.0.18.orig/ld/ldgram.y binutils-2.13.90.0.18/ld/ldgram.y ---- binutils-2.13.90.0.18.orig/ld/ldgram.y 2003-01-21 13:21:34.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/ldgram.y 2003-01-27 10:10:42.000000000 -0500 +--- ld/emultempl/elf32.em.jj Thu Feb 6 08:07:12 2003 ++++ ld/emultempl/elf32.em Thu Feb 6 08:38:28 2003 +@@ -1053,7 +1053,8 @@ output_rel_find (sec) + for (u = lang_output_section_statement.head; u; u = lookup->next) + { + lookup = &u->output_section_statement; +- if (strncmp (".rel", lookup->name, 4) == 0) ++ if (lookup->constraint != -1 ++ && strncmp (".rel", lookup->name, 4) == 0) + { + /* Don't place after .rel.plt as doing so results in wrong + dynamic tags. Also, place allocated reloc sections before +@@ -1293,7 +1294,7 @@ gld${EMULATION_NAME}_place_orphan (file, + (bfd_vma) 0, + (etree_type *) NULL, + (etree_type *) NULL, +- load_base); ++ load_base, 0); + + lang_add_section (&os->children, s, os, file); + +--- ld/scripttempl/elf.sc.jj Fri Sep 27 11:33:09 2002 ++++ ld/scripttempl/elf.sc Thu Feb 6 08:33:16 2003 +@@ -280,6 +280,8 @@ cat <<EOF + ${CREATE_SHLIB-${SBSS2}} + ${OTHER_READONLY_SECTIONS} + .eh_frame_hdr : { *(.eh_frame_hdr) } ++ .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } ++ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table) } + + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ +@@ -312,8 +314,8 @@ cat <<EOF + .data1 ${RELOCATING-0} : { *(.data1) } + .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } + .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } +- .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } +- .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ++ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } ++ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table) } + ${WRITABLE_RODATA+${RODATA}} + ${OTHER_READWRITE_SECTIONS} + ${TEXT_DYNAMIC-${DYNAMIC}} +--- ld/ldgram.y.jj Tue Jan 21 13:21:34 2003 ++++ ld/ldgram.y Thu Feb 6 08:33:16 2003 @@ -143,14 +143,14 @@ static int error_index; %token ORIGIN FILL %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS @@ -151,9 +169,39 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/ldgram.y binutils-2.13.90.0.18/ld/ldgr } opt_comma {} -diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlang.c binutils-2.13.90.0.18/ld/ldlang.c ---- binutils-2.13.90.0.18.orig/ld/ldlang.c 2003-01-21 13:21:34.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/ldlang.c 2003-01-27 10:37:12.000000000 -0500 +--- ld/mri.c.jj Tue Jan 21 13:21:34 2003 ++++ ld/mri.c Thu Feb 6 08:33:16 2003 +@@ -237,7 +237,7 @@ mri_draw_tree () + lang_enter_output_section_statement (p->name, base, + p->ok_to_load ? 0 : noload_section, + 1, align, subalign, +- (etree_type *) NULL); ++ (etree_type *) NULL, 0); + base = 0; + tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); + tmp->next = NULL; +--- ld/ldlang.h.jj Mon Dec 16 15:22:53 2002 ++++ ld/ldlang.h Thu Feb 6 08:39:55 2003 +@@ -132,6 +132,8 @@ typedef struct lang_output_section_state + + int subsection_alignment; /* alignment of components */ + int section_alignment; /* alignment of start of section */ ++ int constraint; ++ bfd_boolean all_input_readonly; + + union etree_union *load_base; + +@@ -388,7 +390,7 @@ extern lang_output_section_statement_typ + bfd_vma block_value, + etree_type *align, + etree_type *subalign, +- etree_type *)); ++ etree_type *, int)); + extern void lang_final + PARAMS ((void)); + extern void lang_process +--- ld/ldlang.c.jj Tue Jan 21 13:21:34 2003 ++++ ld/ldlang.c Thu Feb 6 08:44:49 2003 @@ -73,6 +73,10 @@ static lang_input_statement_type *new_af bfd_boolean)); static lang_memory_region_type *lang_memory_default @@ -175,16 +223,16 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlang.c binutils-2.13.90.0.18/ld/ldla static lang_input_statement_type *lookup_name PARAMS ((const char *)); static bfd_boolean load_symbols -@@ -114,6 +121,9 @@ static void insert_undefined - PARAMS ((const char *)); - static void lang_place_undefineds +@@ -112,6 +119,9 @@ static void lang_reasonable_defaults PARAMS ((void)); + static void insert_undefined + PARAMS ((const char *)); +static void check_input_sections + PARAMS ((lang_statement_union_type *, + lang_output_section_statement_type *)); + static void lang_place_undefineds + PARAMS ((void)); static void map_input_to_output_sections - PARAMS ((lang_statement_union_type *, const char *, - lang_output_section_statement_type *)); @@ -742,9 +752,10 @@ lang_memory_default (section) return lang_memory_region_lookup ("*default*"); } @@ -300,31 +348,31 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlang.c binutils-2.13.90.0.18/ld/ldla + for (; s != (lang_statement_union_type *) NULL; s = s->header.next) + { + switch (s->header.type) -+ { -+ case lang_wild_statement_enum: -+ walk_wild (&s->wild_statement, check_section_callback, -+ output_section_statement); -+ if (! output_section_statement->all_input_readonly) -+ return; -+ break; -+ case lang_constructors_statement_enum: -+ check_input_sections (constructor_list.head, -+ output_section_statement); -+ if (! output_section_statement->all_input_readonly) -+ return; -+ break; -+ case lang_group_statement_enum: -+ check_input_sections (s->group_statement.children.head, -+ output_section_statement); -+ if (! output_section_statement->all_input_readonly) -+ return; -+ break; -+ default: -+ break; -+ } ++ { ++ case lang_wild_statement_enum: ++ walk_wild (&s->wild_statement, check_section_callback, ++ output_section_statement); ++ if (! output_section_statement->all_input_readonly) ++ return; ++ break; ++ case lang_constructors_statement_enum: ++ check_input_sections (constructor_list.head, ++ output_section_statement); ++ if (! output_section_statement->all_input_readonly) ++ return; ++ break; ++ case lang_group_statement_enum: ++ check_input_sections (s->group_statement.children.head, ++ output_section_statement); ++ if (! output_section_statement->all_input_readonly) ++ return; ++ break; ++ default: ++ break; ++ } + } +} -+ ++ /* Open input files and attach to output sections. */ static void @@ -414,30 +462,8 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlang.c binutils-2.13.90.0.18/ld/ldla /* If this is the first section, then base the VMA of future sections on this one. This will work correctly even if `.' is -diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlang.h binutils-2.13.90.0.18/ld/ldlang.h ---- binutils-2.13.90.0.18.orig/ld/ldlang.h 2002-12-16 15:22:53.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/ldlang.h 2003-01-27 10:14:00.000000000 -0500 -@@ -132,6 +132,8 @@ typedef struct lang_output_section_state - - int subsection_alignment; /* alignment of components */ - int section_alignment; /* alignment of start of section */ -+ int constraint; -+ bfd_boolean all_input_readonly; - - union etree_union *load_base; - -@@ -388,7 +390,7 @@ extern lang_output_section_statement_typ - bfd_vma block_value, - etree_type *align, - etree_type *subalign, -- etree_type *)); -+ etree_type *, int)); - extern void lang_final - PARAMS ((void)); - extern void lang_process -diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlex.l binutils-2.13.90.0.18/ld/ldlex.l ---- binutils-2.13.90.0.18.orig/ld/ldlex.l 2002-11-09 14:08:31.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/ldlex.l 2003-01-27 10:10:43.000000000 -0500 +--- ld/ldlex.l.jj Sat Nov 9 14:08:31 2002 ++++ ld/ldlex.l Thu Feb 6 08:33:16 2003 @@ -303,6 +303,8 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*? <EXPRESSION,BOTH,SCRIPT>"COPY" { RTOKEN(COPY);} <EXPRESSION,BOTH,SCRIPT>"INFO" { RTOKEN(INFO);} @@ -447,38 +473,3 @@ diff -Naurp binutils-2.13.90.0.18.orig/ld/ldlex.l binutils-2.13.90.0.18/ld/ldlex <BOTH,SCRIPT>"o" { RTOKEN(ORIGIN);} <BOTH,SCRIPT>"org" { RTOKEN(ORIGIN);} <BOTH,SCRIPT>"l" { RTOKEN( LENGTH);} -diff -Naurp binutils-2.13.90.0.18.orig/ld/mri.c binutils-2.13.90.0.18/ld/mri.c ---- binutils-2.13.90.0.18.orig/ld/mri.c 2003-01-21 13:21:34.000000000 -0500 -+++ binutils-2.13.90.0.18/ld/mri.c 2003-01-27 10:10:42.000000000 -0500 -@@ -237,7 +237,7 @@ mri_draw_tree () - lang_enter_output_section_statement (p->name, base, - p->ok_to_load ? 0 : noload_section, - 1, align, subalign, -- (etree_type *) NULL); -+ (etree_type *) NULL, 0); - base = 0; - tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); - tmp->next = NULL; -diff -Naurp binutils-2.13.90.0.18.orig/ld/scripttempl/elf.sc binutils-2.13.90.0.18/ld/scripttempl/elf.sc ---- binutils-2.13.90.0.18.orig/ld/scripttempl/elf.sc 2002-09-27 11:33:09.000000000 -0400 -+++ binutils-2.13.90.0.18/ld/scripttempl/elf.sc 2003-01-27 10:10:42.000000000 -0500 -@@ -280,6 +280,8 @@ cat <<EOF - ${CREATE_SHLIB-${SBSS2}} - ${OTHER_READONLY_SECTIONS} - .eh_frame_hdr : { *(.eh_frame_hdr) } -+ .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } -+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table) } - - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ -@@ -312,8 +314,8 @@ cat <<EOF - .data1 ${RELOCATING-0} : { *(.data1) } - .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } - .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } -- .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } -- .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } -+ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } -+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table) } - ${WRITABLE_RODATA+${RODATA}} - ${OTHER_READWRITE_SECTIONS} - ${TEXT_DYNAMIC-${DYNAMIC}} diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-libpath-suffix.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-libpath-suffix.patch new file mode 100644 index 000000000000..b8882962a252 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-libpath-suffix.patch @@ -0,0 +1,43 @@ +2003-02-06 Jakub Jelinek <jakub@redhat.com> + + * emulparams/elf64_s390.sh (LIBPATH_SUFFIX): Set to 64. + * emulparams/elf_x86_64.sh (LIBPATH_SUFFIX): Likewise. + * emulparams/elf64_sparc.sh (LIBPATH_SUFFIX): Set instead of suffix. + +--- ld/emulparams/elf64_s390.sh.jj 2003-01-08 10:02:43.000000000 -0500 ++++ ld/emulparams/elf64_s390.sh 2003-02-06 09:37:12.000000000 -0500 +@@ -26,7 +26,7 @@ case "$target" in + s390*-linux*) + case "$EMULATION_NAME" in + *64*) +- LIBPATH_SUFFIX=$suffix ;; ++ LIBPATH_SUFFIX=64 ;; + esac + ;; + esac +--- ld/emulparams/elf_x86_64.sh.jj 2003-01-08 10:02:44.000000000 -0500 ++++ ld/emulparams/elf_x86_64.sh 2003-02-06 09:37:38.000000000 -0500 +@@ -24,7 +24,7 @@ fi + case "$target" in + x86_64*-linux*) + case "$EMULATION_NAME" in +- *64*) LIBPATH_SUFFIX=$suffix ;; ++ *64*) LIBPATH_SUFFIX=64 ;; + esac + ;; + esac +--- ld/emulparams/elf64_sparc.sh.jj 2003-01-08 10:02:44.000000000 -0500 ++++ ld/emulparams/elf64_sparc.sh 2003-02-06 09:39:50.000000000 -0500 +@@ -42,9 +42,9 @@ case "$EMULATION_NAME" in + *64*) + case "$target" in + sparc*-linux*) +- suffix=64 ;; ++ LIBPATH_SUFFIX=64 ;; + sparc*-solaris*) +- suffix=/sparcv9 ;; ++ LIBPATH_SUFFIX=/sparcv9 ;; + esac + ;; + esac + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ltconfig-multilib.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ltconfig-multilib.patch new file mode 100644 index 000000000000..26dfb8492c3c --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ltconfig-multilib.patch @@ -0,0 +1,26 @@ +--- ltconfig.jj 2003-02-03 16:56:49.000000000 +0900 ++++ ltconfig 2003-02-03 16:56:49.000000000 +0900 +@@ -1237,6 +1237,23 @@ + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' ++ ++ # Find out which ABI we are using (multilib hack). ++ case "$host_cpu" in ++ x86_64*|s390*|sparc*|ppc*|powerpc*) ++ echo "$progname:@lineno@: checking multilib ABI type" 1>&5 ++ touch conftest.$ac_ext ++ if { (eval echo $progname: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then ++ case `/usr/bin/file conftest.o` in ++ *64-bit*) ++ sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" ++ sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" ++ ;; ++ esac ++ fi ++ rm -rf conftest* ++ ;; ++ esac + ;; + + netbsd*) diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ppc64-tls1.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ppc64-tls1.patch new file mode 100644 index 000000000000..d3b6e0a2879e --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ppc64-tls1.patch @@ -0,0 +1,1796 @@ +2003-02-09 Alan Modra <amodra@bigpond.net.au> + +bfd/ChangeLog + * elf64-ppc.c (TLS_GD_LD): Don't define.. + (TLS_GD): ..define this instead and update all uses. + (TLS_TPRELGD): Define. + (ppc64_elf_link_hash_table_create): Tweak initialization of + init_refcount and init_offset. + (ppc64_elf_check_relocs): Add one extra element to t_symndx array. + Mark second slot of GD or LD toc entries. + (get_tls_type): Return an int. Distinguish toc GD and LD entries + from other tls types. + (ppc64_elf_tls_setup): New function, split out from.. + (ppc64_elf_tls_optimize): ..here. Don't optimize when symbols are + defined in a dynamic object. Fix LD optimization. Don't set TLS_TPREL + on GD->IE optimization, use TLS_TPRELGD instead. Use get_tls_type + return value to properly decide whether toc GD and LD entries can + optimize away __tls_get_addr call. Check next reloc after DTPMOD64 + to determine GD or LD rather than looking at TLS_LD flag. Don't + attempt to adjust got entry tls_type here.. + (allocate_dynrelocs): ..instead, adjust got entry tls_type here, and + look for possible merges. + (ppc64_elf_size_dynamic_sections): Adjust local got entries for + optimization. + (ppc64_elf_size_stubs): Tweak __tls_get_addr fudge. + (ppc64_elf_relocate_section): Rename some vars to better reflect usage. + Make use of return value from get_tls_type to properly detect GD and + LD optimizations. Split tlsld/gd hi/ha from lo/ds case. Don't + handle tls_get_addr removal when looking at REL24 relocs, do it when + looking at the previous reloc. Check reloc after DTPMOD64 to determine + GD or LD. + * elf64-ppc.h (ppc64_elf_tls_setup): Declare. + +ld/ChangeLog + * emultempl/ppc64elf.em: Add "no-tls-optimize" option and support code. + +ld/testsuite/ChangeLog + * ld-powerpc/tlslib.s: Give .__tls_get_addr function type. + * ld-powerpc/tlsexe.d: Update for changed handling of (invalid) ld var + in dynamic lib. + * ld-powerpc/tlsexe.g: Likewise. + * ld-powerpc/tlsexe.r: Likewise. + * ld-powerpc/tlsexe.t: Likewise. + * ld-powerpc/tlsexetoc.d: Likewise. + * ld-powerpc/tlsexetoc.g: Likewise. + * ld-powerpc/tlsexetoc.r: Likewise. + * ld-powerpc/tlsexetoc.t: Likewise. + +--- bfd/elf64-ppc.c 5 Feb 2003 15:49:04 -0000 1.81 ++++ bfd/elf64-ppc.c 9 Feb 2003 04:34:05 -0000 +@@ -2635,11 +2635,12 @@ struct ppc_link_hash_entry + /* Contexts in which symbol is used in the GOT (or TOC). + Linker optimization will result in various transformations. */ + #define TLS_TLS 1 /* Any TLS reloc. */ +-#define TLS_GD_LD 2 /* GD or LD reloc requiring 2 got slots. */ ++#define TLS_GD 2 /* GD reloc. */ + #define TLS_LD 4 /* LD reloc. */ + #define TLS_TPREL 8 /* TPREL reloc, => IE. */ + #define TLS_DTPREL 16 /* DTPREL reloc, => LD. */ + #define TLS_EXPLICIT 32 /* Marks TOC section relocs. */ ++#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */ + char tls_type; + }; + +@@ -2767,7 +2768,7 @@ static void ppc64_elf_hide_symbol + static bfd_boolean get_sym_h + PARAMS ((struct elf_link_hash_entry **, Elf_Internal_Sym **, asection **, + char **, Elf_Internal_Sym **, unsigned long, bfd *)); +-static bfd_boolean get_tls_type ++static int get_tls_type + PARAMS ((char **, Elf_Internal_Sym **, const Elf_Internal_Rela *, bfd *)); + static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +@@ -2963,7 +2964,13 @@ ppc64_elf_link_hash_table_create (abfd) + htab->have_undefweak = 0; + htab->stub_iteration = 0; + htab->sym_sec.abfd = NULL; ++ /* Initializing two fields of the union is just cosmetic. We really ++ only care about glist, but when compiled on a 32-bit host the ++ bfd_vma fields are larger. Setting the bfd_vma to zero makes ++ debugger inspection of these fields look nicer. */ ++ htab->elf.init_refcount.refcount = 0; + htab->elf.init_refcount.glist = NULL; ++ htab->elf.init_offset.offset = 0; + htab->elf.init_offset.glist = NULL; + + return &htab->elf.root; +@@ -3556,14 +3563,14 @@ ppc64_elf_check_relocs (abfd, info, sec, + case R_PPC64_GOT_TLSLD16_HI: + case R_PPC64_GOT_TLSLD16_HA: + htab->tlsld_got.refcount += 1; +- tls_type = TLS_TLS | TLS_GD_LD | TLS_LD; ++ tls_type = TLS_TLS | TLS_LD; + goto dogottls; + + case R_PPC64_GOT_TLSGD16: + case R_PPC64_GOT_TLSGD16_LO: + case R_PPC64_GOT_TLSGD16_HI: + case R_PPC64_GOT_TLSGD16_HA: +- tls_type = TLS_TLS | TLS_GD_LD; ++ tls_type = TLS_TLS | TLS_GD; + goto dogottls; + + case R_PPC64_GOT_TPREL16_DS: +@@ -3727,9 +3734,9 @@ ppc64_elf_check_relocs (abfd, info, sec, + if (rel + 1 < rel_end + && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64) + && rel[1].r_offset == rel->r_offset + 8) +- tls_type = TLS_EXPLICIT | TLS_TLS | TLS_GD_LD; ++ tls_type = TLS_EXPLICIT | TLS_TLS | TLS_GD; + else +- tls_type = TLS_EXPLICIT | TLS_TLS | TLS_GD_LD | TLS_LD; ++ tls_type = TLS_EXPLICIT | TLS_TLS | TLS_LD; + goto dotlstoc; + + case R_PPC64_DTPREL64: +@@ -3756,7 +3763,8 @@ ppc64_elf_check_relocs (abfd, info, sec, + + if (ppc64_elf_section_data (sec)->t_symndx == NULL) + { +- bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8; ++ /* One extra to simplify get_tls_type. */ ++ bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1; + ppc64_elf_section_data (sec)->t_symndx + = (unsigned *) bfd_zalloc (abfd, amt); + if (ppc64_elf_section_data (sec)->t_symndx == NULL) +@@ -3764,6 +3772,13 @@ ppc64_elf_check_relocs (abfd, info, sec, + } + BFD_ASSERT (rel->r_offset % 8 == 0); + ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8] = r_symndx; ++ ++ /* Mark the second slot of a GD or LD entry. ++ -1 to indicate GD and -2 to indicate LD. */ ++ if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_GD)) ++ ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -1; ++ else if (tls_type == (TLS_EXPLICIT | TLS_TLS | TLS_LD)) ++ ppc64_elf_section_data (sec)->t_symndx[rel->r_offset / 8 + 1] = -2; + goto dodyn; + + case R_PPC64_TPREL16: +@@ -4090,14 +4105,14 @@ ppc64_elf_gc_sweep_hook (abfd, info, sec + case R_PPC64_GOT_TLSLD16_HI: + case R_PPC64_GOT_TLSLD16_HA: + htab->tlsld_got.refcount -= 1; +- tls_type = TLS_TLS | TLS_GD_LD | TLS_LD; ++ tls_type = TLS_TLS | TLS_LD; + goto dogot; + + case R_PPC64_GOT_TLSGD16: + case R_PPC64_GOT_TLSGD16_LO: + case R_PPC64_GOT_TLSGD16_HI: + case R_PPC64_GOT_TLSGD16_HA: +- tls_type = TLS_TLS | TLS_GD_LD; ++ tls_type = TLS_TLS | TLS_GD; + goto dogot; + + case R_PPC64_GOT_TPREL16_DS: +@@ -4768,7 +4783,11 @@ get_sym_h (hp, symp, symsecp, tlstypep, + return TRUE; + } + +-static bfd_boolean ++/* Returns TLS_TYPE for the given REL symbol. Function return is 0 on ++ error, 2 on a toc GD type suitable for optimization, 3 on a toc LD ++ type suitable for optimization, and 1 otherwise. */ ++ ++static int + get_tls_type (tls_type, locsymsp, rel, ibfd) + char **tls_type; + Elf_Internal_Sym **locsymsp; +@@ -4776,6 +4795,7 @@ get_tls_type (tls_type, locsymsp, rel, i + bfd *ibfd; + { + unsigned long r_symndx; ++ unsigned int next_r; + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; +@@ -4783,12 +4803,12 @@ get_tls_type (tls_type, locsymsp, rel, i + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sec, tls_type, locsymsp, r_symndx, ibfd)) +- return FALSE; ++ return 0; + + if ((*tls_type != NULL && **tls_type != 0) + || sec == NULL + || ppc64_elf_section_data (sec)->t_symndx == NULL) +- return TRUE; ++ return 1; + + /* Look inside a TOC section too. */ + if (h != NULL) +@@ -4801,7 +4821,21 @@ get_tls_type (tls_type, locsymsp, rel, i + off += rel->r_addend; + BFD_ASSERT (off % 8 == 0); + r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8]; +- return get_sym_h (&h, &sym, NULL, tls_type, locsymsp, r_symndx, ibfd); ++ next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1]; ++ if (!get_sym_h (&h, &sym, &sec, tls_type, locsymsp, r_symndx, ibfd)) ++ return 0; ++ if (h == NULL ++ || h->root.type == bfd_link_hash_defined ++ || h->root.type == bfd_link_hash_defweak) ++ { ++ if (next_r == (unsigned) -1) ++ return 2; ++ if (next_r == (unsigned) -2 ++ && (h == NULL ++ || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC))) ++ return 3; ++ } ++ return 1; + } + + bfd_boolean +@@ -5110,39 +5144,46 @@ ppc64_elf_edit_opd (obfd, info) + return TRUE; + } + +-/* Run through all the TLS relocs looking for optimization +- opportunities. The linker has been hacked (see ppc64elf.em) to do +- a preliminary section layout so that we know the TLS segment +- offsets. We can't optimize earlier because some optimizations need +- to know the tp offset, and we need to optimize before allocating +- dynamic relocations. */ ++/* Set htab->tls_sec. */ + + bfd_boolean +-ppc64_elf_tls_optimize (obfd, info) ++ppc64_elf_tls_setup (obfd, info) + bfd *obfd; + struct bfd_link_info *info; + { + asection *tls; +- bfd *ibfd; +- asection *sec; + struct ppc_link_hash_table *htab; + +- if (info->relocateable) +- return TRUE; +- + for (tls = obfd->sections; tls != NULL; tls = tls->next) + if ((tls->flags & (SEC_THREAD_LOCAL | SEC_LOAD)) + == (SEC_THREAD_LOCAL | SEC_LOAD)) + break; +- if (tls == NULL) +- return TRUE; + + htab = ppc_hash_table (info); + htab->tls_sec = tls; ++ return tls != NULL; ++} + +- if (info->shared) ++/* Run through all the TLS relocs looking for optimization ++ opportunities. The linker has been hacked (see ppc64elf.em) to do ++ a preliminary section layout so that we know the TLS segment ++ offsets. We can't optimize earlier because some optimizations need ++ to know the tp offset, and we need to optimize before allocating ++ dynamic relocations. */ ++ ++bfd_boolean ++ppc64_elf_tls_optimize (obfd, info) ++ bfd *obfd ATTRIBUTE_UNUSED; ++ struct bfd_link_info *info; ++{ ++ bfd *ibfd; ++ asection *sec; ++ struct ppc_link_hash_table *htab; ++ ++ if (info->relocateable || info->shared) + return TRUE; + ++ htab = ppc_hash_table (info); + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) + { + Elf_Internal_Sym *locsyms = NULL; +@@ -5172,7 +5213,7 @@ ppc64_elf_tls_optimize (obfd, info) + char *tls_type; + char tls_set, tls_clear, got_tls_type = 0; + bfd_vma value; +- bfd_boolean ok_tprel; ++ bfd_boolean ok_tprel, is_local; + + r_symndx = ELF64_R_SYM (rel->r_info); + if (!get_sym_h (&h, &sym, &sym_sec, &tls_type, &locsyms, +@@ -5197,9 +5238,13 @@ ppc64_elf_tls_optimize (obfd, info) + } + else + value = sym->st_value; ++ + ok_tprel = FALSE; +- if (sym_sec != NULL && sym_sec->output_section != NULL) ++ is_local = FALSE; ++ if (h == NULL ++ || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)) + { ++ is_local = TRUE; + value += sym_sec->output_offset; + value += sym_sec->output_section->vma; + value -= htab->tls_sec->vma; +@@ -5215,16 +5260,17 @@ ppc64_elf_tls_optimize (obfd, info) + case R_PPC64_GOT_TLSLD16_LO: + case R_PPC64_GOT_TLSLD16_HI: + case R_PPC64_GOT_TLSLD16_HA: ++ /* These relocs should never be against a symbol ++ defined in a shared lib. Leave them alone if ++ that turns out to be the case. */ ++ if (!is_local) ++ continue; ++ + htab->tlsld_got.refcount -= 1; +- if (ok_tprel) +- /* LD -> LE */ +- tls_set = 0; +- else +- /* We still need a GOT entry as the offset is +- too big. ie. LD -> IE. */ +- tls_set = TLS_TLS | TLS_TPREL; +- tls_clear = TLS_GD_LD; +- got_tls_type = TLS_TLS | TLS_GD_LD | TLS_LD; ++ /* LD -> LE */ ++ tls_set = 0; ++ tls_clear = TLS_LD; ++ got_tls_type = TLS_TLS | TLS_LD; + expecting_tls_get_addr = 1; + break; + +@@ -5232,21 +5278,14 @@ ppc64_elf_tls_optimize (obfd, info) + case R_PPC64_GOT_TLSGD16_LO: + case R_PPC64_GOT_TLSGD16_HI: + case R_PPC64_GOT_TLSGD16_HA: +- if (ok_tprel +- && (h == NULL +- || ((h->elf_link_hash_flags +- & ELF_LINK_HASH_DEF_REGULAR) != 0 +- && ((h->elf_link_hash_flags +- & ELF_LINK_FORCED_LOCAL) != 0 +- || !info->shared +- || info->symbolic)))) ++ if (ok_tprel) + /* GD -> LE */ + tls_set = 0; + else + /* GD -> IE */ +- tls_set = TLS_TLS | TLS_TPREL; +- tls_clear = TLS_GD_LD; +- got_tls_type = TLS_TLS | TLS_GD_LD; ++ tls_set = TLS_TLS | TLS_TPRELGD; ++ tls_clear = TLS_GD; ++ got_tls_type = TLS_TLS | TLS_GD; + expecting_tls_get_addr = 1; + break; + +@@ -5282,12 +5321,14 @@ ppc64_elf_tls_optimize (obfd, info) + { + /* Check for toc tls entries. */ + char *toc_tls; ++ int retval; + +- if (!get_tls_type (&toc_tls, &locsyms, +- rel - 1, ibfd)) ++ retval = get_tls_type (&toc_tls, &locsyms, ++ rel - 1, ibfd); ++ if (retval == 0) + goto err_free_rel; + if (toc_tls != NULL) +- expecting_tls_get_addr = *toc_tls != 0; ++ expecting_tls_get_addr = retval > 1; + } + + if (expecting_tls_get_addr) +@@ -5319,32 +5360,27 @@ ppc64_elf_tls_optimize (obfd, info) + + case R_PPC64_DTPMOD64: + expecting_tls_get_addr = 0; +- if ((*tls_type & TLS_LD) == 0) ++ if (rel + 1 < relend ++ && (rel[1].r_info ++ == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)) ++ && rel[1].r_offset == rel->r_offset + 8) + { +- if ((h == NULL +- || ((h->elf_link_hash_flags +- & ELF_LINK_HASH_DEF_REGULAR) != 0 +- && ((h->elf_link_hash_flags +- & ELF_LINK_FORCED_LOCAL) != 0 +- || !info->shared +- || info->symbolic))) +- && ok_tprel) ++ if (ok_tprel) + /* GD -> LE */ +- tls_set = TLS_EXPLICIT; ++ tls_set = TLS_EXPLICIT | TLS_GD; + else + /* GD -> IE */ +- tls_set = TLS_EXPLICIT | TLS_TPREL; +- tls_clear = TLS_GD_LD; ++ tls_set = TLS_EXPLICIT | TLS_GD | TLS_TPRELGD; ++ tls_clear = TLS_GD; + } + else + { +- if (ok_tprel) +- /* LD -> LE */ +- tls_set = TLS_EXPLICIT; +- else +- /* LD -> IE */ +- tls_set = TLS_EXPLICIT | TLS_TPREL; +- tls_clear = TLS_GD_LD; ++ if (!is_local) ++ continue; ++ ++ /* LD -> LE */ ++ tls_set = TLS_EXPLICIT; ++ tls_clear = TLS_LD; + } + break; + +@@ -5376,8 +5412,6 @@ ppc64_elf_tls_optimize (obfd, info) + if (ent->got.refcount > 0) + ent->got.refcount -= 1; + } +- else +- ent->tls_type = tls_set; + } + else if (h != NULL) + { +@@ -5395,14 +5429,9 @@ ppc64_elf_tls_optimize (obfd, info) + /* If we got rid of a DTPMOD/DTPREL reloc + pair then we'll lose one or two dyn + relocs. */ +- if (tls_clear == TLS_GD_LD +- && rel + 1 < relend +- && (rel[1].r_info +- == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64)) +- && rel[1].r_offset == rel->r_offset + 8) +- p->count -= 1; +- if (tls_set == TLS_EXPLICIT) ++ if (tls_set == (TLS_EXPLICIT | TLS_GD)) + p->count -= 1; ++ p->count -= 1; + if (p->count == 0) + *pp = p->next; + break; +@@ -5515,11 +5544,39 @@ allocate_dynrelocs (h, inf) + h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; + } + ++ eh = (struct ppc_link_hash_entry *) h; ++ /* Run through the TLS GD got entries first if we're changing them ++ to TPREL. */ ++ if ((eh->tls_type & TLS_TPRELGD) != 0) ++ for (gent = h->got.glist; gent != NULL; gent = gent->next) ++ if (gent->got.refcount > 0 ++ && (gent->tls_type & TLS_GD) != 0) ++ { ++ /* This was a GD entry that has been converted to TPREL. If ++ there happens to be a TPREL entry we can use that one. */ ++ struct got_entry *ent; ++ for (ent = h->got.glist; ent != NULL; ent = ent->next) ++ if (ent->got.refcount > 0 ++ && (ent->tls_type & TLS_TPREL) != 0 ++ && ent->addend == gent->addend) ++ { ++ gent->got.refcount = 0; ++ break; ++ } ++ ++ /* If not, then we'll be using our own TPREL entry. */ ++ if (gent->got.refcount != 0) ++ gent->tls_type = TLS_TLS | TLS_TPREL; ++ } ++ + for (gent = h->got.glist; gent != NULL; gent = gent->next) + if (gent->got.refcount > 0) + { ++ bfd_boolean dyn; ++ + /* Make sure this symbol is output as a dynamic symbol. +- Undefined weak syms won't yet be marked as dynamic. */ ++ Undefined weak syms won't yet be marked as dynamic, ++ nor will all TLS symbols. */ + if (h->dynindx == -1 + && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) + { +@@ -5528,26 +5585,24 @@ allocate_dynrelocs (h, inf) + } + + if ((gent->tls_type & TLS_LD) != 0) +- gent->got.offset = htab->tlsld_got.offset; +- else + { +- bfd_boolean dyn; +- +- s = htab->sgot; +- gent->got.offset = s->_raw_size; +- s->_raw_size += (gent->tls_type & TLS_GD_LD) != 0 ? 16 : 8; +- dyn = htab->elf.dynamic_sections_created; +- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) +- htab->srelgot->_raw_size +- += ((gent->tls_type & TLS_GD_LD) != 0 +- ? 2 * sizeof (Elf64_External_Rela) +- : sizeof (Elf64_External_Rela)); ++ gent->got.offset = htab->tlsld_got.offset; ++ continue; + } ++ ++ s = htab->sgot; ++ gent->got.offset = s->_raw_size; ++ s->_raw_size += (gent->tls_type & eh->tls_type & TLS_GD) ? 16 : 8; ++ dyn = htab->elf.dynamic_sections_created; ++ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) ++ htab->srelgot->_raw_size ++ += (gent->tls_type & eh->tls_type & TLS_GD ++ ? 2 * sizeof (Elf64_External_Rela) ++ : sizeof (Elf64_External_Rela)); + } + else + gent->got.offset = (bfd_vma) -1; + +- eh = (struct ppc_link_hash_entry *) h; + if (eh->dyn_relocs == NULL) + return TRUE; + +@@ -5697,6 +5752,7 @@ ppc64_elf_size_dynamic_sections (output_ + { + struct got_entry **lgot_ents; + struct got_entry **end_lgot_ents; ++ char *lgot_types; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; +@@ -5738,16 +5794,17 @@ ppc64_elf_size_dynamic_sections (output_ + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_lgot_ents = lgot_ents + locsymcount; ++ lgot_types = (char *) end_lgot_ents; + s = htab->sgot; + srel = htab->srelgot; +- for (; lgot_ents < end_lgot_ents; ++lgot_ents) ++ for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_types) + { + struct got_entry *ent; + + for (ent = *lgot_ents; ent != NULL; ent = ent->next) + if (ent->got.refcount > 0) + { +- if ((ent->tls_type & TLS_LD) != 0) ++ if ((ent->tls_type & *lgot_types & TLS_LD) != 0) + { + if (htab->tlsld_got.offset == (bfd_vma) -1) + { +@@ -5761,7 +5818,7 @@ ppc64_elf_size_dynamic_sections (output_ + else + { + ent->got.offset = s->_raw_size; +- if ((ent->tls_type & TLS_GD_LD) != 0) ++ if ((ent->tls_type & *lgot_types & TLS_GD) != 0) + { + s->_raw_size += 16; + if (info->shared) +@@ -6608,8 +6665,7 @@ ppc64_elf_size_stubs (output_bfd, stub_b + if (!get_tls_type (&tls_type, &local_syms, + irela - 1, input_bfd)) + goto error_ret_free_internal; +- if (tls_type != NULL +- && (*tls_type & (TLS_TLS | TLS_GD_LD)) == TLS_TLS) ++ if (*tls_type != 0) + continue; + } + +@@ -6902,7 +6958,6 @@ ppc64_elf_relocate_section (output_bfd, + Elf_Internal_Rela *relend; + Elf_Internal_Rela outrel; + bfd_byte *loc; +- unsigned int tls_get_addr_type; + struct got_entry **local_got_ents; + bfd_vma TOCstart; + bfd_boolean ret = TRUE; +@@ -6938,7 +6993,6 @@ ppc64_elf_relocate_section (output_bfd, + sym_hashes = elf_sym_hashes (input_bfd); + is_opd = ppc64_elf_section_data (input_section)->opd.adjust != NULL; + +- tls_get_addr_type = 0; + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) +@@ -6952,7 +7006,7 @@ ppc64_elf_relocate_section (output_bfd, + struct elf_link_hash_entry *fdh; + const char *sym_name; + unsigned long r_symndx; +- char tls_type; ++ char tls_mask, tls_gd, tls_type; + bfd_vma relocation; + bfd_boolean unresolved_reloc; + bfd_boolean warned; +@@ -7035,17 +7089,21 @@ ppc64_elf_relocate_section (output_bfd, + } + } + +- /* TLS optimizations. */ +- tls_type = 0; ++ /* TLS optimizations. Replace instruction sequences and relocs ++ based on information we collected in tls_optimize. We edit ++ RELOCS so that --emit-relocs will output something sensible ++ for the final instruction stream. */ ++ tls_mask = 0; ++ tls_gd = 0; + if (IS_TLS_RELOC (r_type)) + { + if (h != NULL) +- tls_type = ((struct ppc_link_hash_entry *) h)->tls_type; ++ tls_mask = ((struct ppc_link_hash_entry *) h)->tls_type; + else if (local_got_ents != NULL) + { + char *lgot_types; + lgot_types = (char *) (local_got_ents + symtab_hdr->sh_info); +- tls_type = lgot_types[r_symndx]; ++ tls_mask = lgot_types[r_symndx]; + } + } + +@@ -7064,39 +7122,52 @@ ppc64_elf_relocate_section (output_bfd, + switch (r_type) + { + default: +- tls_get_addr_type = 0; + break; + + case R_PPC64_TOC16: + case R_PPC64_TOC16_LO: + case R_PPC64_TOC16_DS: + case R_PPC64_TOC16_LO_DS: +- tls_get_addr_type = 0; + { + /* Check for toc tls entries. */ + char *toc_tls; ++ int retval; + +- if (!get_tls_type (&toc_tls, &local_syms, rel, input_bfd)) ++ retval = get_tls_type (&toc_tls, &local_syms, rel, input_bfd); ++ if (retval == 0) + return FALSE; + + if (toc_tls) + { +- tls_type = *toc_tls; ++ tls_mask = *toc_tls; + if (r_type == R_PPC64_TOC16_DS + || r_type == R_PPC64_TOC16_LO_DS) + goto toctprel; + else +- tls_get_addr_type = tls_type; ++ { ++ /* If we found a GD reloc pair, then we might be ++ doing a GD->IE transition. */ ++ if (retval == 2) ++ { ++ tls_gd = TLS_TPRELGD; ++ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0) ++ goto tls_get_addr_check; ++ } ++ else if (retval == 3) ++ { ++ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0) ++ goto tls_get_addr_check; ++ } ++ } + } + } + break; + + case R_PPC64_GOT_TPREL16_DS: + case R_PPC64_GOT_TPREL16_LO_DS: +- tls_get_addr_type = 0; + toctprel: +- if (tls_type != 0 +- && (tls_type & TLS_TPREL) == 0) ++ if (tls_mask != 0 ++ && (tls_mask & TLS_TPREL) == 0) + { + bfd_vma insn; + insn = bfd_get_32 (output_bfd, contents + rel->r_offset - 2); +@@ -7109,8 +7180,7 @@ ppc64_elf_relocate_section (output_bfd, + break; + + case R_PPC64_TLS: +- tls_get_addr_type = 0; +- if (tls_type == 0) ++ if (tls_mask == 0) + { + /* Check for toc tls entries. */ + char *toc_tls; +@@ -7119,10 +7189,10 @@ ppc64_elf_relocate_section (output_bfd, + return FALSE; + + if (toc_tls) +- tls_type = *toc_tls; ++ tls_mask = *toc_tls; + } +- if (tls_type != 0 +- && (tls_type & TLS_TPREL) == 0) ++ if (tls_mask != 0 ++ && (tls_mask & TLS_TPREL) == 0) + { + bfd_vma insn, rtra; + insn = bfd_get_32 (output_bfd, contents + rel->r_offset); +@@ -7164,130 +7234,162 @@ ppc64_elf_relocate_section (output_bfd, + } + break; + +- case R_PPC64_GOT_TLSGD16: +- case R_PPC64_GOT_TLSGD16_LO: + case R_PPC64_GOT_TLSGD16_HI: + case R_PPC64_GOT_TLSGD16_HA: +- case R_PPC64_GOT_TLSLD16: +- case R_PPC64_GOT_TLSLD16_LO: ++ tls_gd = TLS_TPRELGD; ++ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0) ++ goto tls_gdld_hi; ++ break; ++ + case R_PPC64_GOT_TLSLD16_HI: + case R_PPC64_GOT_TLSLD16_HA: +- tls_get_addr_type = 0; +- if (tls_type != 0 && (tls_type & TLS_GD_LD) == 0) ++ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0) + { +- if (r_type == R_PPC64_GOT_TLSGD16_HI +- || r_type == R_PPC64_GOT_TLSGD16_HA +- || r_type == R_PPC64_GOT_TLSLD16_HI +- || r_type == R_PPC64_GOT_TLSLD16_HA) ++ tls_gdld_hi: ++ if ((tls_mask & tls_gd) != 0) ++ r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3) ++ + R_PPC64_GOT_TPREL16_DS); ++ else + { +- if ((tls_type & TLS_LD) != 0) +- { +- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); +- r_type = R_PPC64_NONE; +- rel->r_offset -= 2; +- } +- else +- r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3) +- + R_PPC64_GOT_TPREL16_DS); +- rel->r_info = ELF64_R_INFO (r_symndx, r_type); +- break; ++ bfd_put_32 (output_bfd, NOP, contents + rel->r_offset); ++ rel->r_offset -= 2; ++ r_type = R_PPC64_NONE; + } +- +- /* This reloc and its instruction will be replaced so there's +- not much point in doing anything more here. We know the +- next reloc will be a REL24 to __tls_get_addr, and will +- be handled below. */ +- tls_get_addr_type = tls_type; +- continue; ++ rel->r_info = ELF64_R_INFO (r_symndx, r_type); + } + break; + +- case R_PPC64_REL14: +- case R_PPC64_REL14_BRTAKEN: +- case R_PPC64_REL14_BRNTAKEN: +- case R_PPC64_REL24: +- if (h != NULL +- && h == htab->tls_get_addr +- && tls_get_addr_type != 0 +- && (tls_get_addr_type & TLS_GD_LD) == 0) +- { +- /* Replace the call. */ +- bfd_vma insn1, insn2, insn3; +- bfd_vma offset = rel->r_offset; +- +- insn1 = bfd_get_32 (output_bfd, contents + rel[-1].r_offset - 2); +- insn3 = bfd_get_32 (output_bfd, contents + offset + 4); +- if (tls_get_addr_type & TLS_TPREL) +- { +- /* IE */ +- insn1 &= (1 << 26) - (1 << 2); +- insn1 |= 58 << 26; /* ld */ +- insn2 = 0x7c636a14; /* add 3,3,13 */ +- /* Fix the relocs for --emit-relocs. */ +- r_type = ELF64_R_TYPE (rel[-1].r_info); +- if (tls_get_addr_type & TLS_EXPLICIT) +- r_type += R_PPC64_TOC16_DS - R_PPC64_TOC16; +- else +- r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3) +- + R_PPC64_GOT_TPREL16_DS); +- rel[-1].r_info +- = ELF64_R_INFO (ELF64_R_SYM (rel[-1].r_info), r_type); +- rel->r_info = 0; +- } +- else ++ case R_PPC64_GOT_TLSGD16: ++ case R_PPC64_GOT_TLSGD16_LO: ++ tls_gd = TLS_TPRELGD; ++ if (tls_mask != 0 && (tls_mask & TLS_GD) == 0) ++ goto tls_get_addr_check; ++ break; ++ ++ case R_PPC64_GOT_TLSLD16: ++ case R_PPC64_GOT_TLSLD16_LO: ++ if (tls_mask != 0 && (tls_mask & TLS_LD) == 0) ++ { ++ tls_get_addr_check: ++ if (rel + 1 < relend) + { +- /* LE */ +- insn1 = 0x3c6d0000; /* addis 3,13,0 */ +- insn2 = 0x38630000; /* addi 3,3,0 */ +- if (tls_get_addr_type & TLS_LD) ++ enum elf_ppc64_reloc_type r_type2; ++ unsigned long r_symndx2; ++ struct elf_link_hash_entry *h2; ++ bfd_vma insn1, insn2, insn3; ++ bfd_vma offset; ++ ++ /* The next instruction should be a call to ++ __tls_get_addr. Peek at the reloc to be sure. */ ++ r_type2 ++ = (enum elf_ppc64_reloc_type) ELF64_R_TYPE (rel[1].r_info); ++ r_symndx2 = ELF64_R_SYM (rel[1].r_info); ++ if (r_symndx2 < symtab_hdr->sh_info ++ || (r_type2 != R_PPC64_REL14 ++ && r_type2 != R_PPC64_REL14_BRTAKEN ++ && r_type2 != R_PPC64_REL14_BRNTAKEN ++ && r_type2 != R_PPC64_REL24)) ++ break; ++ ++ h2 = sym_hashes[r_symndx2 - symtab_hdr->sh_info]; ++ while (h2->root.type == bfd_link_hash_indirect ++ || h2->root.type == bfd_link_hash_warning) ++ h2 = (struct elf_link_hash_entry *) h2->root.u.i.link; ++ if (h2 == NULL || h2 != htab->tls_get_addr) ++ break; ++ ++ /* OK, it checks out. Replace the call. */ ++ offset = rel[1].r_offset; ++ insn1 = bfd_get_32 (output_bfd, ++ contents + rel->r_offset - 2); ++ insn3 = bfd_get_32 (output_bfd, ++ contents + offset + 4); ++ if ((tls_mask & tls_gd) != 0) + { +- r_symndx = 0; +- rel[-1].r_addend = htab->tls_sec->vma + DTP_OFFSET; +- rel->r_addend = htab->tls_sec->vma + DTP_OFFSET; ++ /* IE */ ++ insn1 &= (1 << 26) - (1 << 2); ++ insn1 |= 58 << 26; /* ld */ ++ insn2 = 0x7c636a14; /* add 3,3,13 */ ++ rel[1].r_info = ELF64_R_INFO (r_symndx2, R_PPC64_NONE); ++ if ((tls_mask & TLS_EXPLICIT) == 0) ++ r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3) ++ + R_PPC64_GOT_TPREL16_DS); ++ else ++ r_type += R_PPC64_TOC16_DS - R_PPC64_TOC16; ++ rel->r_info = ELF64_R_INFO (r_symndx, r_type); + } + else +- r_symndx = ELF64_R_SYM (rel[-1].r_info); +- rel[-1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_TPREL16_HA); +- rel->r_info = ELF64_R_INFO (r_symndx, R_PPC64_TPREL16_LO); +- rel->r_offset += 2; +- } +- if (insn3 == NOP +- || insn3 == CROR_151515 || insn3 == CROR_313131) +- { +- insn3 = insn2; +- insn2 = NOP; +- rel->r_offset += 4; ++ { ++ /* LE */ ++ insn1 = 0x3c6d0000; /* addis 3,13,0 */ ++ insn2 = 0x38630000; /* addi 3,3,0 */ ++ if (tls_gd == 0) ++ { ++ /* Was an LD reloc. */ ++ r_symndx = 0; ++ rel->r_addend = htab->tls_sec->vma + DTP_OFFSET; ++ rel[1].r_addend = htab->tls_sec->vma + DTP_OFFSET; ++ } ++ r_type = R_PPC64_TPREL16_HA; ++ rel->r_info = ELF64_R_INFO (r_symndx, r_type); ++ rel[1].r_info = ELF64_R_INFO (r_symndx, ++ R_PPC64_TPREL16_LO); ++ rel[1].r_offset += 2; ++ } ++ if (insn3 == NOP ++ || insn3 == CROR_151515 || insn3 == CROR_313131) ++ { ++ insn3 = insn2; ++ insn2 = NOP; ++ rel[1].r_offset += 4; ++ } ++ bfd_put_32 (output_bfd, insn1, contents + rel->r_offset - 2); ++ bfd_put_32 (output_bfd, insn2, contents + offset); ++ bfd_put_32 (output_bfd, insn3, contents + offset + 4); ++ if (tls_gd == 0) ++ { ++ /* We changed the symbol on an LD reloc. Start over ++ in order to get h, sym, sec etc. right. */ ++ rel--; ++ continue; ++ } + } +- bfd_put_32 (output_bfd, insn1, contents + rel[-1].r_offset - 2); +- bfd_put_32 (output_bfd, insn2, contents + offset); +- bfd_put_32 (output_bfd, insn3, contents + offset + 4); +- /* Do the relocs again. */ +- rel -= 2; +- tls_get_addr_type = 0; +- continue; + } +- tls_get_addr_type = 0; + break; + + case R_PPC64_DTPMOD64: +- if ((tls_type & TLS_GD_LD) == 0) ++ if (rel + 1 < relend ++ && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_DTPREL64) ++ && rel[1].r_offset == rel->r_offset + 8) + { +- if ((tls_type & TLS_TPREL) != 0) +- r_type = R_PPC64_TPREL64; +- else ++ if ((tls_mask & TLS_GD) == 0) ++ { ++ rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_NONE); ++ if ((tls_mask & TLS_TPRELGD) != 0) ++ r_type = R_PPC64_TPREL64; ++ else ++ { ++ bfd_put_64 (output_bfd, (bfd_vma) 1, ++ contents + rel->r_offset); ++ r_type = R_PPC64_NONE; ++ } ++ rel->r_info = ELF64_R_INFO (r_symndx, r_type); ++ } ++ } ++ else ++ { ++ if ((tls_mask & TLS_LD) == 0) + { + bfd_put_64 (output_bfd, (bfd_vma) 1, + contents + rel->r_offset); + r_type = R_PPC64_NONE; ++ rel->r_info = ELF64_R_INFO (r_symndx, r_type); + } +- rel->r_info = ELF64_R_INFO (r_symndx, r_type); +- if ((tls_type & TLS_LD) == 0) +- rel[1].r_info = 0; + } + break; + + case R_PPC64_TPREL64: +- if ((tls_type & TLS_TPREL) == 0) ++ if ((tls_mask & TLS_TPREL) == 0) + { + r_type = R_PPC64_NONE; + rel->r_info = ELF64_R_INFO (r_symndx, r_type); +@@ -7437,14 +7539,14 @@ ppc64_elf_relocate_section (output_bfd, + case R_PPC64_GOT_TLSGD16_LO: + case R_PPC64_GOT_TLSGD16_HI: + case R_PPC64_GOT_TLSGD16_HA: +- tls_type = TLS_TLS | TLS_GD_LD; ++ tls_type = TLS_TLS | TLS_GD; + goto dogot; + + case R_PPC64_GOT_TLSLD16: + case R_PPC64_GOT_TLSLD16_LO: + case R_PPC64_GOT_TLSLD16_HI: + case R_PPC64_GOT_TLSLD16_HA: +- tls_type = TLS_TLS | TLS_GD_LD | TLS_LD; ++ tls_type = TLS_TLS | TLS_LD; + goto dogot; + + case R_PPC64_GOT_TPREL16_DS: +@@ -7530,12 +7632,12 @@ ppc64_elf_relocate_section (output_bfd, + the case of TLSLD where we'll use one entry per + module. */ + if ((info->shared || indx != 0) +- && ent->tls_type != (TLS_TLS | TLS_GD_LD | TLS_LD)) ++ && tls_type != (TLS_TLS | TLS_LD)) + { + outrel.r_offset = (htab->sgot->output_section->vma + + htab->sgot->output_offset + + off); +- if (ent->tls_type == (TLS_TLS | TLS_GD_LD)) ++ if (tls_type == (TLS_TLS | TLS_GD)) + { + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPMOD64); + outrel.r_addend = 0; +@@ -7546,15 +7648,15 @@ ppc64_elf_relocate_section (output_bfd, + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64); + outrel.r_offset += 8; + } +- else if (ent->tls_type == (TLS_TLS | TLS_DTPREL)) ++ else if (tls_type == (TLS_TLS | TLS_DTPREL)) + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_DTPREL64); +- else if (ent->tls_type == (TLS_TLS | TLS_TPREL)) ++ else if (tls_type == (TLS_TLS | TLS_TPREL)) + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_TPREL64); + else if (indx == 0) + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_RELATIVE); + else + outrel.r_info = ELF64_R_INFO (indx, R_PPC64_GLOB_DAT); +- outrel.r_addend = ent->addend; ++ outrel.r_addend = rel->r_addend; + if (indx == 0) + outrel.r_addend += relocation; + loc = htab->srelgot->contents; +@@ -7576,7 +7678,7 @@ ppc64_elf_relocate_section (output_bfd, + relocation += DTP_OFFSET - TP_OFFSET; + } + +- if ((tls_type & TLS_GD_LD) != 0) ++ if ((tls_type & (TLS_GD | TLS_LD)) != 0) + { + if ((tls_type & TLS_LD) != 0) + relocation = - DTP_OFFSET; +--- bfd/elf64-ppc.h 4 Feb 2003 14:50:50 -0000 1.7 ++++ bfd/elf64-ppc.h 9 Feb 2003 03:10:51 -0000 +@@ -21,6 +21,8 @@ bfd_boolean ppc64_elf_mark_entry_syms + PARAMS ((struct bfd_link_info *)); + bfd_boolean ppc64_elf_edit_opd + PARAMS ((bfd *, struct bfd_link_info *)); ++bfd_boolean ppc64_elf_tls_setup ++ PARAMS ((bfd *, struct bfd_link_info *)); + bfd_boolean ppc64_elf_tls_optimize + PARAMS ((bfd *, struct bfd_link_info *)); + bfd_vma ppc64_elf_toc +--- ld/emultempl/ppc64elf.em 4 Feb 2003 14:51:35 -0000 1.12 ++++ ld/emultempl/ppc64elf.em 9 Feb 2003 03:10:53 -0000 +@@ -41,6 +41,9 @@ static bfd_signed_vma group_size = 1; + /* Whether to add ".foo" entries for each "foo" in a version script. */ + static int dotsyms = 1; + ++/* Whether to run tls optimization. */ ++static int notlsopt = 0; ++ + static void ppc_create_output_section_statements + PARAMS ((void)); + static void ppc_after_open +@@ -101,20 +104,23 @@ ppc_before_allocation () + return; + } + +- /* Size the sections. This is premature, but we want to know the +- TLS segment layout so that certain optimizations can be done. */ +- lang_size_sections (stat_ptr->head, abs_output_section, +- &stat_ptr->head, 0, (bfd_vma) 0, NULL); +- +- if (!ppc64_elf_tls_optimize (output_bfd, &link_info)) ++ if (ppc64_elf_tls_setup (output_bfd, &link_info) && !notlsopt) + { +- einfo ("%X%P: TLS problem %E\n"); +- return; ++ /* Size the sections. This is premature, but we want to know the ++ TLS segment layout so that certain optimizations can be done. */ ++ lang_size_sections (stat_ptr->head, abs_output_section, ++ &stat_ptr->head, 0, (bfd_vma) 0, NULL); ++ ++ if (!ppc64_elf_tls_optimize (output_bfd, &link_info)) ++ { ++ einfo ("%X%P: TLS problem %E\n"); ++ return; ++ } ++ ++ lang_reset_memory_regions (); + } + + gld${EMULATION_NAME}_before_allocation (); +- +- lang_reset_memory_regions (); + } + + struct hook_stub_info +@@ -457,6 +463,7 @@ PARSE_AND_LIST_PROLOGUE=' + #define OPTION_STUBGROUP_SIZE 301 + #define OPTION_DOTSYMS (OPTION_STUBGROUP_SIZE + 1) + #define OPTION_NO_DOTSYMS (OPTION_DOTSYMS + 1) ++#define OPTION_NO_TLS_OPT (OPTION_NO_DOTSYMS + 1) + ' + + # The options are repeated below so that no abbreviations are allowed. +@@ -468,6 +475,8 @@ PARSE_AND_LIST_LONGOPTS=' + { "dotsyms", no_argument, NULL, OPTION_DOTSYMS }, + { "no-dotsyms", no_argument, NULL, OPTION_NO_DOTSYMS }, + { "no-dotsyms", no_argument, NULL, OPTION_NO_DOTSYMS }, ++ { "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT }, ++ { "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT }, + ' + + PARSE_AND_LIST_OPTIONS=' +@@ -489,6 +498,9 @@ PARSE_AND_LIST_OPTIONS=' + fprintf (file, _("\ + --no-dotsyms Don'\''t do anything special in version scripts.\n" + )); ++ fprintf (file, _("\ ++ --no-tls-optimize Don'\''t try to optimize TLS accesses.\n" ++ )); + ' + + PARSE_AND_LIST_ARGS_CASES=' +@@ -502,15 +514,15 @@ PARSE_AND_LIST_ARGS_CASES=' + break; + + case OPTION_DOTSYMS: +- { +- dotsyms = 1; +- } ++ dotsyms = 1; + break; + + case OPTION_NO_DOTSYMS: +- { +- dotsyms = 0; +- } ++ dotsyms = 0; ++ break; ++ ++ case OPTION_NO_TLS_OPT: ++ notlsopt = 1; + break; + ' + +--- ld/testsuite/ld-powerpc/tlsexe.d 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexe.d 9 Feb 2003 03:10:53 -0000 +@@ -8,42 +8,61 @@ + + Disassembly of section \.text: + +-0+10000378 <_start>: +- 10000378: e8 62 80 10 ld r3,-32752\(r2\) +- 1000037c: 60 00 00 00 nop +- 10000380: 7c 63 6a 14 add r3,r3,r13 +- 10000384: e8 62 80 18 ld r3,-32744\(r2\) +- 10000388: 60 00 00 00 nop +- 1000038c: 7c 63 6a 14 add r3,r3,r13 +- 10000390: 3c 6d 00 00 addis r3,r13,0 +- 10000394: 60 00 00 00 nop +- 10000398: 38 63 90 38 addi r3,r3,-28616 +- 1000039c: 3c 6d 00 00 addis r3,r13,0 +- 100003a0: 60 00 00 00 nop +- 100003a4: 38 63 10 00 addi r3,r3,4096 +- 100003a8: 39 23 80 40 addi r9,r3,-32704 +- 100003ac: 3d 23 00 00 addis r9,r3,0 +- 100003b0: 81 49 80 48 lwz r10,-32696\(r9\) +- 100003b4: e9 22 80 20 ld r9,-32736\(r2\) +- 100003b8: 7d 49 18 2a ldx r10,r9,r3 +- 100003bc: 3d 2d 00 00 addis r9,r13,0 +- 100003c0: a1 49 90 58 lhz r10,-28584\(r9\) +- 100003c4: 89 4d 90 60 lbz r10,-28576\(r13\) +- 100003c8: 3d 2d 00 00 addis r9,r13,0 +- 100003cc: 99 49 90 68 stb r10,-28568\(r9\) ++0+10000390 <_start-0x1c>: ++ 10000390: 3d 82 00 00 addis r12,r2,0 ++ 10000394: f8 41 00 28 std r2,40\(r1\) ++ 10000398: e9 6c 80 48 ld r11,-32696\(r12\) ++ 1000039c: e8 4c 80 50 ld r2,-32688\(r12\) ++ 100003a0: 7d 69 03 a6 mtctr r11 ++ 100003a4: e9 6c 80 58 ld r11,-32680\(r12\) ++ 100003a8: 4e 80 04 20 bctr ++ ++0+100003ac <_start>: ++ 100003ac: e8 62 80 20 ld r3,-32736\(r2\) ++ 100003b0: 60 00 00 00 nop ++ 100003b4: 7c 63 6a 14 add r3,r3,r13 ++ 100003b8: 38 62 80 08 addi r3,r2,-32760 ++ 100003bc: 4b ff ff d5 bl 10000390 <le1\+0x10000328> ++ 100003c0: e8 41 00 28 ld r2,40\(r1\) ++ 100003c4: 3c 6d 00 00 addis r3,r13,0 ++ 100003c8: 60 00 00 00 nop ++ 100003cc: 38 63 90 38 addi r3,r3,-28616 + 100003d0: 3c 6d 00 00 addis r3,r13,0 + 100003d4: 60 00 00 00 nop +- 100003d8: 38 63 90 00 addi r3,r3,-28672 +- 100003dc: 3c 6d 00 00 addis r3,r13,0 +- 100003e0: 60 00 00 00 nop +- 100003e4: 38 63 10 00 addi r3,r3,4096 +- 100003e8: f9 43 80 08 std r10,-32760\(r3\) +- 100003ec: 3d 23 00 00 addis r9,r3,0 +- 100003f0: 91 49 80 10 stw r10,-32752\(r9\) +- 100003f4: e9 22 80 08 ld r9,-32760\(r2\) +- 100003f8: 7d 49 19 2a stdx r10,r9,r3 ++ 100003d8: 38 63 10 00 addi r3,r3,4096 ++ 100003dc: 39 23 80 40 addi r9,r3,-32704 ++ 100003e0: 3d 23 00 00 addis r9,r3,0 ++ 100003e4: 81 49 80 48 lwz r10,-32696\(r9\) ++ 100003e8: e9 22 80 28 ld r9,-32728\(r2\) ++ 100003ec: 7d 49 18 2a ldx r10,r9,r3 ++ 100003f0: 3d 2d 00 00 addis r9,r13,0 ++ 100003f4: a1 49 90 58 lhz r10,-28584\(r9\) ++ 100003f8: 89 4d 90 60 lbz r10,-28576\(r13\) + 100003fc: 3d 2d 00 00 addis r9,r13,0 +- 10000400: b1 49 90 58 sth r10,-28584\(r9\) +- 10000404: e9 4d 90 2a lwa r10,-28632\(r13\) +- 10000408: 3d 2d 00 00 addis r9,r13,0 +- 1000040c: a9 49 90 30 lha r10,-28624\(r9\) ++ 10000400: 99 49 90 68 stb r10,-28568\(r9\) ++ 10000404: 3c 6d 00 00 addis r3,r13,0 ++ 10000408: 60 00 00 00 nop ++ 1000040c: 38 63 90 00 addi r3,r3,-28672 ++ 10000410: 3c 6d 00 00 addis r3,r13,0 ++ 10000414: 60 00 00 00 nop ++ 10000418: 38 63 10 00 addi r3,r3,4096 ++ 1000041c: f9 43 80 08 std r10,-32760\(r3\) ++ 10000420: 3d 23 00 00 addis r9,r3,0 ++ 10000424: 91 49 80 10 stw r10,-32752\(r9\) ++ 10000428: e9 22 80 18 ld r9,-32744\(r2\) ++ 1000042c: 7d 49 19 2a stdx r10,r9,r3 ++ 10000430: 3d 2d 00 00 addis r9,r13,0 ++ 10000434: b1 49 90 58 sth r10,-28584\(r9\) ++ 10000438: e9 4d 90 2a lwa r10,-28632\(r13\) ++ 1000043c: 3d 2d 00 00 addis r9,r13,0 ++ 10000440: a9 49 90 30 lha r10,-28624\(r9\) ++ 10000444: e8 41 00 28 ld r2,40\(r1\) ++ 10000448: 3d 82 00 00 addis r12,r2,0 ++ 1000044c: e9 6c 80 30 ld r11,-32720\(r12\) ++ 10000450: e8 4c 80 38 ld r2,-32712\(r12\) ++ 10000454: 7d 69 03 a6 mtctr r11 ++ 10000458: e9 6c 80 40 ld r11,-32704\(r12\) ++ 1000045c: 4e 80 04 20 bctr ++ 10000460: 60 00 00 00 nop ++ 10000464: 38 00 00 00 li r0,0 ++ 10000468: 4b ff ff dc b 10000444 <_start\+0x98> +--- ld/testsuite/ld-powerpc/tlsexe.g 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexe.g 9 Feb 2003 03:10:53 -0000 +@@ -7,6 +7,6 @@ + .*: +file format elf64-powerpc + + Contents of section \.got: +- 10010548 00000000 10018548 ffffffff ffff8018 .* +- 10010558 00000000 00000000 00000000 00000000 .* +- 10010568 00000000 00000000 .* ++ 100105f8 00000000 100185f8 00000000 00000000 .* ++ 10010608 00000000 00000000 ffffffff ffff8018 .* ++ 10010618 00000000 00000000 00000000 00000000 .* +--- ld/testsuite/ld-powerpc/tlsexe.r 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexe.r 9 Feb 2003 03:10:53 -0000 +@@ -1,38 +1,40 @@ + #source: tls.s + #source: tlslib.s + #as: -a64 +-#ld: -shared -melf64ppc ++#ld: -melf64ppc + #readelf: -WSsrl + #target: powerpc64*-*-* + +-There are 20 section headers.* ++There are 22 section headers.* + + Section Headers: + +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al + +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0 + +\[ 1\] \.interp +PROGBITS +0+10000190 0+190 0+11 0+ +A +0 +0 +1 +- +\[ 2\] \.hash +HASH +0+100001a8 0+1a8 0+3c 04 +A +3 +0 +8 +- +\[ 3\] \.dynsym +DYNSYM +0+100001e8 0+1e8 0+f0 18 +A +4 +1 +8 +- +\[ 4\] \.dynstr +STRTAB +0+100002d8 0+2d8 0+51 0+ +A +0 +0 +1 +- +\[ 5\] \.rela\.dyn +RELA +0+10000330 0+330 0+48 18 +A +3 +0 +8 +- +\[ 6\] \.text +PROGBITS +0+10000378 0+378 0+98 0+ +AX +0 +0 +4 +- +\[ 7\] \.data +PROGBITS +0+10010410 0+410 0+ 0+ +WA +0 +0 +1 +- +\[ 8\] \.branch_lt +PROGBITS +0+10010410 0+410 0+ 0+ +WA +0 +0 +8 +- +\[ 9\] \.tdata +PROGBITS +0+10010410 0+410 0+38 0+ WAT +0 +0 +8 +- +\[10\] \.tbss +NOBITS +0+10010448 0+448 0+38 0+ WAT +0 +0 +8 +- +\[11\] \.dynamic +DYNAMIC +0+10010448 0+448 0+100 10 +WA +4 +0 +8 +- +\[12\] \.ctors +PROGBITS +0+10010548 0+570 0+ 0+ +W +0 +0 +1 +- +\[13\] \.dtors +PROGBITS +0+10010548 0+570 0+ 0+ +W +0 +0 +1 +- +\[14\] \.got +PROGBITS +0+10010548 0+548 0+28 08 +WA +0 +0 +8 +- +\[15\] \.sbss +PROGBITS +0+10010570 0+570 0+ 0+ +W +0 +0 +1 +- +\[16\] \.bss +NOBITS +0+10010570 0+570 0+ 0+ +WA +0 +0 +1 +- +\[17\] \.shstrtab +STRTAB +0+ 0+570 0+8e 0+ +0 +0 +1 +- +\[18\] \.symtab +SYMTAB +0+ 0+b00 0+408 18 +19 +1b +8 +- +\[19\] \.strtab +STRTAB +0+ 0+f08 0+7d 0+ +0 +0 +1 ++ +\[ 2\] \.hash +HASH +0+100001a8 0+1a8 0+40 04 +A +3 +0 +8 ++ +\[ 3\] \.dynsym +DYNSYM +0+100001e8 0+1e8 0+108 18 +A +4 +1 +8 ++ +\[ 4\] \.dynstr +STRTAB +0+100002f0 0+2f0 0+51 0+ +A +0 +0 +1 ++ +\[ 5\] \.rela\.dyn +RELA +0+10000348 0+348 0+30 18 +A +3 +0 +8 ++ +\[ 6\] \.rela\.plt +RELA +0+10000378 0+378 0+18 18 +A +3 +11 +8 ++ +\[ 7\] \.text +PROGBITS +0+10000390 0+390 0+dc 0+ +AX +0 +0 +4 ++ +\[ 8\] \.data +PROGBITS +0+10010470 0+470 0+ 0+ +WA +0 +0 +1 ++ +\[ 9\] \.branch_lt +PROGBITS +0+10010470 0+470 0+ 0+ +WA +0 +0 +8 ++ +\[10\] \.tdata +PROGBITS +0+10010470 0+470 0+38 0+ WAT +0 +0 +8 ++ +\[11\] \.tbss +NOBITS +0+100104a8 0+4a8 0+38 0+ WAT +0 +0 +8 ++ +\[12\] \.dynamic +DYNAMIC +0+100104a8 0+4a8 0+150 10 +WA +4 +0 +8 ++ +\[13\] \.ctors +PROGBITS +0+100105f8 0+628 0+ 0+ +W +0 +0 +1 ++ +\[14\] \.dtors +PROGBITS +0+100105f8 0+628 0+ 0+ +W +0 +0 +1 ++ +\[15\] \.got +PROGBITS +0+100105f8 0+5f8 0+30 08 +WA +0 +0 +8 ++ +\[16\] \.sbss +PROGBITS +0+10010628 0+628 0+ 0+ +W +0 +0 +1 ++ +\[17\] \.plt +NOBITS +0+10010628 0+628 0+30 18 +WA +0 +0 +8 ++ +\[18\] \.bss +NOBITS +0+10010658 0+628 0+ 0+ +WA +0 +0 +1 ++ +\[19\] \.shstrtab +STRTAB +0+ 0+628 0+98 0+ +0 +0 +1 ++ +\[20\] \.symtab +SYMTAB +0+ 0+c40 0+450 18 +21 +1d +8 ++ +\[21\] \.strtab +STRTAB +0+ 0+1090 0+8c 0+ +0 +0 +1 + #... + + Elf file type is EXEC \(Executable file\) +-Entry point 0x10000378 ++Entry point 0x100003ac + There are 6 program headers.* + + Program Headers: +@@ -40,81 +42,88 @@ Program Headers: + +PHDR +0x0+40 0x0+10000040 0x0+10000040 0x0+150 0x0+150 R E 0x8 + +INTERP +0x0+190 0x0+10000190 0x0+10000190 0x0+11 0x0+11 R +0x1 + +\[Requesting program interpreter: .*\] +- +LOAD +0x0+ 0x0+10000000 0x0+10000000 0x0+410 0x0+410 R E 0x10000 +- +LOAD +0x0+410 0x0+10010410 0x0+10010410 0x0+160 0x0+160 RW +0x10000 +- +DYNAMIC +0x0+448 0x0+10010448 0x0+10010448 0x0+100 0x0+100 RW +0x8 +- +TLS +0x0+410 0x0+10010410 0x0+10010410 0x0+38 0x0+70 R +0x8 ++ +LOAD +0x0+ 0x0+10000000 0x0+10000000 0x0+46c 0x0+46c R E 0x10000 ++ +LOAD +0x0+470 0x0+10010470 0x0+10010470 0x0+1b8 0x0+1e8 RW +0x10000 ++ +DYNAMIC +0x0+4a8 0x0+100104a8 0x0+100104a8 0x0+150 0x0+150 RW +0x8 ++ +TLS +0x0+470 0x0+10010470 0x0+10010470 0x0+38 0x0+70 R +0x8 + + Section to Segment mapping: + +Segment Sections\.\.\. +- +00 + ++ +0+ + + +01 +\.interp +- +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.text +- +03 +\.tdata \.tbss \.dynamic \.got ++ +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text ++ +03 +\.tdata \.tbss \.dynamic \.got \.plt + +04 +\.tbss \.dynamic + +05 +\.tdata \.tbss + +-Relocation section '\.rela\.dyn' at offset .* contains 3 entries: ++Relocation section '\.rela\.dyn' at offset .* contains 2 entries: + +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend +-0+10010558 +0+200000049 R_PPC64_TPREL64 +0+ gd \+ 0 +-0+10010560 +0+400000049 R_PPC64_TPREL64 +0+ ld \+ 0 +-0+10010568 +0+60000004e R_PPC64_DTPREL64 +0+50 ld2 \+ 0 ++0+10010618 +0+200000049 R_PPC64_TPREL64 +0+ gd \+ 0 ++0+10010620 +0+70000004e R_PPC64_DTPREL64 +0+50 ld2 \+ 0 + +-Symbol table '\.dynsym' contains 10 entries: ++Relocation section '\.rela\.plt' at offset .* contains 1 entries: ++ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend ++0+10010640 +0+300000015 R_PPC64_JMP_SLOT +0+ __tls_get_addr \+ 0 ++ ++Symbol table '\.dynsym' contains 11 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND +- +1: 0+10010448 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC ++ +1: 0+100104a8 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC + +2: 0+ +0 TLS +GLOBAL DEFAULT +UND gd +- +3: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND \.__tls_get_addr +- +4: 0+ +0 TLS +GLOBAL DEFAULT +UND ld +- +5: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS __end +- +6: 0+50 +0 TLS +GLOBAL DEFAULT +10 ld2 +- +7: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start +- +8: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata +- +9: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS _end ++ +3: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr ++ +4: 0+ +0 FUNC +GLOBAL DEFAULT +UND \.__tls_get_addr ++ +5: 0+ +0 TLS +GLOBAL DEFAULT +UND ld ++ +6: 0+10010658 +0 NOTYPE +GLOBAL DEFAULT +ABS __end ++ +7: 0+50 +0 TLS +GLOBAL DEFAULT +11 ld2 ++ +8: 0+10010628 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start ++ +9: 0+10010628 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata ++ +10: 0+10010658 +0 NOTYPE +GLOBAL DEFAULT +ABS _end + +-Symbol table '\.symtab' contains 43 entries: ++Symbol table '\.symtab' contains 46 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND + +1: 0+10000190 +0 SECTION LOCAL +DEFAULT +1 + +2: 0+100001a8 +0 SECTION LOCAL +DEFAULT +2 + +3: 0+100001e8 +0 SECTION LOCAL +DEFAULT +3 +- +4: 0+100002d8 +0 SECTION LOCAL +DEFAULT +4 +- +5: 0+10000330 +0 SECTION LOCAL +DEFAULT +5 ++ +4: 0+100002f0 +0 SECTION LOCAL +DEFAULT +4 ++ +5: 0+10000348 +0 SECTION LOCAL +DEFAULT +5 + +6: 0+10000378 +0 SECTION LOCAL +DEFAULT +6 +- +7: 0+10010410 +0 SECTION LOCAL +DEFAULT +7 +- +8: 0+10010410 +0 SECTION LOCAL +DEFAULT +8 +- +9: 0+10010410 +0 SECTION LOCAL +DEFAULT +9 +- +10: 0+10010448 +0 SECTION LOCAL +DEFAULT +10 +- +11: 0+10010448 +0 SECTION LOCAL +DEFAULT +11 +- +12: 0+10010548 +0 SECTION LOCAL +DEFAULT +12 +- +13: 0+10010548 +0 SECTION LOCAL +DEFAULT +13 +- +14: 0+10010548 +0 SECTION LOCAL +DEFAULT +14 +- +15: 0+10010570 +0 SECTION LOCAL +DEFAULT +15 +- +16: 0+10010570 +0 SECTION LOCAL +DEFAULT +16 +- +17: 0+ +0 SECTION LOCAL +DEFAULT +17 +- +18: 0+ +0 SECTION LOCAL +DEFAULT +18 ++ +7: 0+10000390 +0 SECTION LOCAL +DEFAULT +7 ++ +8: 0+10010470 +0 SECTION LOCAL +DEFAULT +8 ++ +9: 0+10010470 +0 SECTION LOCAL +DEFAULT +9 ++ +10: 0+10010470 +0 SECTION LOCAL +DEFAULT +10 ++ +11: 0+100104a8 +0 SECTION LOCAL +DEFAULT +11 ++ +12: 0+100104a8 +0 SECTION LOCAL +DEFAULT +12 ++ +13: 0+100105f8 +0 SECTION LOCAL +DEFAULT +13 ++ +14: 0+100105f8 +0 SECTION LOCAL +DEFAULT +14 ++ +15: 0+100105f8 +0 SECTION LOCAL +DEFAULT +15 ++ +16: 0+10010628 +0 SECTION LOCAL +DEFAULT +16 ++ +17: 0+10010628 +0 SECTION LOCAL +DEFAULT +17 ++ +18: 0+10010658 +0 SECTION LOCAL +DEFAULT +18 + +19: 0+ +0 SECTION LOCAL +DEFAULT +19 +- +20: 0+ +0 TLS +LOCAL +DEFAULT +9 gd4 +- +21: 0+8 +0 TLS +LOCAL +DEFAULT +9 ld4 +- +22: 0+10 +0 TLS +LOCAL +DEFAULT +9 ld5 +- +23: 0+18 +0 TLS +LOCAL +DEFAULT +9 ld6 +- +24: 0+20 +0 TLS +LOCAL +DEFAULT +9 ie4 +- +25: 0+28 +0 TLS +LOCAL +DEFAULT +9 le4 +- +26: 0+30 +0 TLS +LOCAL +DEFAULT +9 le5 +- +27: 0+10010448 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC +- +28: 0+ +0 TLS +GLOBAL DEFAULT +UND gd +- +29: 0+60 +0 TLS +GLOBAL DEFAULT +10 le0 +- +30: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND \.__tls_get_addr +- +31: 0+40 +0 TLS +GLOBAL DEFAULT +10 ld0 +- +32: 0+68 +0 TLS +GLOBAL DEFAULT +10 le1 +- +33: 0+ +0 TLS +GLOBAL DEFAULT +UND ld +- +34: 0+10000378 +0 NOTYPE +GLOBAL DEFAULT +6 _start +- +35: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS __end +- +36: 0+50 +0 TLS +GLOBAL DEFAULT +10 ld2 +- +37: 0+48 +0 TLS +GLOBAL DEFAULT +10 ld1 +- +38: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start +- +39: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata +- +40: 0+10010570 +0 NOTYPE +GLOBAL DEFAULT +ABS _end +- +41: 0+38 +0 TLS +GLOBAL DEFAULT +10 gd0 +- +42: 0+58 +0 TLS +GLOBAL DEFAULT +10 ie0 ++ +20: 0+ +0 SECTION LOCAL +DEFAULT +20 ++ +21: 0+ +0 SECTION LOCAL +DEFAULT +21 ++ +22: 0+ +0 TLS +LOCAL +DEFAULT +10 gd4 ++ +23: 0+8 +0 TLS +LOCAL +DEFAULT +10 ld4 ++ +24: 0+10 +0 TLS +LOCAL +DEFAULT +10 ld5 ++ +25: 0+18 +0 TLS +LOCAL +DEFAULT +10 ld6 ++ +26: 0+20 +0 TLS +LOCAL +DEFAULT +10 ie4 ++ +27: 0+28 +0 TLS +LOCAL +DEFAULT +10 le4 ++ +28: 0+30 +0 TLS +LOCAL +DEFAULT +10 le5 ++ +29: 0+100104a8 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC ++ +30: 0+ +0 TLS +GLOBAL DEFAULT +UND gd ++ +31: 0+60 +0 TLS +GLOBAL DEFAULT +11 le0 ++ +32: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr ++ +33: 0+ +0 FUNC +GLOBAL DEFAULT +UND \.__tls_get_addr ++ +34: 0+40 +0 TLS +GLOBAL DEFAULT +11 ld0 ++ +35: 0+68 +0 TLS +GLOBAL DEFAULT +11 le1 ++ +36: 0+ +0 TLS +GLOBAL DEFAULT +UND ld ++ +37: 0+100003ac +0 NOTYPE +GLOBAL DEFAULT +7 _start ++ +38: 0+10010658 +0 NOTYPE +GLOBAL DEFAULT +ABS __end ++ +39: 0+50 +0 TLS +GLOBAL DEFAULT +11 ld2 ++ +40: 0+48 +0 TLS +GLOBAL DEFAULT +11 ld1 ++ +41: 0+10010628 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start ++ +42: 0+10010628 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata ++ +43: 0+10010658 +0 NOTYPE +GLOBAL DEFAULT +ABS _end ++ +44: 0+38 +0 TLS +GLOBAL DEFAULT +11 gd0 ++ +45: 0+58 +0 TLS +GLOBAL DEFAULT +11 ie0 +--- ld/testsuite/ld-powerpc/tlsexe.t 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexe.t 9 Feb 2003 03:10:53 -0000 +@@ -7,7 +7,7 @@ + .*: +file format elf64-powerpc + + Contents of section \.tdata: +- 10010410 12345678 9abcdef0 23456789 abcdef01 .* +- 10010420 3456789a bcdef012 456789ab cdef0123 .* +- 10010430 56789abc def01234 6789abcd ef012345 .* +- 10010440 789abcde f0123456 .* ++ 10010470 12345678 9abcdef0 23456789 abcdef01 .* ++ 10010480 3456789a bcdef012 456789ab cdef0123 .* ++ 10010490 56789abc def01234 6789abcd ef012345 .* ++ 100104a0 789abcde f0123456 .* +--- ld/testsuite/ld-powerpc/tlsexetoc.d 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexetoc.d 9 Feb 2003 03:10:53 -0000 +@@ -8,26 +8,45 @@ + + Disassembly of section \.text: + +-0+10000338 <_start>: +- 10000338: e8 62 80 08 ld r3,-32760\(r2\) +- 1000033c: 60 00 00 00 nop +- 10000340: 7c 63 6a 14 add r3,r3,r13 +- 10000344: e8 62 80 18 ld r3,-32744\(r2\) +- 10000348: 60 00 00 00 nop +- 1000034c: 7c 63 6a 14 add r3,r3,r13 +- 10000350: 3c 6d 00 00 addis r3,r13,0 +- 10000354: 60 00 00 00 nop +- 10000358: 38 63 91 40 addi r3,r3,-28352 +- 1000035c: 3c 6d 00 00 addis r3,r13,0 +- 10000360: 60 00 00 00 nop +- 10000364: 38 63 10 00 addi r3,r3,4096 +- 10000368: 39 23 80 40 addi r9,r3,-32704 +- 1000036c: 3d 23 00 00 addis r9,r3,0 +- 10000370: 81 49 80 48 lwz r10,-32696\(r9\) +- 10000374: 3d 2d 00 00 addis r9,r13,0 +- 10000378: 7d 49 18 2a ldx r10,r9,r3 +- 1000037c: 3d 2d 00 00 addis r9,r13,0 +- 10000380: a1 49 91 88 lhz r10,-28280\(r9\) +- 10000384: 89 4d 90 60 lbz r10,-28576\(r13\) +- 10000388: 3d 2d 00 00 addis r9,r13,0 +- 1000038c: 99 49 90 68 stb r10,-28568\(r9\) ++0+10000370 <_start-0x1c>: ++ 10000370: 3d 82 00 00 addis r12,r2,0 ++ 10000374: f8 41 00 28 std r2,40\(r1\) ++ 10000378: e9 6c 80 70 ld r11,-32656\(r12\) ++ 1000037c: e8 4c 80 78 ld r2,-32648\(r12\) ++ 10000380: 7d 69 03 a6 mtctr r11 ++ 10000384: e9 6c 80 80 ld r11,-32640\(r12\) ++ 10000388: 4e 80 04 20 bctr ++ ++0+1000038c <_start>: ++ 1000038c: e8 62 80 08 ld r3,-32760\(r2\) ++ 10000390: 60 00 00 00 nop ++ 10000394: 7c 63 6a 14 add r3,r3,r13 ++ 10000398: 38 62 80 18 addi r3,r2,-32744 ++ 1000039c: 4b ff ff d5 bl 10000370 <le1\+0x10000308> ++ 100003a0: e8 41 00 28 ld r2,40\(r1\) ++ 100003a4: 3c 6d 00 00 addis r3,r13,0 ++ 100003a8: 60 00 00 00 nop ++ 100003ac: 38 63 91 90 addi r3,r3,-28272 ++ 100003b0: 3c 6d 00 00 addis r3,r13,0 ++ 100003b4: 60 00 00 00 nop ++ 100003b8: 38 63 10 00 addi r3,r3,4096 ++ 100003bc: 39 23 80 40 addi r9,r3,-32704 ++ 100003c0: 3d 23 00 00 addis r9,r3,0 ++ 100003c4: 81 49 80 48 lwz r10,-32696\(r9\) ++ 100003c8: 3d 2d 00 00 addis r9,r13,0 ++ 100003cc: 7d 49 18 2a ldx r10,r9,r3 ++ 100003d0: 3d 2d 00 00 addis r9,r13,0 ++ 100003d4: a1 49 91 d8 lhz r10,-28200\(r9\) ++ 100003d8: 89 4d 90 60 lbz r10,-28576\(r13\) ++ 100003dc: 3d 2d 00 00 addis r9,r13,0 ++ 100003e0: 99 49 90 68 stb r10,-28568\(r9\) ++ 100003e4: e8 41 00 28 ld r2,40\(r1\) ++ 100003e8: 3d 82 00 00 addis r12,r2,0 ++ 100003ec: e9 6c 80 58 ld r11,-32680\(r12\) ++ 100003f0: e8 4c 80 60 ld r2,-32672\(r12\) ++ 100003f4: 7d 69 03 a6 mtctr r11 ++ 100003f8: e9 6c 80 68 ld r11,-32664\(r12\) ++ 100003fc: 4e 80 04 20 bctr ++ 10000400: 60 00 00 00 nop ++ 10000404: 38 00 00 00 li r0,0 ++ 10000408: 4b ff ff dc b 100003e4 <_start\+0x58> +--- ld/testsuite/ld-powerpc/tlsexetoc.g 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexetoc.g 9 Feb 2003 03:10:53 -0000 +@@ -7,8 +7,8 @@ + .*: +file format elf64-powerpc + + Contents of section \.toc: +- 100104d0 00000000 00000000 00000000 00000000 .* +- 100104e0 00000000 00000000 00000000 00000000 .* +- 100104f0 00000000 00000001 00000000 00000000 .* +- 10010500 00000000 00000001 00000000 00000000 .* +- 10010510 ffffffff ffff8050 00000000 00000000 .* ++ 100105a0 00000000 00000000 00000000 00000000 .* ++ 100105b0 00000000 00000000 00000000 00000000 .* ++ 100105c0 00000000 00000001 00000000 00000000 .* ++ 100105d0 00000000 00000001 00000000 00000000 .* ++ 100105e0 ffffffff ffff8050 00000000 00000000 .* +--- ld/testsuite/ld-powerpc/tlsexetoc.r 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexetoc.r 9 Feb 2003 03:10:53 -0000 +@@ -1,39 +1,41 @@ + #source: tlslib.s + #source: tlstoc.s + #as: -a64 +-#ld: -shared -melf64ppc ++#ld: -melf64ppc + #readelf: -WSsrl + #target: powerpc64*-*-* + +-There are 21 section headers.* ++There are 23 section headers.* + + Section Headers: + +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al + +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0 +- +\[ 1\] .interp +PROGBITS +0+10000190 0+190 0+11 0+ +A +0 +0 +1 +- +\[ 2\] .hash +HASH +0+100001a8 0+1a8 0+38 04 +A +3 +0 +8 +- +\[ 3\] .dynsym +DYNSYM +0+100001e0 0+1e0 0+d8 18 +A +4 +1 +8 +- +\[ 4\] .dynstr +STRTAB +0+100002b8 0+2b8 0+4d 0+ +A +0 +0 +1 +- +\[ 5\] .rela.dyn +RELA +0+10000308 0+308 0+30 18 +A +3 +0 +8 +- +\[ 6\] .text +PROGBITS +0+10000338 0+338 0+58 0+ +AX +0 +0 +4 +- +\[ 7\] .data +PROGBITS +0+10010390 0+390 0+ 0+ +WA +0 +0 +1 +- +\[ 8\] .branch_lt +PROGBITS +0+10010390 0+390 0+ 0+ +WA +0 +0 +8 +- +\[ 9\] .tdata +PROGBITS +0+10010390 0+390 0+38 0+ WAT +0 +0 +8 +- +\[10\] .tbss +NOBITS +0+100103c8 0+3c8 0+38 0+ WAT +0 +0 +8 +- +\[11\] .dynamic +DYNAMIC +0+100103c8 0+3c8 0+100 10 +WA +4 +0 +8 +- +\[12\] .ctors +PROGBITS +0+100104c8 0+520 0+ 0+ +W +0 +0 +1 +- +\[13\] .dtors +PROGBITS +0+100104c8 0+520 0+ 0+ +W +0 +0 +1 +- +\[14\] .got +PROGBITS +0+100104c8 0+4c8 0+8 08 +WA +0 +0 +8 +- +\[15\] .toc +PROGBITS +0+100104d0 0+4d0 0+50 0+ +WA +0 +0 +1 +- +\[16\] .sbss +PROGBITS +0+10010520 0+520 0+ 0+ +W +0 +0 +1 +- +\[17\] .bss +NOBITS +0+10010520 0+520 0+ 0+ +WA +0 +0 +1 +- +\[18\] .shstrtab +STRTAB +0+ 0+520 0+93 0+ +0 +0 +1 +- +\[19\] .symtab +SYMTAB +0+ 0+af8 0+438 18 +20 +1d +8 +- +\[20\] .strtab +STRTAB +0+ 0+f30 0+83 0+ +0 +0 +1 ++ +\[ 1\] \.interp +PROGBITS +0+10000190 0+190 0+11 0+ +A +0 +0 +1 ++ +\[ 2\] \.hash +HASH +0+100001a8 0+1a8 0+3c 04 +A +3 +0 +8 ++ +\[ 3\] \.dynsym +DYNSYM +0+100001e8 0+1e8 0+f0 18 +A +4 +1 +8 ++ +\[ 4\] \.dynstr +STRTAB +0+100002d8 0+2d8 0+4d 0+ +A +0 +0 +1 ++ +\[ 5\] \.rela\.dyn +RELA +0+10000328 0+328 0+30 18 +A +3 +0 +8 ++ +\[ 6\] \.rela\.plt +RELA +0+10000358 0+358 0+18 18 +A +3 +12 +8 ++ +\[ 7\] \.text +PROGBITS +0+10000370 0+370 0+9c 0+ +AX +0 +0 +4 ++ +\[ 8\] \.data +PROGBITS +0+10010410 0+410 0+ 0+ +WA +0 +0 +1 ++ +\[ 9\] \.branch_lt +PROGBITS +0+10010410 0+410 0+ 0+ +WA +0 +0 +8 ++ +\[10\] \.tdata +PROGBITS +0+10010410 0+410 0+38 0+ WAT +0 +0 +8 ++ +\[11\] \.tbss +NOBITS +0+10010448 0+448 0+38 0+ WAT +0 +0 +8 ++ +\[12\] \.dynamic +DYNAMIC +0+10010448 0+448 0+150 10 +WA +4 +0 +8 ++ +\[13\] \.ctors +PROGBITS +0+10010598 0+5f0 0+ 0+ +W +0 +0 +1 ++ +\[14\] \.dtors +PROGBITS +0+10010598 0+5f0 0+ 0+ +W +0 +0 +1 ++ +\[15\] \.got +PROGBITS +0+10010598 0+598 0+8 08 +WA +0 +0 +8 ++ +\[16\] \.toc +PROGBITS +0+100105a0 0+5a0 0+50 0+ +WA +0 +0 +1 ++ +\[17\] \.sbss +PROGBITS +0+100105f0 0+5f0 0+ 0+ +W +0 +0 +1 ++ +\[18\] \.plt +NOBITS +0+100105f0 0+5f0 0+30 18 +WA +0 +0 +8 ++ +\[19\] \.bss +NOBITS +0+10010620 0+5f0 0+ 0+ +WA +0 +0 +1 ++ +\[20\] \.shstrtab +STRTAB +0+ 0+5f0 0+9d 0+ +0 +0 +1 ++ +\[21\] \.symtab +SYMTAB +0+ 0+c50 0+480 18 +22 +1f +8 ++ +\[22\] \.strtab +STRTAB +0+ 0+10d0 0+92 0+ +0 +0 +1 + #... + + Elf file type is EXEC \(Executable file\) +-Entry point 0x10000338 ++Entry point 0x1000038c + There are 6 program headers.* + + Program Headers: +@@ -41,81 +43,89 @@ Program Headers: + +PHDR +0x0+40 0x0+10000040 0x0+10000040 0x0+150 0x0+150 R E 0x8 + +INTERP +0x0+190 0x0+10000190 0x0+10000190 0x0+11 0x0+11 R +0x1 + +\[Requesting program interpreter: .*\] +- +LOAD +0x0+ 0x0+10000000 0x0+10000000 0x0+390 0x0+390 R E 0x10000 +- +LOAD +0x0+390 0x0+10010390 0x0+10010390 0x0+190 0x0+190 RW +0x10000 +- +DYNAMIC +0x0+3c8 0x0+100103c8 0x0+100103c8 0x0+100 0x0+100 RW +0x8 +- +TLS +0x0+390 0x0+10010390 0x0+10010390 0x0+38 0x0+70 R +0x8 ++ +LOAD +0x0+ 0x0+10000000 0x0+10000000 0x0+40c 0x0+40c R E 0x10000 ++ +LOAD +0x0+410 0x0+10010410 0x0+10010410 0x0+1e0 0x0+210 RW +0x10000 ++ +DYNAMIC +0x0+448 0x0+10010448 0x0+10010448 0x0+150 0x0+150 RW +0x8 ++ +TLS +0x0+410 0x0+10010410 0x0+10010410 0x0+38 0x0+70 R +0x8 + + Section to Segment mapping: + +Segment Sections\.\.\. +- +00 + ++ +0+ + + +01 +\.interp +- +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.text +- +03 +\.tdata \.tbss \.dynamic \.got \.toc ++ +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text ++ +03 +\.tdata \.tbss \.dynamic \.got \.toc \.plt + +04 +\.tbss \.dynamic + +05 +\.tdata \.tbss + + Relocation section '\.rela\.dyn' at offset .* contains 2 entries: + +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend +-0+100104d0 +0+200000049 R_PPC64_TPREL64 +0+ gd \+ 0 +-0+100104e0 +0+400000049 R_PPC64_TPREL64 +0+ ld \+ 0 ++0+100105a0 +0+200000049 R_PPC64_TPREL64 +0+ gd \+ 0 ++0+100105b0 +0+500000044 R_PPC64_DTPMOD64 +0+ ld \+ 0 + +-Symbol table '\.dynsym' contains 9 entries: ++Relocation section '\.rela\.plt' at offset .* contains 1 entries: ++ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend ++0+10010608 +0+300000015 R_PPC64_JMP_SLOT +0+ __tls_get_addr \+ 0 ++ ++Symbol table '\.dynsym' contains 10 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND +- +1: 0+100103c8 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC ++ +1: 0+10010448 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC + +2: 0+ +0 TLS +GLOBAL DEFAULT +UND gd +- +3: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND \.__tls_get_addr +- +4: 0+ +0 TLS +GLOBAL DEFAULT +UND ld +- +5: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS __end +- +6: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start +- +7: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata +- +8: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS _end ++ +3: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr ++ +4: 0+ +0 FUNC +GLOBAL DEFAULT +UND \.__tls_get_addr ++ +5: 0+ +0 TLS +GLOBAL DEFAULT +UND ld ++ +6: 0+10010620 +0 NOTYPE +GLOBAL DEFAULT +ABS __end ++ +7: 0+100105f0 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start ++ +8: 0+100105f0 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata ++ +9: 0+10010620 +0 NOTYPE +GLOBAL DEFAULT +ABS _end + +-Symbol table '\.symtab' contains 45 entries: ++Symbol table '\.symtab' contains 48 entries: + +Num: +Value +Size Type +Bind +Vis +Ndx Name + +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND + +1: 0+10000190 +0 SECTION LOCAL +DEFAULT +1 + +2: 0+100001a8 +0 SECTION LOCAL +DEFAULT +2 +- +3: 0+100001e0 +0 SECTION LOCAL +DEFAULT +3 +- +4: 0+100002b8 +0 SECTION LOCAL +DEFAULT +4 +- +5: 0+10000308 +0 SECTION LOCAL +DEFAULT +5 +- +6: 0+10000338 +0 SECTION LOCAL +DEFAULT +6 +- +7: 0+10010390 +0 SECTION LOCAL +DEFAULT +7 +- +8: 0+10010390 +0 SECTION LOCAL +DEFAULT +8 +- +9: 0+10010390 +0 SECTION LOCAL +DEFAULT +9 +- +10: 0+100103c8 +0 SECTION LOCAL +DEFAULT +10 +- +11: 0+100103c8 +0 SECTION LOCAL +DEFAULT +11 +- +12: 0+100104c8 +0 SECTION LOCAL +DEFAULT +12 +- +13: 0+100104c8 +0 SECTION LOCAL +DEFAULT +13 +- +14: 0+100104c8 +0 SECTION LOCAL +DEFAULT +14 +- +15: 0+100104d0 +0 SECTION LOCAL +DEFAULT +15 +- +16: 0+10010520 +0 SECTION LOCAL +DEFAULT +16 +- +17: 0+10010520 +0 SECTION LOCAL +DEFAULT +17 +- +18: 0+ +0 SECTION LOCAL +DEFAULT +18 +- +19: 0+ +0 SECTION LOCAL +DEFAULT +19 ++ +3: 0+100001e8 +0 SECTION LOCAL +DEFAULT +3 ++ +4: 0+100002d8 +0 SECTION LOCAL +DEFAULT +4 ++ +5: 0+10000328 +0 SECTION LOCAL +DEFAULT +5 ++ +6: 0+10000358 +0 SECTION LOCAL +DEFAULT +6 ++ +7: 0+10000370 +0 SECTION LOCAL +DEFAULT +7 ++ +8: 0+10010410 +0 SECTION LOCAL +DEFAULT +8 ++ +9: 0+10010410 +0 SECTION LOCAL +DEFAULT +9 ++ +10: 0+10010410 +0 SECTION LOCAL +DEFAULT +10 ++ +11: 0+10010448 +0 SECTION LOCAL +DEFAULT +11 ++ +12: 0+10010448 +0 SECTION LOCAL +DEFAULT +12 ++ +13: 0+10010598 +0 SECTION LOCAL +DEFAULT +13 ++ +14: 0+10010598 +0 SECTION LOCAL +DEFAULT +14 ++ +15: 0+10010598 +0 SECTION LOCAL +DEFAULT +15 ++ +16: 0+100105a0 +0 SECTION LOCAL +DEFAULT +16 ++ +17: 0+100105f0 +0 SECTION LOCAL +DEFAULT +17 ++ +18: 0+100105f0 +0 SECTION LOCAL +DEFAULT +18 ++ +19: 0+10010620 +0 SECTION LOCAL +DEFAULT +19 + +20: 0+ +0 SECTION LOCAL +DEFAULT +20 +- +21: 0+ +0 TLS +LOCAL +DEFAULT +9 gd4 +- +22: 0+8 +0 TLS +LOCAL +DEFAULT +9 ld4 +- +23: 0+10 +0 TLS +LOCAL +DEFAULT +9 ld5 +- +24: 0+18 +0 TLS +LOCAL +DEFAULT +9 ld6 +- +25: 0+20 +0 TLS +LOCAL +DEFAULT +9 ie4 +- +26: 0+28 +0 TLS +LOCAL +DEFAULT +9 le4 +- +27: 0+30 +0 TLS +LOCAL +DEFAULT +9 le5 +- +28: 0+10010518 +0 NOTYPE +LOCAL +DEFAULT +15 \.Lie0 +- +29: 0+100103c8 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC +- +30: 0+ +0 TLS +GLOBAL DEFAULT +UND gd +- +31: 0+60 +0 TLS +GLOBAL DEFAULT +10 le0 +- +32: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND \.__tls_get_addr +- +33: 0+40 +0 TLS +GLOBAL DEFAULT +10 ld0 +- +34: 0+68 +0 TLS +GLOBAL DEFAULT +10 le1 +- +35: 0+ +0 TLS +GLOBAL DEFAULT +UND ld +- +36: 0+10000338 +0 NOTYPE +GLOBAL DEFAULT +6 _start +- +37: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS __end +- +38: 0+50 +0 TLS +GLOBAL DEFAULT +10 ld2 +- +39: 0+48 +0 TLS +GLOBAL DEFAULT +10 ld1 +- +40: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start +- +41: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata +- +42: 0+10010520 +0 NOTYPE +GLOBAL DEFAULT +ABS _end +- +43: 0+38 +0 TLS +GLOBAL DEFAULT +10 gd0 +- +44: 0+58 +0 TLS +GLOBAL DEFAULT +10 ie0 ++ +21: 0+ +0 SECTION LOCAL +DEFAULT +21 ++ +22: 0+ +0 SECTION LOCAL +DEFAULT +22 ++ +23: 0+ +0 TLS +LOCAL +DEFAULT +10 gd4 ++ +24: 0+8 +0 TLS +LOCAL +DEFAULT +10 ld4 ++ +25: 0+10 +0 TLS +LOCAL +DEFAULT +10 ld5 ++ +26: 0+18 +0 TLS +LOCAL +DEFAULT +10 ld6 ++ +27: 0+20 +0 TLS +LOCAL +DEFAULT +10 ie4 ++ +28: 0+28 +0 TLS +LOCAL +DEFAULT +10 le4 ++ +29: 0+30 +0 TLS +LOCAL +DEFAULT +10 le5 ++ +30: 0+100105e8 +0 NOTYPE +LOCAL +DEFAULT +16 \.Lie0 ++ +31: 0+10010448 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC ++ +32: 0+ +0 TLS +GLOBAL DEFAULT +UND gd ++ +33: 0+60 +0 TLS +GLOBAL DEFAULT +11 le0 ++ +34: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr ++ +35: 0+ +0 FUNC +GLOBAL DEFAULT +UND \.__tls_get_addr ++ +36: 0+40 +0 TLS +GLOBAL DEFAULT +11 ld0 ++ +37: 0+68 +0 TLS +GLOBAL DEFAULT +11 le1 ++ +38: 0+ +0 TLS +GLOBAL DEFAULT +UND ld ++ +39: 0+1000038c +0 NOTYPE +GLOBAL DEFAULT +7 _start ++ +40: 0+10010620 +0 NOTYPE +GLOBAL DEFAULT +ABS __end ++ +41: 0+50 +0 TLS +GLOBAL DEFAULT +11 ld2 ++ +42: 0+48 +0 TLS +GLOBAL DEFAULT +11 ld1 ++ +43: 0+100105f0 +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start ++ +44: 0+100105f0 +0 NOTYPE +GLOBAL DEFAULT +ABS _edata ++ +45: 0+10010620 +0 NOTYPE +GLOBAL DEFAULT +ABS _end ++ +46: 0+38 +0 TLS +GLOBAL DEFAULT +11 gd0 ++ +47: 0+58 +0 TLS +GLOBAL DEFAULT +11 ie0 +--- ld/testsuite/ld-powerpc/tlsexetoc.t 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlsexetoc.t 9 Feb 2003 03:10:53 -0000 +@@ -7,7 +7,7 @@ + .*: +file format elf64-powerpc + + Contents of section \.tdata: +- 10010390 12345678 9abcdef0 23456789 abcdef01 .* +- 100103a0 3456789a bcdef012 456789ab cdef0123 .* +- 100103b0 56789abc def01234 6789abcd ef012345 .* +- 100103c0 789abcde f0123456 .* ++ 10010410 12345678 9abcdef0 23456789 abcdef01 .* ++ 10010420 3456789a bcdef012 456789ab cdef0123 .* ++ 10010430 56789abc def01234 6789abcd ef012345 .* ++ 10010440 789abcde f0123456 .* +--- ld/testsuite/ld-powerpc/tlslib.s 4 Feb 2003 14:52:11 -0000 1.1 ++++ ld/testsuite/ld-powerpc/tlslib.s 9 Feb 2003 03:10:53 -0000 +@@ -1,4 +1,5 @@ + .global .__tls_get_addr,__tls_get_addr,gd,ld ++ .type .__tls_get_addr,@function + + .section ".opd","aw",@progbits + __tls_get_addr: + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ppc64-tls2.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ppc64-tls2.patch new file mode 100644 index 000000000000..b5cb6d2cbbfa --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-ppc64-tls2.patch @@ -0,0 +1,421 @@ +2003-02-10 Alan Modra <amodra@bigpond.net.au> + + * elf64-ppc.c: Rename assorted occurrences of tls_type and similar + variables, structure fields or function params to tls_mask or + similar to better reflect usage. + (struct got_entry): Comment. + (struct ppc_link_hash_entry): Expand comment, and renumber TLS_*. + (get_tls_mask): Rename from get_tls_type. + +--- bfd/elf64-ppc.c 9 Feb 2003 04:36:23 -0000 1.82 ++++ bfd/elf64-ppc.c 9 Feb 2003 13:41:25 -0000 +@@ -2503,14 +2503,18 @@ struct got_entry + { + struct got_entry *next; + ++ /* The symbol addend that we'll be placing in the GOT. */ + bfd_vma addend; + ++ /* Reference count until size_dynamic_sections, GOT offset thereafter. */ + union + { + bfd_signed_vma refcount; + bfd_vma offset; + } got; + ++ /* Zero for non-tls entries, or TLS_TLS and one of TLS_GD, TLS_LD, ++ TLS_TPREL or TLS_DTPREL for tls entries. */ + char tls_type; + }; + +@@ -2633,15 +2637,21 @@ struct ppc_link_hash_entry + unsigned int is_entry:1; + + /* Contexts in which symbol is used in the GOT (or TOC). +- Linker optimization will result in various transformations. */ +-#define TLS_TLS 1 /* Any TLS reloc. */ +-#define TLS_GD 2 /* GD reloc. */ +-#define TLS_LD 4 /* LD reloc. */ +-#define TLS_TPREL 8 /* TPREL reloc, => IE. */ +-#define TLS_DTPREL 16 /* DTPREL reloc, => LD. */ +-#define TLS_EXPLICIT 32 /* Marks TOC section relocs. */ +-#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */ +- char tls_type; ++ TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the ++ corresponding relocs are encountered during check_relocs. ++ tls_optimize clears TLS_GD .. TLS_TPREL when optimizing to ++ indicate the corresponding GOT entry type is not needed. ++ tls_optimize may also set TLS_TPRELGD when a GD reloc turns into ++ a TPREL one. We use a separate flag rather than setting TPREL ++ just for convenience in distinguishing the two cases. */ ++#define TLS_GD 1 /* GD reloc. */ ++#define TLS_LD 2 /* LD reloc. */ ++#define TLS_TPREL 4 /* TPREL reloc, => IE. */ ++#define TLS_DTPREL 8 /* DTPREL reloc, => LD. */ ++#define TLS_TLS 16 /* Any TLS reloc. */ ++#define TLS_EXPLICIT 32 /* Marks TOC section TLS relocs. */ ++#define TLS_TPRELGD 64 /* TPREL reloc resulting from GD->IE. */ ++ char tls_mask; + }; + + /* ppc64 ELF linker hash table. */ +@@ -2768,7 +2778,7 @@ static void ppc64_elf_hide_symbol + static bfd_boolean get_sym_h + PARAMS ((struct elf_link_hash_entry **, Elf_Internal_Sym **, asection **, + char **, Elf_Internal_Sym **, unsigned long, bfd *)); +-static int get_tls_type ++static int get_tls_mask + PARAMS ((char **, Elf_Internal_Sym **, const Elf_Internal_Rela *, bfd *)); + static bfd_boolean allocate_dynrelocs + PARAMS ((struct elf_link_hash_entry *, PTR)); +@@ -2910,7 +2920,7 @@ link_hash_newfunc (entry, table, string) + eh->is_func = 0; + eh->is_func_descriptor = 0; + eh->is_entry = 0; +- eh->tls_type = 0; ++ eh->tls_mask = 0; + } + + return entry; +@@ -3411,13 +3421,13 @@ update_local_sym_info (abfd, symtab_hdr, + int tls_type; + { + struct got_entry **local_got_ents = elf_local_got_ents (abfd); +- char *local_got_tls_types; ++ char *local_got_tls_masks; + + if (local_got_ents == NULL) + { + bfd_size_type size = symtab_hdr->sh_info; + +- size *= sizeof (*local_got_ents) + sizeof (char); ++ size *= sizeof (*local_got_ents) + sizeof (*local_got_tls_masks); + local_got_ents = (struct got_entry **) bfd_zalloc (abfd, size); + if (local_got_ents == NULL) + return FALSE; +@@ -3446,8 +3456,8 @@ update_local_sym_info (abfd, symtab_hdr, + ent->got.refcount += 1; + } + +- local_got_tls_types = (char *) (local_got_ents + symtab_hdr->sh_info); +- local_got_tls_types[r_symndx] |= tls_type; ++ local_got_tls_masks = (char *) (local_got_ents + symtab_hdr->sh_info); ++ local_got_tls_masks[r_symndx] |= tls_type; + return TRUE; + } + +@@ -3625,7 +3635,7 @@ ppc64_elf_check_relocs (abfd, info, sec, + eh->elf.got.glist = ent; + } + ent->got.refcount += 1; +- eh->tls_type |= tls_type; ++ eh->tls_mask |= tls_type; + } + else + /* This is a global offset table entry for a local symbol. */ +@@ -3754,7 +3764,7 @@ ppc64_elf_check_relocs (abfd, info, sec, + { + struct ppc_link_hash_entry *eh; + eh = (struct ppc_link_hash_entry *) h; +- eh->tls_type |= tls_type; ++ eh->tls_mask |= tls_type; + } + else + if (!update_local_sym_info (abfd, symtab_hdr, r_symndx, +@@ -3763,7 +3773,7 @@ ppc64_elf_check_relocs (abfd, info, sec, + + if (ppc64_elf_section_data (sec)->t_symndx == NULL) + { +- /* One extra to simplify get_tls_type. */ ++ /* One extra to simplify get_tls_mask. */ + bfd_size_type amt = sec->_raw_size * sizeof (unsigned) / 8 + 1; + ppc64_elf_section_data (sec)->t_symndx + = (unsigned *) bfd_zalloc (abfd, amt); +@@ -4687,11 +4697,11 @@ ppc64_elf_hide_symbol (info, h, force_lo + } + + static bfd_boolean +-get_sym_h (hp, symp, symsecp, tlstypep, locsymsp, r_symndx, ibfd) ++get_sym_h (hp, symp, symsecp, tls_maskp, locsymsp, r_symndx, ibfd) + struct elf_link_hash_entry **hp; + Elf_Internal_Sym **symp; + asection **symsecp; +- char **tlstypep; ++ char **tls_maskp; + Elf_Internal_Sym **locsymsp; + unsigned long r_symndx; + bfd *ibfd; +@@ -4723,12 +4733,12 @@ get_sym_h (hp, symp, symsecp, tlstypep, + *symsecp = symsec; + } + +- if (tlstypep != NULL) ++ if (tls_maskp != NULL) + { + struct ppc_link_hash_entry *eh; + + eh = (struct ppc_link_hash_entry *) h; +- *tlstypep = &eh->tls_type; ++ *tls_maskp = &eh->tls_mask; + } + } + else +@@ -4765,31 +4775,31 @@ get_sym_h (hp, symp, symsecp, tlstypep, + *symsecp = symsec; + } + +- if (tlstypep != NULL) ++ if (tls_maskp != NULL) + { + struct got_entry **lgot_ents; +- char *tlstype; ++ char *tls_mask; + +- tlstype = NULL; ++ tls_mask = NULL; + lgot_ents = elf_local_got_ents (ibfd); + if (lgot_ents != NULL) + { +- char *lgot_types = (char *) (lgot_ents + symtab_hdr->sh_info); +- tlstype = &lgot_types[r_symndx]; ++ char *lgot_masks = (char *) (lgot_ents + symtab_hdr->sh_info); ++ tls_mask = &lgot_masks[r_symndx]; + } +- *tlstypep = tlstype; ++ *tls_maskp = tls_mask; + } + } + return TRUE; + } + +-/* Returns TLS_TYPE for the given REL symbol. Function return is 0 on ++/* Returns TLS_MASKP for the given REL symbol. Function return is 0 on + error, 2 on a toc GD type suitable for optimization, 3 on a toc LD + type suitable for optimization, and 1 otherwise. */ + + static int +-get_tls_type (tls_type, locsymsp, rel, ibfd) +- char **tls_type; ++get_tls_mask (tls_maskp, locsymsp, rel, ibfd) ++ char **tls_maskp; + Elf_Internal_Sym **locsymsp; + const Elf_Internal_Rela *rel; + bfd *ibfd; +@@ -4802,10 +4812,10 @@ get_tls_type (tls_type, locsymsp, rel, i + bfd_vma off; + + r_symndx = ELF64_R_SYM (rel->r_info); +- if (!get_sym_h (&h, &sym, &sec, tls_type, locsymsp, r_symndx, ibfd)) ++ if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd)) + return 0; + +- if ((*tls_type != NULL && **tls_type != 0) ++ if ((*tls_maskp != NULL && **tls_maskp != 0) + || sec == NULL + || ppc64_elf_section_data (sec)->t_symndx == NULL) + return 1; +@@ -4822,7 +4832,7 @@ get_tls_type (tls_type, locsymsp, rel, i + BFD_ASSERT (off % 8 == 0); + r_symndx = ppc64_elf_section_data (sec)->t_symndx[off / 8]; + next_r = ppc64_elf_section_data (sec)->t_symndx[off / 8 + 1]; +- if (!get_sym_h (&h, &sym, &sec, tls_type, locsymsp, r_symndx, ibfd)) ++ if (!get_sym_h (&h, &sym, &sec, tls_maskp, locsymsp, r_symndx, ibfd)) + return 0; + if (h == NULL + || h->root.type == bfd_link_hash_defined +@@ -5210,13 +5220,13 @@ ppc64_elf_tls_optimize (obfd, info) + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sym_sec; +- char *tls_type; +- char tls_set, tls_clear, got_tls_type = 0; ++ char *tls_mask; ++ char tls_set, tls_clear, tls_type = 0; + bfd_vma value; + bfd_boolean ok_tprel, is_local; + + r_symndx = ELF64_R_SYM (rel->r_info); +- if (!get_sym_h (&h, &sym, &sym_sec, &tls_type, &locsyms, ++ if (!get_sym_h (&h, &sym, &sym_sec, &tls_mask, &locsyms, + r_symndx, ibfd)) + { + err_free_rel: +@@ -5270,7 +5280,7 @@ ppc64_elf_tls_optimize (obfd, info) + /* LD -> LE */ + tls_set = 0; + tls_clear = TLS_LD; +- got_tls_type = TLS_TLS | TLS_LD; ++ tls_type = TLS_TLS | TLS_LD; + expecting_tls_get_addr = 1; + break; + +@@ -5285,7 +5295,7 @@ ppc64_elf_tls_optimize (obfd, info) + /* GD -> IE */ + tls_set = TLS_TLS | TLS_TPRELGD; + tls_clear = TLS_GD; +- got_tls_type = TLS_TLS | TLS_GD; ++ tls_type = TLS_TLS | TLS_GD; + expecting_tls_get_addr = 1; + break; + +@@ -5299,7 +5309,7 @@ ppc64_elf_tls_optimize (obfd, info) + /* IE -> LE */ + tls_set = 0; + tls_clear = TLS_TPREL; +- got_tls_type = TLS_TLS | TLS_TPREL; ++ tls_type = TLS_TLS | TLS_TPREL; + break; + } + else +@@ -5323,7 +5333,7 @@ ppc64_elf_tls_optimize (obfd, info) + char *toc_tls; + int retval; + +- retval = get_tls_type (&toc_tls, &locsyms, ++ retval = get_tls_mask (&toc_tls, &locsyms, + rel - 1, ibfd); + if (retval == 0) + goto err_free_rel; +@@ -5401,7 +5411,7 @@ ppc64_elf_tls_optimize (obfd, info) + + for (; ent != NULL; ent = ent->next) + if (ent->addend == rel->r_addend +- && ent->tls_type == got_tls_type) ++ && ent->tls_type == tls_type) + break; + if (ent == NULL) + abort (); +@@ -5438,8 +5448,8 @@ ppc64_elf_tls_optimize (obfd, info) + } + } + +- *tls_type |= tls_set; +- *tls_type &= ~tls_clear; ++ *tls_mask |= tls_set; ++ *tls_mask &= ~tls_clear; + } + + if (elf_section_data (sec)->relocs != relstart) +@@ -5547,7 +5557,7 @@ allocate_dynrelocs (h, inf) + eh = (struct ppc_link_hash_entry *) h; + /* Run through the TLS GD got entries first if we're changing them + to TPREL. */ +- if ((eh->tls_type & TLS_TPRELGD) != 0) ++ if ((eh->tls_mask & TLS_TPRELGD) != 0) + for (gent = h->got.glist; gent != NULL; gent = gent->next) + if (gent->got.refcount > 0 + && (gent->tls_type & TLS_GD) != 0) +@@ -5592,11 +5602,11 @@ allocate_dynrelocs (h, inf) + + s = htab->sgot; + gent->got.offset = s->_raw_size; +- s->_raw_size += (gent->tls_type & eh->tls_type & TLS_GD) ? 16 : 8; ++ s->_raw_size += (gent->tls_type & eh->tls_mask & TLS_GD) ? 16 : 8; + dyn = htab->elf.dynamic_sections_created; + if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) + htab->srelgot->_raw_size +- += (gent->tls_type & eh->tls_type & TLS_GD ++ += (gent->tls_type & eh->tls_mask & TLS_GD + ? 2 * sizeof (Elf64_External_Rela) + : sizeof (Elf64_External_Rela)); + } +@@ -5752,7 +5762,7 @@ ppc64_elf_size_dynamic_sections (output_ + { + struct got_entry **lgot_ents; + struct got_entry **end_lgot_ents; +- char *lgot_types; ++ char *lgot_masks; + bfd_size_type locsymcount; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; +@@ -5794,17 +5804,17 @@ ppc64_elf_size_dynamic_sections (output_ + symtab_hdr = &elf_tdata (ibfd)->symtab_hdr; + locsymcount = symtab_hdr->sh_info; + end_lgot_ents = lgot_ents + locsymcount; +- lgot_types = (char *) end_lgot_ents; ++ lgot_masks = (char *) end_lgot_ents; + s = htab->sgot; + srel = htab->srelgot; +- for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_types) ++ for (; lgot_ents < end_lgot_ents; ++lgot_ents, ++lgot_masks) + { + struct got_entry *ent; + + for (ent = *lgot_ents; ent != NULL; ent = ent->next) + if (ent->got.refcount > 0) + { +- if ((ent->tls_type & *lgot_types & TLS_LD) != 0) ++ if ((ent->tls_type & *lgot_masks & TLS_LD) != 0) + { + if (htab->tlsld_got.offset == (bfd_vma) -1) + { +@@ -5818,7 +5828,7 @@ ppc64_elf_size_dynamic_sections (output_ + else + { + ent->got.offset = s->_raw_size; +- if ((ent->tls_type & *lgot_types & TLS_GD) != 0) ++ if ((ent->tls_type & *lgot_masks & TLS_GD) != 0) + { + s->_raw_size += 16; + if (info->shared) +@@ -6660,12 +6670,12 @@ ppc64_elf_size_stubs (output_bfd, stub_b + && irela != internal_relocs) + { + /* Get tls info. */ +- char *tls_type; ++ char *tls_mask; + +- if (!get_tls_type (&tls_type, &local_syms, ++ if (!get_tls_mask (&tls_mask, &local_syms, + irela - 1, input_bfd)) + goto error_ret_free_internal; +- if (*tls_type != 0) ++ if (*tls_mask != 0) + continue; + } + +@@ -7098,12 +7108,12 @@ ppc64_elf_relocate_section (output_bfd, + if (IS_TLS_RELOC (r_type)) + { + if (h != NULL) +- tls_mask = ((struct ppc_link_hash_entry *) h)->tls_type; ++ tls_mask = ((struct ppc_link_hash_entry *) h)->tls_mask; + else if (local_got_ents != NULL) + { +- char *lgot_types; +- lgot_types = (char *) (local_got_ents + symtab_hdr->sh_info); +- tls_mask = lgot_types[r_symndx]; ++ char *lgot_masks; ++ lgot_masks = (char *) (local_got_ents + symtab_hdr->sh_info); ++ tls_mask = lgot_masks[r_symndx]; + } + } + +@@ -7133,7 +7143,7 @@ ppc64_elf_relocate_section (output_bfd, + char *toc_tls; + int retval; + +- retval = get_tls_type (&toc_tls, &local_syms, rel, input_bfd); ++ retval = get_tls_mask (&toc_tls, &local_syms, rel, input_bfd); + if (retval == 0) + return FALSE; + +@@ -7185,7 +7195,7 @@ ppc64_elf_relocate_section (output_bfd, + /* Check for toc tls entries. */ + char *toc_tls; + +- if (!get_tls_type (&toc_tls, &local_syms, rel, input_bfd)) ++ if (!get_tls_mask (&toc_tls, &local_syms, rel, input_bfd)) + return FALSE; + + if (toc_tls) +@@ -7671,7 +7681,7 @@ ppc64_elf_relocate_section (output_bfd, + { + + relocation += ent->addend; +- if ((tls_type & TLS_TLS) != 0) ++ if (tls_type != 0) + { + relocation -= htab->tls_sec->vma + DTP_OFFSET; + if ((tls_type & TLS_TPREL) != 0) + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-s390-file-loc.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-s390-file-loc.patch new file mode 100644 index 000000000000..43d0c64f1f91 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-s390-file-loc.patch @@ -0,0 +1,40 @@ +2003-02-10 Jakub Jelinek <jakub@redhat.com> + + * config/tc-s390.c (md_pseudo_table): Add .file and .loc. + * config/tc-s390.h (DWARF2_LINE_MIN_INSN_LENGTH): Set to 2. + +--- gas/config/tc-s390.c.jj 2003-02-05 18:24:45.000000000 -0500 ++++ gas/config/tc-s390.c 2003-02-10 07:56:19.000000000 -0500 +@@ -82,7 +82,7 @@ static void s390_literals PARAMS ((int)) + + const pseudo_typeS md_pseudo_table[] = + { +- { "align", s_align_bytes, 0 }, ++ { "align", s_align_bytes, 0 }, + /* Pseudo-ops which must be defined. */ + { "bss", s390_bss, 0 }, + { "insn", s390_insn, 0 }, +@@ -93,6 +93,8 @@ const pseudo_typeS md_pseudo_table[] = + { "quad", s390_elf_cons, 8 }, + { "ltorg", s390_literals, 0 }, + { "string", stringer, 2 }, ++ { "file", (void (*) PARAMS ((int))) dwarf2_directive_file, 0 }, ++ { "loc", dwarf2_directive_loc, 0 }, + { NULL, NULL, 0 } + }; + +--- gas/config/tc-s390.h.jj 2003-01-24 18:17:06.000000000 -0500 ++++ gas/config/tc-s390.h 2003-02-10 07:54:50.000000000 -0500 +@@ -1,5 +1,5 @@ + /* tc-s390.h -- Header file for tc-s390.c. +- Copyright 2000, 2001, 2002 Free Software Foundation, Inc. ++ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Written by Martin Schwidefsky (schwidefsky@de.ibm.com). + + This file is part of GAS, the GNU Assembler. +@@ -98,3 +98,5 @@ extern long md_pcrel_from_section PARAMS + + extern void s390_md_end PARAMS ((void)); + #define md_end() s390_md_end () ++ ++#define DWARF2_LINE_MIN_INSN_LENGTH 2 diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-s390-noreladyn.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-s390-noreladyn.patch new file mode 100644 index 000000000000..6418536a6197 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-s390-noreladyn.patch @@ -0,0 +1,24 @@ +2003-02-07 Jakub Jelinek <jakub@redhat.com> + + * elf32-s390.c (elf_s390_size_dynamic_sections): Set relocs to TRUE + even if there is just non-empty .rela.plt. + +--- bfd/elf32-s390.c.jj 2003-01-24 18:15:38.000000000 -0500 ++++ bfd/elf32-s390.c 2003-02-07 16:48:18.000000000 -0500 +@@ -1,5 +1,5 @@ + /* IBM S/390-specific support for 32-bit ELF +- Copyright 2000, 2001, 2002 Free Software Foundation, Inc. ++ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Contributed by Carl B. Pedersen and Martin Schwidefsky. + + This file is part of BFD, the Binary File Descriptor library. +@@ -2014,7 +2014,7 @@ elf_s390_size_dynamic_sections (output_b + } + else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + { +- if (s->_raw_size != 0 && s != htab->srelplt) ++ if (s->_raw_size != 0) + relocs = TRUE; + + /* We use the reloc_count field as a counter if we need + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-searchdir.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-searchdir.patch new file mode 100644 index 000000000000..3d2da52ae4fc --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-searchdir.patch @@ -0,0 +1,54 @@ +2003-02-06 Jakub Jelinek <jakub@redhat.com> + + * genscripts.sh (LIB_PATH): Don't append LIBPATH_SUFFIX to paths + which already have it. Avoid duplicates. + +--- ld/genscripts.sh.jj 2003-01-08 10:02:41.000000000 -0500 ++++ ld/genscripts.sh 2003-02-06 12:16:35.000000000 -0500 +@@ -77,20 +77,37 @@ if [ "x${LIB_PATH}" = "x" ] && [ "x${USE + if [ x"$use_sysroot" != xyes ] ; then + LIB_PATH=${libdir} + fi ++ LIB_PATH2="" + for lib in ${NATIVE_LIB_DIRS}; do + # The "=" is harmless if we aren't using a sysroot, but also needless. + if [ "x${use_sysroot}" = "xyes" ] ; then + lib="=${lib}" + fi +- case :${LIB_PATH}: in +- *:${lib}:*) ;; +- ::) LIB_PATH=${lib} ;; +- *) LIB_PATH=${LIB_PATH}:${lib} ;; ++ addsuffix= ++ case "${LIBPATH_SUFFIX}:${lib}" in ++ :*) ;; ++ *:*${LIBPATH_SUFFIX}) ;; ++ *) addsuffix=yes ;; + esac ++ if test -n "$addsuffix"; then ++ case :${LIB_PATH}: in ++ *:${lib}${LIBPATH_SUFFIX}:*) ;; ++ ::) LIB_PATH=${lib}${LIBPATH_SUFFIX} ;; ++ *) LIB_PATH=${LIB_PATH}:${lib}${LIBPATH_SUFFIX} ;; ++ esac ++ case :${LIB_PATH}${LIB_PATH2}: in ++ *:${lib}:*) ;; ++ *) LIB_PATH2=${LIB_PATH2}:${lib} ;; ++ esac ++ else ++ case :${LIB_PATH}: in ++ *:${lib}:*) ;; ++ ::) LIB_PATH=${lib} ;; ++ *) LIB_PATH=${LIB_PATH}:${lib} ;; ++ esac ++ fi + done +- if test -n "$LIBPATH_SUFFIX" ; then +- LIB_PATH=`echo ${LIB_PATH}: | sed -e s,:,${LIBPATH_SUFFIX}:,g`$LIB_PATH +- fi ++ LIB_PATH=${LIB_PATH}${LIB_PATH2} + fi + + + + diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-sparc-nonpic.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-sparc-nonpic.patch new file mode 100644 index 000000000000..663e0df76906 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-sparc-nonpic.patch @@ -0,0 +1,96 @@ +2002-04-20 Jakub Jelinek <jakub@redhat.com> + + * elf32-sparc.c (elf32_sparc_relocate_section): Find real output + section with SEC_MERGE. + * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. + +--- bfd/elf32-sparc.c.jj Thu Feb 6 08:07:10 2003 ++++ bfd/elf32-sparc.c Thu Feb 6 08:31:54 2003 +@@ -2168,7 +2168,7 @@ elf32_sparc_relocate_section (output_bfd + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; +- bfd_vma relocation, off; ++ bfd_vma relocation, off, orig_addend = 0; + bfd_reloc_status_type r; + bfd_boolean is_plt = FALSE; + bfd_boolean unresolved_reloc; +@@ -2196,6 +2196,7 @@ elf32_sparc_relocate_section (output_bfd + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; ++ orig_addend = rel->r_addend; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + } + else +@@ -2525,6 +2526,25 @@ elf32_sparc_relocate_section (output_bfd + asection *osec; + + osec = sec->output_section; ++ /* FIXME: As soon as making sections zero size ++ is possible, this if can go away. */ ++ if (bfd_is_abs_section (osec) ++ && h == NULL ++ && (sec->flags & SEC_MERGE) ++ && ELF_ST_TYPE (sym->st_info) == STT_SECTION ++ && (elf_section_data (sec)->sec_info_type ++ == ELF_INFO_TYPE_MERGE)) ++ { ++ asection *msec; ++ ++ msec = sec; ++ _bfd_merged_section_offset (output_bfd, &msec, ++ elf_section_data (sec)->sec_info, ++ sym->st_value + orig_addend, ++ (bfd_vma) 0); ++ osec = msec->output_section; ++ } ++ + indx = elf_section_data (osec)->dynindx; + + /* FIXME: we really should be able to link non-pic +--- bfd/elf64-sparc.c.jj Thu Feb 6 08:07:10 2003 ++++ bfd/elf64-sparc.c Thu Feb 6 08:31:54 2003 +@@ -2016,7 +2016,7 @@ sparc64_elf_relocate_section (output_bfd + struct elf_link_hash_entry *h; + Elf_Internal_Sym *sym; + asection *sec; +- bfd_vma relocation, off; ++ bfd_vma relocation, off, orig_addend = 0; + bfd_reloc_status_type r; + bfd_boolean is_plt = FALSE; + bfd_boolean unresolved_reloc; +@@ -2039,6 +2039,7 @@ sparc64_elf_relocate_section (output_bfd + { + sym = local_syms + r_symndx; + sec = local_sections[r_symndx]; ++ orig_addend = rel->r_addend; + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel); + } + else +@@ -2267,6 +2268,25 @@ sparc64_elf_relocate_section (output_bfd + asection *osec; + + osec = sec->output_section; ++ /* FIXME: As soon as making sections zero size ++ is possible, this if can go away. */ ++ if (bfd_is_abs_section (osec) ++ && h == NULL ++ && (sec->flags & SEC_MERGE) ++ && ELF_ST_TYPE (sym->st_info) == STT_SECTION ++ && (elf_section_data (sec)->sec_info_type ++ == ELF_INFO_TYPE_MERGE)) ++ { ++ asection *msec; ++ ++ msec = sec; ++ _bfd_merged_section_offset (output_bfd, &msec, ++ elf_section_data (sec)->sec_info, ++ sym->st_value + orig_addend, ++ (bfd_vma) 0); ++ osec = msec->output_section; ++ } ++ + indx = elf_section_data (osec)->dynindx; + + /* We are turning this relocation into one diff --git a/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-sub-same.patch b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-sub-same.patch new file mode 100644 index 000000000000..b07f6e3e6738 --- /dev/null +++ b/sys-devel/binutils/files/2.13/binutils-2.13.90.0.18-sub-same.patch @@ -0,0 +1,29 @@ +2003-02-13 Alan Modra <amodra@bigpond.net.au> + + * write.c (TC_FORCE_RELOCATION_SUB_SAME): Revert last change. + * config/tc-s390.h (TC_FORCE_RELOCATION_SUB_SAME): Define. + +--- gas/write.c 23 Jan 2003 12:51:04 -0000 1.68 ++++ gas/write.c 12 Feb 2003 22:56:38 -0000 +@@ -51,7 +51,7 @@ + + #ifndef TC_FORCE_RELOCATION_SUB_SAME + #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \ +- (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX)) ++ (! SEG_NORMAL (SEG)) + #endif + + #ifndef TC_FORCE_RELOCATION_SUB_ABS +--- gas/config/tc-s390.h 5 Sep 2002 00:01:18 -0000 1.9 ++++ gas/config/tc-s390.h 12 Feb 2003 22:56:38 -0000 +@@ -32,6 +32,10 @@ struct fix; + #define TC_FORCE_RELOCATION(FIX) tc_s390_force_relocation(FIX) + extern int tc_s390_force_relocation PARAMS ((struct fix *)); + ++/* Don't resolve foo@PLT-bar to offset@PLT. */ ++#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \ ++ (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX)) ++ + #define tc_fix_adjustable(X) tc_s390_fix_adjustable(X) + extern int tc_s390_fix_adjustable PARAMS ((struct fix *)); + diff --git a/sys-devel/binutils/files/digest-binutils-2.13.90.0.18-r1 b/sys-devel/binutils/files/digest-binutils-2.13.90.0.18-r1 new file mode 100644 index 000000000000..93788cac26a8 --- /dev/null +++ b/sys-devel/binutils/files/digest-binutils-2.13.90.0.18-r1 @@ -0,0 +1,2 @@ +MD5 422a6fc64ebf785cad64a76defd4a4b6 binutils-2.13.90.0.18.tar.bz2 9849479 +MD5 acb4b464419405e58af1f20d08a4d37a binutils-2.13.90.0.18-20030206.patch.bz2 332800 |