From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Cc: Rich Felker <dalias@libc.org>
Subject: Re: musl mips n64 dynamic build
Date: Mon, 19 Oct 2015 13:02:27 +0200 [thread overview]
Message-ID: <20151019110227.GB10551@port70.net> (raw)
In-Reply-To: <CAKd0kDLzXTACTaaKf72B-Sfg8ir4rLU6D8yXyCdXiOYBYOt7hA@mail.gmail.com>
* Mahesh Bodapati <maheshbodapati90@gmail.com> [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
next prev parent reply other threads:[~2015-10-19 11:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 9:21 Mahesh Bodapati
2015-10-19 11:02 ` Szabolcs Nagy [this message]
2015-10-19 15:18 ` Rich Felker
2015-10-20 9:44 ` Mahesh Bodapati
2015-10-20 10:40 ` Szabolcs Nagy
2015-10-27 1:30 ` Rich Felker
2016-01-21 19:11 ` Felix Fietkau
2016-01-22 7:51 ` Mahesh Bodapati
2016-01-22 14:13 ` Szabolcs Nagy
2016-01-27 6:47 ` Mahesh Bodapati
2016-01-28 0:08 ` Rich Felker
2016-01-28 11:29 ` Mahesh Bodapati
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151019110227.GB10551@port70.net \
--to=nsz@port70.net \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).