bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linking problem - mips32 Android


From: Andrzej Warzynski
Subject: linking problem - mips32 Android
Date: Mon, 24 Aug 2015 16:34:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0

Hello,

We've recently came across a weird behavior with ld, and I wanted to
check whether this is a known issue and what's the best way to solve it.

We're using ld to link position independent binaries (passing the -pie
flag) for mips32 devices running Android. The problem is that ld marks
such binaries as shared when parsing arguments. This is implemented in
the parse_args() function in the lexsup.c file:

case OPTION_PIE:
     if (config.has_shared)
     {
         link_info.shared = TRUE;
         link_info.pie = TRUE;
     }

However, having been compiled with -pie does not necessarily imply that
it is a shared object, it could be an executable. Indeed, Android
requires all binaries to be position independent (i.e. linked with the
-pie flag), both shared objects and executables.

The above situation is particularly problematic for us, because it
prevents the _bfd_mips_elf_size_dynamic_sections() function in the
elfxx-mips.c file from adding the DT_MIPS_RLD_MAP structure to the
.dynamic section. This is due to the following check on line 9786 in
elfxx-mips.c (binutils-2.25.1):

if (!info->shared && !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP,
0))

This check means that DT_MIPS_RLD_MAP will not be added if the file
that's being processed is flagged as shared. The DT_MIPS_RLD_MAP
structure is used by debuggers to track loading and unloading of shared
objects. The above behavior (i.e. flagging all position independent
binaries as shared objects) renders debugging executables for mips32
Android impossible.

Is it necessary to flag all position independent executables as shared?
There's a bunch of easy workarounds, but we're not really sure what
would be the optimal solution.

Thank you,
Andrzej  Warzynski
--
Andrzej Warzynski
Codeplay Software Ltd
45 York Place, Edinburgh, EH1 3HP
Tel: 0131 466 0503
Fax: 0131 557 6600
Website: http://www.codeplay.com
Twitter: https://twitter.com/codeplaysoft

This email and any attachments may contain confidential and /or privileged information and is for use by the addressee only. If you are not the intended recipient, please notify Codeplay Software Ltd immediately and delete the message from your computer. You may not copy or forward it, or use or disclose its contents to any other person. Any views or other information in this message which do not relate to our business are not authorized by Codeplay software Ltd, nor does this message form part of any contract unless so stated.
As internet communications



reply via email to

[Prev in Thread] Current Thread [Next in Thread]