[00/14] Move libdl into libc

Message ID cover.1621446837.git.fweimer@redhat.com
Headers
Series Move libdl into libc |

Message

Florian Weimer May 19, 2021, 6:03 p.m. UTC
  This patch series removes all code from libdl.so.2.  I have not removed
the shared object itself because I want to mirror what we are doing for
libpthread, and the discussion there is still ongoing.

There is an oddity because for several targets, the baseline ABI version
for libdl is GLIBC_2.0 and not GLIBC_2.2.  This cannot be expressed with
the existing Versions framework.  Since the affected targets are more or
less on the way out anyway (hppa, ia64, sh, sparc64), I didn't
overdesign the solution and emitted the required version nodes directly
in scripts/versions.awk.

This move also happens on Hurd because the implementation isn't
separate.

This fixes a POSIX conformance issue with the c99 command because POSIX
requires that dlopen etc. are available without -ldl.

Tested on i386-linux-gnu and x86_64-linux-gnu.  Built with
build-many-glibcs.py (including most intermediate steps).

Thanks,
Florian

Florian Weimer (14):
  stdio-common: Remove _IO_vfwscanf
  Add libc ABI extension kludge for baseline-violating libdl symbols
  dlfcn: Move dlerror into libc
  dlfcn: Move dlclose into libc
  dlfcn: Move dladdr into libc
  dlfcn: Move dlsym into libc
  dlfcn: Move dlmopen into libc
  dlfcn: Move dladdr1 into libc
  dlfcn: Move dlinfo into libc
  dlfcn: Move dlvsym into libc
  dlfcn: Move dlopen into libc
  dlfcn: Cleanups after -ldl is no longer required
  dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2
  dlfcn: Rework static dlopen hooks

 Makeconfig                                    |   6 -
 dlfcn/Makefile                                |  48 ++---
 dlfcn/Versions                                |  42 ++++-
 dlfcn/dladdr.c                                |  24 +--
 dlfcn/dladdr1.c                               |  24 +--
 dlfcn/dlclose.c                               |  32 +---
 dlfcn/dlerror.c                               |  67 ++-----
 dlfcn/dlfcn.c                                 |  41 +++--
 dlfcn/dlinfo.c                                |  47 ++---
 dlfcn/dlmopen.c                               |  67 +++----
 dlfcn/dlopen.c                                |  76 ++++----
 dlfcn/dlopenold.c                             |   6 +-
 dlfcn/dlsym.c                                 |  59 +++---
 dlfcn/dlvsym.c                                |  67 ++++---
 dlfcn/modstatic2.c                            |   3 +-
 dlfcn/sdladdr.c                               |   1 -
 dlfcn/sdladdr1.c                              |   1 -
 dlfcn/sdlclose.c                              |   1 -
 dlfcn/sdlerror.c                              |   1 -
 dlfcn/sdlinfo.c                               |   1 -
 dlfcn/sdlmopen.c                              |   1 -
 dlfcn/sdlopen.c                               |   1 -
 dlfcn/sdlsym.c                                |   1 -
 dlfcn/sdlvsym.c                               |   1 -
 dlfcn/tststatic2.c                            |   3 +-
 elf/Makefile                                  | 173 +++---------------
 elf/Versions                                  |   1 -
 elf/dl-libc.c                                 |  73 +-------
 elf/dl-sym.c                                  |   3 +-
 elf/rtld_static_init.c                        |  18 ++
 htl/Makefile                                  |   1 -
 iconvdata/Makefile                            |   1 -
 include/dlfcn.h                               |  81 +++-----
 malloc/Makefile                               |   3 -
 misc/Makefile                                 |   2 -
 nptl/Makefile                                 |  10 +-
 nss/Makefile                                  |   5 -
 resolv/Makefile                               |  19 +-
 scripts/versions.awk                          |  36 +++-
 stdio-common/Makefile                         |   2 +-
 stdio-common/iovfwscanf.c                     |  38 ----
 stdlib/Makefile                               |   8 +-
 string/Makefile                               |   1 -
 sysdeps/generic/ldsodefs.h                    |   3 +
 sysdeps/mach/hurd/i386/libc.abilist           |  18 ++
 sysdeps/mach/hurd/i386/libdl.abilist          |  12 +-
 sysdeps/mips/Makefile                         |   1 -
 sysdeps/pthread/Makefile                      |   6 +-
 sysdeps/unix/sysv/linux/aarch64/libc.abilist  |  18 ++
 sysdeps/unix/sysv/linux/aarch64/libdl.abilist |  10 +-
 sysdeps/unix/sysv/linux/alpha/libc.abilist    |  19 ++
 sysdeps/unix/sysv/linux/alpha/libdl.abilist   |  14 +-
 sysdeps/unix/sysv/linux/arc/libc.abilist      |  18 ++
 sysdeps/unix/sysv/linux/arc/libdl.abilist     |  10 +-
 sysdeps/unix/sysv/linux/arm/be/libc.abilist   |  18 ++
 sysdeps/unix/sysv/linux/arm/be/libdl.abilist  |  10 +-
 sysdeps/unix/sysv/linux/arm/le/libc.abilist   |  18 ++
 sysdeps/unix/sysv/linux/arm/le/libdl.abilist  |  10 +-
 sysdeps/unix/sysv/linux/csky/libc.abilist     |  18 ++
 sysdeps/unix/sysv/linux/csky/libdl.abilist    |  10 +-
 sysdeps/unix/sysv/linux/hppa/Versions         |   1 +
 sysdeps/unix/sysv/linux/hppa/libc.abilist     |  19 ++
 sysdeps/unix/sysv/linux/hppa/libdl.abilist    |  14 +-
 sysdeps/unix/sysv/linux/i386/libc.abilist     |  19 ++
 sysdeps/unix/sysv/linux/i386/libdl.abilist    |  14 +-
 sysdeps/unix/sysv/linux/ia64/Versions         |   1 +
 sysdeps/unix/sysv/linux/ia64/libc.abilist     |  19 ++
 sysdeps/unix/sysv/linux/ia64/libdl.abilist    |  14 +-
 .../sysv/linux/m68k/coldfire/libc.abilist     |  18 ++
 .../sysv/linux/m68k/coldfire/libdl.abilist    |  10 +-
 .../unix/sysv/linux/m68k/m680x0/libc.abilist  |  19 ++
 .../unix/sysv/linux/m68k/m680x0/libdl.abilist |  14 +-
 .../sysv/linux/microblaze/be/libc.abilist     |  18 ++
 .../sysv/linux/microblaze/be/libdl.abilist    |  10 +-
 .../sysv/linux/microblaze/le/libc.abilist     |  18 ++
 .../sysv/linux/microblaze/le/libdl.abilist    |  10 +-
 .../sysv/linux/mips/mips32/fpu/libc.abilist   |  19 ++
 .../unix/sysv/linux/mips/mips32/libdl.abilist |  14 +-
 .../sysv/linux/mips/mips32/nofpu/libc.abilist |  19 ++
 .../unix/sysv/linux/mips/mips64/libdl.abilist |  14 +-
 .../sysv/linux/mips/mips64/n32/libc.abilist   |  19 ++
 .../sysv/linux/mips/mips64/n64/libc.abilist   |  19 ++
 sysdeps/unix/sysv/linux/nios2/libc.abilist    |  18 ++
 sysdeps/unix/sysv/linux/nios2/libdl.abilist   |  10 +-
 .../linux/powerpc/powerpc32/fpu/libc.abilist  |  19 ++
 .../linux/powerpc/powerpc32/libdl.abilist     |  14 +-
 .../powerpc/powerpc32/nofpu/libc.abilist      |  19 ++
 .../linux/powerpc/powerpc64/be/libc.abilist   |  18 ++
 .../linux/powerpc/powerpc64/be/libdl.abilist  |  12 +-
 .../linux/powerpc/powerpc64/le/libc.abilist   |  18 ++
 .../linux/powerpc/powerpc64/le/libdl.abilist  |  10 +-
 .../unix/sysv/linux/riscv/rv32/libc.abilist   |  18 ++
 .../unix/sysv/linux/riscv/rv32/libdl.abilist  |  10 +-
 .../unix/sysv/linux/riscv/rv64/libc.abilist   |  18 ++
 .../unix/sysv/linux/riscv/rv64/libdl.abilist  |  10 +-
 .../unix/sysv/linux/s390/s390-32/libc.abilist |  19 ++
 .../sysv/linux/s390/s390-32/libdl.abilist     |  14 +-
 .../unix/sysv/linux/s390/s390-64/libc.abilist |  18 ++
 .../sysv/linux/s390/s390-64/libdl.abilist     |  12 +-
 sysdeps/unix/sysv/linux/sh/Versions           |   1 +
 sysdeps/unix/sysv/linux/sh/be/libc.abilist    |  19 ++
 sysdeps/unix/sysv/linux/sh/be/libdl.abilist   |  14 +-
 sysdeps/unix/sysv/linux/sh/le/libc.abilist    |  19 ++
 sysdeps/unix/sysv/linux/sh/le/libdl.abilist   |  14 +-
 .../sysv/linux/sparc/sparc32/libc.abilist     |  19 ++
 .../sysv/linux/sparc/sparc32/libdl.abilist    |  14 +-
 .../unix/sysv/linux/sparc/sparc64/Versions    |   1 +
 .../sysv/linux/sparc/sparc64/libc.abilist     |  19 ++
 .../sysv/linux/sparc/sparc64/libdl.abilist    |  14 +-
 .../unix/sysv/linux/x86_64/64/libc.abilist    |  18 ++
 .../unix/sysv/linux/x86_64/64/libdl.abilist   |  12 +-
 .../unix/sysv/linux/x86_64/x32/libc.abilist   |  18 ++
 .../unix/sysv/linux/x86_64/x32/libdl.abilist  |  10 +-
 sysdeps/x86/Makefile                          |  13 +-
 114 files changed, 1131 insertions(+), 962 deletions(-)
 delete mode 100644 dlfcn/sdladdr.c
 delete mode 100644 dlfcn/sdladdr1.c
 delete mode 100644 dlfcn/sdlclose.c
 delete mode 100644 dlfcn/sdlerror.c
 delete mode 100644 dlfcn/sdlinfo.c
 delete mode 100644 dlfcn/sdlmopen.c
 delete mode 100644 dlfcn/sdlopen.c
 delete mode 100644 dlfcn/sdlsym.c
 delete mode 100644 dlfcn/sdlvsym.c
 delete mode 100644 stdio-common/iovfwscanf.c
  

