From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8694 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl mips n64 dynamic build Date: Mon, 19 Oct 2015 13:02:27 +0200 Message-ID: <20151019110227.GB10551@port70.net> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1445252563 14707 80.91.229.3 (19 Oct 2015 11:02:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Oct 2015 11:02:43 +0000 (UTC) Cc: Rich Felker To: musl@lists.openwall.com Original-X-From: musl-return-8706-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 19 13:02:42 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Zo8DC-0007Rm-C3 for gllmg-musl@m.gmane.org; Mon, 19 Oct 2015 13:02:42 +0200 Original-Received: (qmail 16302 invoked by uid 550); 19 Oct 2015 11:02:40 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 16284 invoked from network); 19 Oct 2015 11:02:39 -0000 Mail-Followup-To: musl@lists.openwall.com, Rich Felker Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:8694 Archived-At: * Mahesh Bodapati [2015-10-19 14:51:12 +0530]: > Hi Rich, > > I have ported musl libraries for MIPS n64 ABI architecture and I have setup > $gp as > > Crt1.s: > > *lui $3,%hi(%neg(%gp_rel(_start)))* > > * daddu > $3,$3,$25 /* same in dlsym.s > and pipe.s */* > > * daddiu $gp,$3,%lo(%neg(%gp_rel(_start)))* > > ld $4, %got_disp(main)($gp) # Get main() .. > > > > I didn???t setup $gp as in MIPS o32 ABI as we shouldn???t use _*gp*_disp for > setting up $gp > > ???The special symbol name _gp_disp, used for relocating the calculation of gp > on entry to a DSO in 32-bit files, is > > not supported in ELF-64 or in the new 32-bit ABI. Instead, these relocations > should be composed with > > R_MIPS_GPREL applied to an explicit symbol for the entry point of the > subprogram > > > > involves loading the difference between the entry > > address of a subprogram s and the runtime gp for establishing gp: > > A: lui rx, %hi(%neg(%gp_rel(s)))# load high part of diff > > B: daddiu rx, rx, %lo(%neg(%gp_rel(s)))# add low part > > C: dadd gp, t9, rx # add to entry address ??? > > > > Now I am able to build dynamic n64 musl libraries and n64 dynamic > application but it???s not showing any relocation with it > > and execution of application is giving errors like ???unsupported relocation > type errors??? > > $ objdump -R main > > > > a.out: file format elf64-tradbigmips > > > > DYNAMIC RELOCATION RECORDS (none) > > > > $ ./main > > Error relocating libc.so: unsupported relocation type 482431 > > Error relocating libc.so: unsupported relocation type 482687 > > Error relocating libc.so: unsupported relocation type 482943 > > Error relocating libc.so: unsupported relocation type 483199 > > ; note that these are in libc.so, not main and the numbers are incrementing by 256, so the last byte is unchanged 0x7f which means R_MIPS_JUMP_SLOT on o32 mips. maybe libc is built to load 64bit elf but itself is a 32bit elf? try inspecting readelf -aW of libc.so > > ; > > ; > > Segmentation fault > > > > So Can you suggest how can I resolve these errors? I am thinking like > either doing changes in do_mips_reloc(),do_relocs() functions in musl > sources or in usage of relocations. > > > > > > Thank You In Advance. > > > > Thanks, > > Mahesh