mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] getauxval availability
@ 2020-02-16 13:43 Jeffrey Walton
  2020-02-16 16:06 ` Rich Felker
  2020-02-16 16:15 ` Szabolcs Nagy
  0 siblings, 2 replies; 3+ messages in thread
From: Jeffrey Walton @ 2020-02-16 13:43 UTC (permalink / raw)
  To: musl

Hi Everyone,

We use getauxval on Linux when available to determine cpu caps. For
Glibc the code looks like (http://lwn.net/Articles/519085/):

#if (((__GLIBC__ * 100) + __GLIBC_MINOR__) >= 216)
# define GETAUXV_AVAILABLE 1
#endif

I need a similar test for musl. It looks like the function was added
at https://git.musl-libc.org/cgit/musl/commit/?id=21ada94c4b8c. I
don't see how to map a commit to a release for the web front-end musl
uses.

The release page indicates it should be available with musl-1.0.1,
which was released April 16 2014
(https://www.musl-libc.org/releases/). But I am not sure about the
musl release process, and what is included in a release tarball.

What is the first release of musl that contains 21ada94c4b8c ?

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [musl] getauxval availability
  2020-02-16 13:43 [musl] getauxval availability Jeffrey Walton
@ 2020-02-16 16:06 ` Rich Felker
  2020-02-16 16:15 ` Szabolcs Nagy
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Felker @ 2020-02-16 16:06 UTC (permalink / raw)
  To: musl

On Sun, Feb 16, 2020 at 08:43:54AM -0500, Jeffrey Walton wrote:
> Hi Everyone,
> 
> We use getauxval on Linux when available to determine cpu caps. For
> Glibc the code looks like (http://lwn.net/Articles/519085/):
> 
> #if (((__GLIBC__ * 100) + __GLIBC_MINOR__) >= 216)
> # define GETAUXV_AVAILABLE 1
> #endif
> 
> I need a similar test for musl. It looks like the function was added
> at https://git.musl-libc.org/cgit/musl/commit/?id=21ada94c4b8c. I
> don't see how to map a commit to a release for the web front-end musl
> uses.
> 
> The release page indicates it should be available with musl-1.0.1,
> which was released April 16 2014
> (https://www.musl-libc.org/releases/). But I am not sure about the
> musl release process, and what is included in a release tarball.
> 
> What is the first release of musl that contains 21ada94c4b8c ?

The right way to do this is probing for the existence via a configure
check or equivalent, not hard-coding specific library versions
believed to have the interface. On both glibc and musl (and other
software ppl try to do hardcode-the-version hacks with, like Linu
kernel), distros and individual users backport important things so
that there is no reliable answer.

I realize this is something of a pain for programmers who don't make
use of any configure-like system at build time, and there is a long
term plan to have a cross-libc system for macros announcing the
availability of nonstandard functionality so that you can just do
#ifdef at the source level rather than needing to do something at
configure time, analogous to how the POSIX macros in unistd.h work.

Rich

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [musl] getauxval availability
  2020-02-16 13:43 [musl] getauxval availability Jeffrey Walton
  2020-02-16 16:06 ` Rich Felker
@ 2020-02-16 16:15 ` Szabolcs Nagy
  1 sibling, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2020-02-16 16:15 UTC (permalink / raw)
  To: musl

* Jeffrey Walton <noloader@gmail.com> [2020-02-16 08:43:54 -0500]:
> We use getauxval on Linux when available to determine cpu caps. For
> Glibc the code looks like (http://lwn.net/Articles/519085/):
> 
> #if (((__GLIBC__ * 100) + __GLIBC_MINOR__) >= 216)
> # define GETAUXV_AVAILABLE 1
> #endif

this is not reliable.

> I need a similar test for musl. It looks like the function was added
> at https://git.musl-libc.org/cgit/musl/commit/?id=21ada94c4b8c. I
> don't see how to map a commit to a release for the web front-end musl
> uses.

you can use a compile or link time check e.g.

#include <sys/auxv.h>
unsigned long (*p)(unsigned long) = getauxval;
int main() {return p(0);}

or assume that it's available and let the user
manually disable it if not.

> The release page indicates it should be available with musl-1.0.1,
> which was released April 16 2014
> (https://www.musl-libc.org/releases/). But I am not sure about the
> musl release process, and what is included in a release tarball.
> 
> What is the first release of musl that contains 21ada94c4b8c ?

$ git describe --tags 21ada94c4b8c
v1.0.0-20-g21ada94c

i.e. it's 20 commits after the v1.0.0 release tag
so anything after that should have it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-16 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 13:43 [musl] getauxval availability Jeffrey Walton
2020-02-16 16:06 ` Rich Felker
2020-02-16 16:15 ` Szabolcs Nagy

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).