Comments

Florian Weimer May 21, 2021, 7:17 p.m. UTC | #1
* Florian Weimer via Libc-alpha:

> This patch series removes all code from libdl.so.2.  I have not removed
> the shared object itself because I want to mirror what we are doing for
> libpthread, and the discussion there is still ongoing.
>
> There is an oddity because for several targets, the baseline ABI version
> for libdl is GLIBC_2.0 and not GLIBC_2.2.  This cannot be expressed with
> the existing Versions framework.  Since the affected targets are more or
> less on the way out anyway (hppa, ia64, sh, sparc64), I didn't
> overdesign the solution and emitted the required version nodes directly
> in scripts/versions.awk.
>
> This move also happens on Hurd because the implementation isn't
> separate.
>
> This fixes a POSIX conformance issue with the c99 command because POSIX
> requires that dlopen etc. are available without -ldl.
>
> Tested on i386-linux-gnu and x86_64-linux-gnu.  Built with
> build-many-glibcs.py (including most intermediate steps).

I should have mentioned that I'm removing the strange double-build with
those dlfcn/sdl*.c files.  This is why the files have somewhat different
layout after the move.  I do not see any value in the dlfcn/sdl*.c
construct.  The new version relies on compiler inlining to remove
redudant functions.

Thanks,
Florian
  
