Bryan Ischo
2011-08-30 19:51:13 UTC
Hello. gcc builds libgcc_sh according to these rules in its
otherwise, it is added to libgcc. And this confirms what I am seeing,
which is that gcc built with --disable-shared does not produce a
libgcc_eh.a (totally weird that if shared is enabled, libgcc_eh.a, which
is not a shared library, does get built).
Now glibc has this in its Makeconfig:
# The static libraries.
ifeq (yes,$(build-static))
link-libc-static = $(common-objpfx)libc.a $(static-gnulib)
$(common-objpfx)libc.a
else
ifeq (yes,$(build-shared))
# We can try to link the programs with lib*_pic.a...
link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
endif
endif
link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib)
$(common-objpfx)libc_b.a
ifndef gnulib
ifneq ($(have-cc-with-libunwind),yes)
libunwind =
else
libunwind = -lunwind
endif
ifneq ($(have-as-needed),yes)
libgcc_eh := -lgcc_eh $(libunwind)
else
libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind)
-Wl,--no-as-needed
endif
gnulib := -lgcc $(libgcc_eh)
static-gnulib := -lgcc -lgcc_eh $(libunwind)
libc.so-gnulib := -lgcc
endif
Note that static-gnulib is set to include -lgcc_eh; but doesn't this
conflict with gcc's Makefile? If gcc was built statically, then
libgcc_eh.a does not exist and glibc should only include -lgcc.
I'm thinking that maybe it's actually something that should be detected;
glibc doesn't know if gcc built libgcc_eh.a or not and probably
shouldn't be assuming that it did; I think that if gcc was built with
shared libraries then there will be a separate libgcc.a and libgcc_eh.a,
but if not, then there will only be libgcc.a. Whether or not glibc is
building shared libraries, static libraries or whatever, I don't think
it should be assuming what libraries are available from gcc since gcc
can produce different libraries under different build configurations.
Thanks,
Bryan
ifeq ($(enable_shared),yes)
libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir
$(LIB2ADDEHSTATIC))))libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir
libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir
$(LIB2ADDEHSHARED))))iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
include $(iterator)
else
# Not shared. LIB2ADDEH are added to libgcc.a.
libgcc-objects += $(addsuffix $(objext),$(basename $(notdir
$(LIB2ADDEH))))include $(iterator)
else
# Not shared. LIB2ADDEH are added to libgcc.a.
libgcc-objects += $(addsuffix $(objext),$(basename $(notdir
iter-items := $(LIB2ADDEH)
include $(iterator)
endif
Note that if enabled_shared is set to yes, then libgcc-eh is built;include $(iterator)
endif
otherwise, it is added to libgcc. And this confirms what I am seeing,
which is that gcc built with --disable-shared does not produce a
libgcc_eh.a (totally weird that if shared is enabled, libgcc_eh.a, which
is not a shared library, does get built).
Now glibc has this in its Makeconfig:
# The static libraries.
ifeq (yes,$(build-static))
link-libc-static = $(common-objpfx)libc.a $(static-gnulib)
$(common-objpfx)libc.a
else
ifeq (yes,$(build-shared))
# We can try to link the programs with lib*_pic.a...
link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a
endif
endif
link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib)
$(common-objpfx)libc_b.a
ifndef gnulib
ifneq ($(have-cc-with-libunwind),yes)
libunwind =
else
libunwind = -lunwind
endif
ifneq ($(have-as-needed),yes)
libgcc_eh := -lgcc_eh $(libunwind)
else
libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind)
-Wl,--no-as-needed
endif
gnulib := -lgcc $(libgcc_eh)
static-gnulib := -lgcc -lgcc_eh $(libunwind)
libc.so-gnulib := -lgcc
endif
Note that static-gnulib is set to include -lgcc_eh; but doesn't this
conflict with gcc's Makefile? If gcc was built statically, then
libgcc_eh.a does not exist and glibc should only include -lgcc.
I'm thinking that maybe it's actually something that should be detected;
glibc doesn't know if gcc built libgcc_eh.a or not and probably
shouldn't be assuming that it did; I think that if gcc was built with
shared libraries then there will be a separate libgcc.a and libgcc_eh.a,
but if not, then there will only be libgcc.a. Whether or not glibc is
building shared libraries, static libraries or whatever, I don't think
it should be assuming what libraries are available from gcc since gcc
can produce different libraries under different build configurations.
Thanks,
Bryan