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]

PING: [PATCH] BZ #13679: Use static link by default for --disable-shared


On Wed, Sep 5, 2012 at 9:12 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Sep 5, 2012 at 8:41 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
>> On Wed, 5 Sep 2012, H.J. Lu wrote:
>>
>>> This patch restores --disable-shared support.  It uses static link
>>> by default if --disable-shared is used.  It also adds -lgcc_eh to
>>> static-gnulib since -lgcc_eh is needed in some glibc executables. Tested
>>> on Linux/x86-64.  OK to install?
>>
>> static-gnulib cannot use -lgcc_eh if bootstraps are to work properly with
>> a bootstrap compiler with static libgcc only (so no libgcc_eh).
>> "Properly" means the binaries are the same as you get if you build with a
>> compiler with shared libgcc (that itself was linked with a previous libc
>> build), so far as they are the same when you build twice with identical
>> compilers - note that for this you need two of my patches that went in to
>> GCC 4.8.
>>
>> I don't know whether that's feasible for the static-only case or whether
>> some programs (that would normally be linked with shared libc) need real
>> exception handling support that may not be available with a bootstrap
>> compiler.  If the former, linking static-stubs.o into more binaries (when
>> they are linked statically) may help.  If the latter, conditioning the
>> -lgcc_eh support on --disable-shared would at least avoid regressing the
>> bootstrap situation.
>
> Here is the updated patch.
>

PING.

> --
> H.J.
> --
> 2012-09-04  H.J. Lu  <hongjiu.lu@intel.com>
>
>         [BZ #13679]
>         * Makeconfig (+link): Defined as $(+link-static) if
>         $(build-shared) isn't yes.
>         (link-tests): Defined as $(+link-static-tests) if $(build-shared)
>         isn't yes.
>         (static-gnulib): Add -lgcc_eh if $(build-shared) isn't yes.
>
> diff --git a/Makeconfig b/Makeconfig
> index 1c87973..cb38015 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -411,22 +411,6 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
>  LDFLAGS-rtld += $(hashstyle-LDFLAGS)
>  endif
>
> -# Commands for linking programs with the C library.
> -ifndef +link
> -+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
> -             $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
> -             $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
> -             $(addprefix $(csu-objpfx),$(start-installed-name)) \
> -             $(+preinit) $(+prector) \
> -             $(filter-out $(addprefix $(csu-objpfx),start.o \
> -                                                    $(start-installed-name))\
> -                          $(+preinit) $(link-extra-libs) \
> -                          $(common-objpfx)libc% $(+postinit),$^) \
> -             $(link-extra-libs)
> -+link-after-libc = $(+postctor) $(+postinit)
> -+link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
> -+link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
> -endif
>  # Command for linking PIE programs with the C library.
>  ifndef +link-pie
>  +link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
> @@ -457,6 +441,27 @@ ifndef +link-static
>  +link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
>                      $(+link-static-after-libc)
>  endif
> +# Commands for linking programs with the C library.
> +ifndef +link
> +ifeq (yes,$(build-shared))
> ++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
> +             $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
> +             $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
> +             $(addprefix $(csu-objpfx),$(start-installed-name)) \
> +             $(+preinit) $(+prector) \
> +             $(filter-out $(addprefix $(csu-objpfx),start.o \
> +                                                    $(start-installed-name))\
> +                          $(+preinit) $(link-extra-libs) \
> +                          $(common-objpfx)libc% $(+postinit),$^) \
> +             $(link-extra-libs)
> ++link-after-libc = $(+postctor) $(+postinit)
> ++link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
> ++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
> +else
> ++link = $(+link-static)
> ++link-tests = $(+link-static-tests)
> +endif
> +endif
>  # Command for statically linking bounded-pointer programs with the C library.
>  ifndef +link-bounded
>  +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@
> \
> @@ -568,7 +573,14 @@ gnulib-arch =
>  gnulib = -lgcc $(gnulib-arch)
>  gnulib-tests := -lgcc $(libgcc_eh)
>  static-gnulib-arch =
> +# By default, elf/static-stubs.o, instead of -lgcc_eh, is used to
> +# statically link programs.  When --disable-shared is used, we use
> +# -lgcc_eh since elf/static-stubs.o isn't sufficient.
> +ifeq (yes,$(build-shared))
>  static-gnulib = -lgcc $(static-gnulib-arch)
> +else
> +static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch)
> +endif
>  static-gnulib-tests := -lgcc -lgcc_eh $(libunwind)
>  libc.so-gnulib := -lgcc
>  endif



-- 
H.J.


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