Florian Weimer May 22, 2021, 5:16 p.m. UTC | #2
* Florian Weimer via Libc-alpha:

> * Florian Weimer via Libc-alpha:
>
>> This patch series removes all code from libdl.so.2.  I have not removed
>> the shared object itself because I want to mirror what we are doing for
>> libpthread, and the discussion there is still ongoing.
>>
>> There is an oddity because for several targets, the baseline ABI version
>> for libdl is GLIBC_2.0 and not GLIBC_2.2.  This cannot be expressed with
>> the existing Versions framework.  Since the affected targets are more or
>> less on the way out anyway (hppa, ia64, sh, sparc64), I didn't
>> overdesign the solution and emitted the required version nodes directly
>> in scripts/versions.awk.
>>
>> This move also happens on Hurd because the implementation isn't
>> separate.
>>
>> This fixes a POSIX conformance issue with the c99 command because POSIX
>> requires that dlopen etc. are available without -ldl.
>>
>> Tested on i386-linux-gnu and x86_64-linux-gnu.  Built with
>> build-many-glibcs.py (including most intermediate steps).
>
> I should have mentioned that I'm removing the strange double-build with
> those dlfcn/sdl*.c files.  This is why the files have somewhat different
> layout after the move.  I do not see any value in the dlfcn/sdl*.c
> construct.  The new version relies on compiler inlining to remove
> redudant functions.

And I've pushed a rebase series to the fw/libdl branch.

Florian