This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Generate /usr/libexec/getconf files when cross-compiling


On Wed, Nov 14, 2012 at 6:15 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> This patch fixes one of the remaining differences between native and
> cross builds of glibc by generating /usr/libexec/getconf/ files when
> cross-compiling.
>
> These files are links to the getconf program for the purpose of
> getconf returning compilation / linking options to use when building
> programs for a different environment than that for which getconf
> itself was built.  The idea is that a system may have, for example,
> both 32-bit and 64-bit copies of glibc installed; one provides an
> ILP32 environment and the other provides an LP64 environment, but
> /usr/bin/getconf can only come from one of the copies of glibc.  If a
> user runs getconf to determine options relating to the other
> environment, getconf then execs a copy from /usr/libexec/getconf that
> was installed by the other copy of glibc (and the sysconf function,
> similarly, checks that directory to determine what environments are
> supported; see sysdeps/posix/sysconf.c:__sysconf_check_spec).
>
> The process for installing these links to getconf requires the
> makefiles to determine the set of environments supported by this
> particular copy of glibc.  To do so, posix/Makefile runs the newly
> built getconf program with appropriate arguments such as
> _POSIX_V7_WIDTH_RESTRICTED_ENVS to print the list of supported
> environments - with GETCONF_DIR=/dev/null set to ensure that only the
> present glibc is considered and links previously installed in
> /usr/libexec/getconf are not examined.
>
> To work with cross-compilation, running a program built with the new
> glibc is no longer an option.  The relevant code ultimately depends on
> the values of various macros from bits/environments.h.  This patch
> arranges for the correct settings of those macros to be determined
> through preprocessing confstr.c, put in a generated cross-getconf.h
> file, and used in building a cross-getconf program that uses the
> relevant part of confstr.c, extracted into a new source file to be
> shared between both getconf and cross-getconf/
>
> Tested x86_64.
>
> 2012-11-14  Maxim Kuvyrkov  <maxim@codesourcery.com>
>             Joseph Myers  <joseph@codesourcery.com>
>
>         * posix/confstr.inc: New file.  Split out of ...
>         * posix/confstr.c (confstr): ... here.
>         * posix/cross-getconf.c: New file.
>         * posix/Makefile (getconf-envs): New variable.
>         (getconf-egrep): Likewise.
>         ($(objpfx)cross-getconf.h): New target.
>         (cross-getconf-CFLAGS): New variable.
>         ($(objpfx)cross-getconf): New target.
>         ($(objpfx)getconf.speclist): Do not condition main definition on
>         [$(cross-compiling) = no].  Remove dummy definition.  Use
>         $(objpfx)cross-getconf instead of $(objpfx)getconf.

This looks good to me.

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]