From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8693 Path: news.gmane.org!not-for-mail From: Mahesh Bodapati Newsgroups: gmane.linux.lib.musl.general Subject: musl mips n64 dynamic build Date: Mon, 19 Oct 2015 14:51:12 +0530 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113fb1e8a2decc052271aab0 X-Trace: ger.gmane.org 1445246501 32372 80.91.229.3 (19 Oct 2015 09:21:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Oct 2015 09:21:41 +0000 (UTC) Cc: musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-8705-gllmg-musl=m.gmane.org@lists.openwall.com Mon Oct 19 11:21:36 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 1Zo6dL-0004JJ-VB for gllmg-musl@m.gmane.org; Mon, 19 Oct 2015 11:21:36 +0200 Original-Received: (qmail 8150 invoked by uid 550); 19 Oct 2015 09:21:32 -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 8093 invoked from network); 19 Oct 2015 09:21:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=w7SFuCGIJwPRnl8IRvBy3u2d1D7h8QTlQ4xNnRlVLPg=; b=zfOIGLEYCk7hrZ9Q5JG1On//1m7KFYb2sP58q7aWXHYbcAiJPoWqoFOpoX5IKAQZY5 Y/ydJrvMjnmbTponmXbN6XzVETOBVGw1uqhVbEzD/fxoV+u+7qq04rtDCmrn90Vjo5GC Z+GDCVBh4z7EZDpMOOiggFzZUk57wpfx+S9I98waUnfIvbIgrQxW8mwyY1n2uzKT3Lbr dl+RxpO8PU+8mGcpegUmo5SPG0w7AByUO6cgSop3nbZtN5Pl76qEsFQCyZw7LYUJ9k6Q 0ujH4ouavGg/j+D16HT30nPkDO/RlM+n8Z2fZJXkzy67hG1jKLK1Gy4+NThxAMW2i+l1 4rBg== X-Received: by 10.107.133.157 with SMTP id p29mr35255012ioi.71.1445246473000; Mon, 19 Oct 2015 02:21:13 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:8693 Archived-At: --001a113fb1e8a2decc052271aab0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=E2=80=99t setup $gp as in MIPS o32 ABI as we shouldn=E2=80=99t use _= *gp*_disp for setting up $gp =E2=80=9CThe special symbol name _gp_disp, used for relocating the calculat= ion 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 relocation= s 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 =E2=80=9C Now I am able to build dynamic n64 musl libraries and n64 dynamic application but it=E2=80=99s not showing any relocation with it and execution of application is giving errors like =E2=80=9Cunsupported rel= ocation type errors=E2=80=9D $ 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 ; ; ; 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 --001a113fb1e8a2decc052271aab0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Rich,

I have ported musl libraries for MIPS n64 ABI architecture and I have setup $gp = as

Crt1.s:=C2=A0=C2=A0

lui=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 $3,%hi(%neg(%gp_rel(_start)))

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0dadd= u=C2=A0=C2=A0 $3,$3,$25=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 /* same in dlsym.s an= d pipe.s */

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 daddiu=C2=A0 $gp,$3,%lo(%neg(%gp_rel(_start)))

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ld=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 $4, %got_disp(ma= in)($gp)=C2=A0=C2=A0= # Get main() ..

=C2=A0

I didn=E2=80=99t setup $gp as in MIPS o32 ABI as we shouldn=E2=80=99t use _gp_disp for setting up $gp <= /p>

=E2=80=9CThe s= pecial symbol name _gp_disp, used for relocatin= g 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<= /span> should be composed with

R_MIPS_GPREL applied to an explicit symbol for the entry point of the subprogram

=C2=A0<= /p>

involves loadi= ng the difference between the entry

address of a s= ubprogram 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 entr= y address=C2=A0 =E2=80=9C

=C2=A0

Now I am able to build d= ynamic n64 musl libr= aries and n64 dynamic application but it=E2=80=99s not showing any relocation with it

and execution of applica= tion is giving errors like =E2=80=9Cunsupported relocation type errors=E2=80=9D

$ objdump -R main

=C2=A0

a.out:=C2=A0=C2=A0=C2=A0= =C2=A0 file format elf64-tradbigmi= ps

=C2=A0

DYNAMIC RELOCATION RECOR= DS (none)

=C2=A0

$ ./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

;

;

;

Segmentation fault

=C2=A0

So Can you suggest how c= an I resolve these errors? I am thinking like either doing changes in do_mips_r= eloc(),do_relocs() functions in musl sources or in u= sage of relocations.=

=C2=A0

=C2=A0

Thank You In Advance.

=C2=A0

Thanks,

Mahesh

=C2=A0

=C2=A0

=C2=A0

=C2=A0

--001a113fb1e8a2decc052271aab0--