This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: Should x86-64 support arbitrary calling conventions?
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- Cc: Alexander Monakov <amonakov at ispras dot ru>, nd <nd at arm dot com>, Zack Weinberg <zackw at panix dot com>, Florian Weimer <fw at deneb dot enyo dot de>, "Kreitzer, David L" <david dot l dot kreitzer at intel dot com>, "Carlos O'Donell" <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Jeff Law <law at redhat dot com>, "Maslov, Sergey V" <sergey dot v dot maslov at intel dot com>
- Date: Mon, 27 Mar 2017 08:19:44 -0700
- Subject: Re: RFC: Should x86-64 support arbitrary calling conventions?
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOoLSU=zfhdS1DqKQVr-5Hr9jqBjoR_CMUyFHQ8JKJfwZw@mail.gmail.com> <20170316232737.GD24205@vapier> <CAMe9rOrx5Kzwniv+UqQ+xi2FpDBf8sFeogimwcS6YUHuT2pk+Q@mail.gmail.com> <100440FED7798443A51E0730E25E29E85AAC14B5@fmsmsx117.amr.corp.intel.com> <a6e085c3-884d-3156-9b43-35094dfbc042@redhat.com> <100440FED7798443A51E0730E25E29E85AAD9939@fmsmsx117.amr.corp.intel.com> <CAMe9rOrfoekW=gu8_sWTiTECedJCVs1xZ7byZFT15a_Kxk6LAw@mail.gmail.com> <87shm3f2bj.fsf@mid.deneb.enyo.de> <CAMe9rOpve0gyP6a-3zjzTJFpzxG-qVW0ycrCLzEYyC56U3LfbA@mail.gmail.com> <871stmaalw.fsf@mid.deneb.enyo.de> <CAKCAbMg2a6u_14VijWH+Jycnr4NHZkNMq0Y9EGT39ko0qjmsaQ@mail.gmail.com> <87r31m8uyk.fsf@mid.deneb.enyo.de> <CAKCAbMj1m+d+QdOD8nGewcEe=-1RFjCz=nJS0tdD_hva5995FA@mail.gmail.com> <58D8EC19.6030505@arm.com> <alpine.LNX.2.20.13.1703271409130.7566@monopod.intra.ispras.ru> <58D8F779.30509@arm.com>
On Mon, Mar 27, 2017 at 4:28 AM, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> On 27/03/17 12:12, Alexander Monakov wrote:
>> On Mon, 27 Mar 2017, Szabolcs Nagy wrote:
>>> even if the dynamic linker was careful not to
>>> clobber certain registers in memcpy/strcmp/..,
>>> ifunc resolvers follow the normal pcs, so they
>>> are allowed to clobber them anyway.
>>>
>>> so in general 'the dynamic linker is careful'
>>> argument does not work in the presence of
>>> user defined ifunc.
>>
>> As said in an adjacent subthread, the dynamic linker knows exactly when it is
>> about to call back to external code (ifunc resolver, LD_AUDIT handlers), and
>> it can save/restore additional registers just around those points.
>>
>> I believe a bigger issue is usage of [optimized] string functions in the linker.
>>
>
> sorry i missed that thread,
>
> that's true, but note that elf_ifunc_invoke is
> currently called from generic c code from
> elf/dl-runtime.c so it would be a non-trivial
> change to do the save/restore around that.
>
Even without IFUNC nor SSE in ld.so, we still need to deal with
RTLD_PREPARE_FOREIGN_CALL
which may clobber vector registers.
--
H.J.