From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19348 invoked by alias); 1 Jul 2009 08:55:20 -0000 Received: (qmail 19337 invoked by uid 22791); 1 Jul 2009 08:55:19 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Jul 2009 08:55:13 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n618tBNq018361; Wed, 1 Jul 2009 04:55:11 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n618tBcx021792; Wed, 1 Jul 2009 04:55:11 -0400 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.2/8.14.2/Submit) id n618tAJw028285; Wed, 1 Jul 2009 10:55:10 +0200 Date: Wed, 01 Jul 2009 08:55:00 -0000 From: Jakub Jelinek To: Filippo ARCIDIACONO Cc: prelink@sourceware.org Subject: Re: [PATCH] Add TLS support for SH architecture. Message-ID: <20090701085510.GG4462@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <1246431789-3106-1-git-send-email-filippo.arcidiacono@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1246431789-3106-1-git-send-email-filippo.arcidiacono@st.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact prelink-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: prelink-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00001.txt.bz2 On Wed, Jul 01, 2009 at 03:03:09AM -0400, Filippo ARCIDIACONO wrote: > This patch extend the prelink tool also for sh architecture adding the tls > support, and fixes some architecture specific issue. > The fix in the sh_undo_prelink_rela function is needed to restore all the GOT > entries to the original value. > In the prelink stage GOT[1] has been set to the first plt entry just after the > plt header (This is the necessary code to jump at PLT[0]). > To retrieve the other ones we need to add (28 * n) byte to the first one, where > n is the n-th entry of the PLTn (n = 0,1,2,...). > The fix in src/dwarf2.c avoid assertion fail at line 808 for layout[12], > cxx[12] and undosyslibs tests. > > --- a/src/dwarf2.c > +++ b/src/dwarf2.c > @@ -789,6 +789,13 @@ adjust_dwarf2_aranges (DSO *dso, GElf_Addr start, GElf_Addr adjust) > } > > ptr += 6; > +#ifdef __SH4__ > +/* > + * This fix skips padding to avoid assertion fail at line 808 for > + * layout[12], cxx[12] and undosyslibs tests. > + */ > + ptr += 8; > +#endif > while (ptr < endcu) > { > addr = read_ptr (ptr); This change is not acceptable. Sometimes prelink is used as a cross tool, so host macros shouldn't make a difference on target behavior. Also, if you really need to skip another 8 bytes, it doesn't seem SH is using valid DWARF2/3 .debug_aranges, there really should be just 6 bytes skipped here (one byte address_size, one byte segment_size, 4 bytes padding to 16 byte boundary (the tuples are supposed to be aligned to twice the pointer size) and the aranges entries start right after that. I don't see anything in GCC that would suggest SH is treated differently. So, which compiler are you testing with, if it is not GCC, are you sure you aren't breaking prelink support for GCC on this arch? And in any case assembly output from the compiler with -dA for the .debug_aranges section to show what those 8 bytes are. Also, I'd like to understand those other non-TLS non-testsuite changes, are you saying prelink as is never really worked on any SH, or just the SH variant you are testing on behaves differently from the one it has been used on before (my memory is weak, it has been many years, so I don't remember well who tested prelink on which of the embedded arches I didn't have any access to). > --- a/testsuite/reloc8.sh > +++ b/testsuite/reloc8.sh > @@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc > case "`uname -m`" in > x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;; > esac > +case "`uname -m`" in > + sh4) NOCOPYRELOC=; > +esac This certainly should go into the same case, no need to call uname -m the second time. > --- a/testsuite/reloc9.sh > +++ b/testsuite/reloc9.sh > @@ -8,6 +8,9 @@ NOCOPYRELOC=-Wl,-z,nocopyreloc > case "`uname -m`" in > x86_64|s390*) if file reloc1lib1.so | grep -q 64-bit; then NOCOPYRELOC=; fi;; > esac > +case "`uname -m`" in > + sh4) NOCOPYRELOC=; > +esac Likewise. Jakub