Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 20 Jan 2014 10:25:22 +0100
From: Jens Gustedt <jens.gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: Re: Discussion of partly-invasive changes needed for x32 port

Hi,

Am Montag, den 20.01.2014, 09:43 +0100 schrieb Luca Barbato:
> On 20/01/14 08:41, Rich Felker wrote:
> > Adding the workaround code at every syscall point is ugly, and
> > possibly error-prone. An alternate possible solution is hacking up the
> > syscall macros in syscall_arch.h to detect "const struct timespec *"
> > arguments and auto-wrap them with compound literals that would fix-up
> > the padding. However this probably requires either C11 or GNU C
> > extensions. On the positive side, it would only affect x32; no changes
> > at all would be made to the source files or other archs'
> > syscall_arch.h logic.
> 
> Can a compiler supporting x32 be safely expected to support C11 ? If yes
> sounds the best route.

I have difficulties in understanding why C11 pops up, here. Compound
literals are in C since C99. gcc and clang support them since
ages.

Generally they provide a nice "static cast" that doesn't convert
blindly as the "C cast" and usually provide with better diagnostics in
cases things go wrong. E.g the macro that Rich mentioned early to cast
to long could use "(long const){ (X) }" instead of "(long)(X)", such
that conversion from pointer expressions wouldn't pass unnoticed. In
my opion macros shouldn't hide casts. A cast is a marker for the
compiler "you must know what your doing" which might not be the case,
if it is hidden like that.

Padding tricks may perhaps be played a bit more nicely with C11, but
they can be done with a bit more pain in previous version of the
standard, I think.


Jens

-- 
:: INRIA Nancy Grand Est :: http://www.loria.fr/~gustedt/   ::
:: AlGorille ::::::::::::::: office Nancy : +33 383593090   ::
:: ICube :::::::::::::: office Strasbourg : +33 368854536   ::
:: ::::::::::::::::::::::::::: gsm France : +33 651400183   ::
:: :::::::::::::::::::: gsm international : +49 15737185122 ::




Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.