[Bug build/26102] New: Consider removing libg.a from glibc (or add a doc why it's needed).

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug build/26102] New: Consider removing libg.a from glibc (or add a doc why it's needed).

Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26102

            Bug ID: 26102
           Summary: Consider removing libg.a from glibc (or add a doc why
                    it's needed).
           Product: glibc
           Version: 2.31
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: slyfox at inbox dot ru
                CC: carlos at redhat dot com, roland at gnu dot org
  Target Milestone: ---

Today I stumbled on '/usr/lib64/libg.a' static library installed by glibc-2.31
on x86_64-linux. Is it really needed for anything?

It looks like it's a very old dummy library:

"""
    Fri Jun 24 01:41:41 1994  Roland McGrath  ([hidden email])
        * misc/Makefile (install-lib): Add libg.a.
        ($(objpfx)libg.a): New rule; use make-dummy-lib.
        (lib): Depend on $(objpfx)libg.a
"""

I was not able to find any references outside gcc on some ports:

"""
gcc/config/rs6000/aix61.h:   %{!maix64:%{!shared:%{g*:-lg}}}\
gcc/config/rs6000/aix71.h:   %{!maix64:%{!shared:%{g*:-lg}}}\
gcc/config/rs6000/aix72.h:   %{!maix64:%{!shared:%{g*:-lg}}}\
gcc/config/rtems.h:#define STD_LIB_SPEC "%{!shared:%{g*:-lg}
%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
gcc/config/vax/vax.h:   Also use -lg for the sake of dbx.  */
gcc/config/vax/vax.h:#define LIB_SPEC "%{g:-lg}\
...
gcc/gcc.c:#define LIB_SPEC "%{!shared:%{g*:-lg}
%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}"
"""

It looks like it's a generic expected-to-have library, but no linux targets
define it:

"""
$ for cc in /usr/bin/*gcc; do echo $cc; $cc -dumpspecs | grep -E --
'-lg[^a-z]'; done
/usr/bin/aarch64-gentoo-linux-musl-gcc
/usr/bin/aarch64-unknown-linux-gnu-gcc
/usr/bin/aarch64_be-unknown-linux-gnu-gcc
/usr/bin/alpha-unknown-linux-gnu-gcc

/usr/bin/arm-none-eabi-gcc
%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}

/usr/bin/armv5tel-softfloat-linux-gnueabi-gcc
/usr/bin/armv6j-unknown-linux-gnueabihf-gcc
/usr/bin/armv6zk-unknown-linux-musleabihf-gcc
/usr/bin/armv7a-unknown-linux-gnueabihf-gcc
/usr/bin/avr-gcc
/usr/bin/hppa-unknown-linux-gnu-gcc
/usr/bin/hppa2.0-unknown-linux-gnu-gcc
/usr/bin/hppa64-unknown-linux-gnu-gcc
/usr/bin/i686-w64-mingw32-gcc
/usr/bin/ia64-unknown-linux-gnu-gcc
/usr/bin/m68k-unknown-linux-gnu-gcc
/usr/bin/mips-unknown-linux-gnu-gcc
/usr/bin/mips64-unknown-linux-gnu-gcc
/usr/bin/mips64-unknown-linux-gnuabin64-gcc
/usr/bin/mips64el-unknown-linux-gnu-gcc
/usr/bin/mips64el-unknown-linux-gnuabin64-gcc
/usr/bin/mipsel-elf-gcc
/usr/bin/mipsel-unknown-linux-gnu-gcc

/usr/bin/mmix-gcc
%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}

/usr/bin/msp430-elf-gcc
/usr/bin/nios2-unknown-linux-gnu-gcc
/usr/bin/powerpc-unknown-linux-gnu-gcc
/usr/bin/powerpc64-unknown-linux-gnu-gcc
/usr/bin/powerpc64le-unknown-linux-gnu-gcc
/usr/bin/riscv64-unknown-linux-gnu-gcc
/usr/bin/s390-unknown-linux-gnu-gcc
/usr/bin/s390x-unknown-linux-gnu-gcc
/usr/bin/sh4-unknown-linux-gnu-gcc
/usr/bin/sparc-unknown-linux-gnu-gcc
/usr/bin/sparc64-unknown-linux-gnu-gcc
/usr/bin/vax-unknown-linux-gnu-gcc
/usr/bin/winegcc
/usr/bin/x86_64-HEAD-linux-gnu-gcc
/usr/bin/x86_64-UNREG-linux-gnu-gcc
/usr/bin/x86_64-gentoo-linux-musl-gcc
/usr/bin/x86_64-pc-linux-gnu-gcc
/usr/bin/x86_64-w64-mingw32-gcc
/usr/bin/xtensa-esp32-elf-gcc
"""

Note: only bare-metal/non-glibc targets refer it.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug build/26102] Consider removing libg.a from glibc (or add a doc why it's needed).

Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26102

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu.org

--- Comment #1 from Jim Wilson <wilson at gcc dot gnu.org> ---
30+ years ago, libg.a was the C library with debug info but without
optimization, and libc.a was the C library with optimization but without debug
info, because the compilers at the time could not optimize and emit debug info
at the same time.  Modern compilers don't have this problem anymore.  However,
there could be old packages that still have references to libg.a in their
Makefiles which would have to be fixed if glibc stopped installing libg.a.

Looks like the gcc linux port stopped using libg.a by default with -g back in
1995.  Other operating systems like Solaris slowly dropped libg.a over time.
The embedded stuff was never updated to stop using libg.a but with newlib for
instance libg.a is just a link to libc.a, or a copy if links aren't supported.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug build/26102] Consider removing libg.a from glibc (or add a doc why it's needed).

Sourceware - glibc-bugs mailing list
In reply to this post by Sourceware - glibc-bugs mailing list
https://sourceware.org/bugzilla/show_bug.cgi?id=26102

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com
              Flags|                            |security-

--
You are receiving this mail because:
You are on the CC list for the bug.