[PATCH v2] elf: Avoid nested functions in the loader (all ports) [BZ #27220]

Florian Weimer fweimer@redhat.com
Fri Sep 24 05:58:27 GMT 2021


* Fāng-ruì Sòng:

>> I have not
>> reviewed the patch in detail and won't probably come to it for quite
>> some time, but the project looks a lot less scary now.
>
> Ugh😹 Isn't the patch in a ready-to-push state now ?

It does not build on some !PI_STATIC_AND_HIDDEN targets.  The error
looks like this on those that I have checked:

../sysdeps/m68k/dl-machine.h: In function ‘elf_machine_rela’:
rtld.c:506:24: error: ‘info’ undeclared (first use in this function); did you mean ‘dlinfo’?
  506 | # define bootstrap_map info.l
      |                        ^~~~
rtld.c:514:25: note: in expansion of macro ‘bootstrap_map’
  514 | #define BOOTSTRAP_MAP (&bootstrap_map)
      |                         ^~~~~~~~~~~~~
rtld.c:515:54: note: in expansion of macro ‘BOOTSTRAP_MAP’
  515 | #define RESOLVE_MAP(map, scope, sym, version, flags) BOOTSTRAP_MAP
      |                                                      ^~~~~~~~~~~~~
../sysdeps/m68k/dl-machine.h:232:34: note: in expansion of macro ‘RESOLVE_MAP’
  232 |       struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version,
      |                                  ^~~~~~~~~~~
rtld.c:506:24: note: each undeclared identifier is reported only once for each function it appears in
  506 | # define bootstrap_map info.l
      |                        ^~~~
rtld.c:514:25: note: in expansion of macro ‘bootstrap_map’
  514 | #define BOOTSTRAP_MAP (&bootstrap_map)
      |                         ^~~~~~~~~~~~~
rtld.c:515:54: note: in expansion of macro ‘BOOTSTRAP_MAP’
  515 | #define RESOLVE_MAP(map, scope, sym, version, flags) BOOTSTRAP_MAP
      |                                                      ^~~~~~~~~~~~~
../sysdeps/m68k/dl-machine.h:232:34: note: in expansion of macro ‘RESOLVE_MAP’
  232 |       struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version,
      |                                  ^~~~~~~~~~~

mipsel-linux-gnu has a different error:

In file included from dynamic-link.h:94,
                 from dl-reloc.c:189:
../sysdeps/mips/dl-machine.h: In function ‘elf_machine_got_rel’:
../sysdeps/mips/dl-machine.h:840:8: error: macro "RESOLVE_MAP" requires 5 arguments, but only 3 given
  840 |                 *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_JUMP_SLOT);
      |        ^        ~~~~~~~
dl-reloc.c:166: note: macro "RESOLVE_MAP" defined here
  166 | #define RESOLVE_MAP(l, scope, ref, version, r_type)                           \
      | 
In file included from dynamic-link.h:94,
                 from dl-reloc.c:189:
../sysdeps/mips/dl-machine.h:791:17: error: ‘RESOLVE_MAP’ undeclared (first use in this function)
  791 |       sym_map = RESOLVE_MAP (&ref, version, reloc);                       \
      |                 ^~~~~~~~~~~
../sysdeps/mips/dl-machine.h:840:24: note: in expansion of macro ‘RESOLVE_GOTSYM’
  840 |                 *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_JUMP_SLOT);
      |                        ^~~~~~~~~~~~~~
../sysdeps/mips/dl-machine.h:791:17: note: each undeclared identifier is reported only once for each function it appears in
  791 |       sym_map = RESOLVE_MAP (&ref, version, reloc);                       \
      |                 ^~~~~~~~~~~
../sysdeps/mips/dl-machine.h:840:24: note: in expansion of macro ‘RESOLVE_GOTSYM’
  840 |                 *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_JUMP_SLOT);
      |                        ^~~~~~~~~~~~~~
../sysdeps/mips/dl-machine.h:843:8: error: macro "RESOLVE_MAP" requires 5 arguments, but only 3 given
  843 |             *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_32);
      |        ^    ~~~~
dl-reloc.c:166: note: macro "RESOLVE_MAP" defined here
  166 | #define RESOLVE_MAP(l, scope, ref, version, r_type)                           \
      | 
In file included from dynamic-link.h:94,
                 from dl-reloc.c:189:
../sysdeps/mips/dl-machine.h:846:8: error: macro "RESOLVE_MAP" requires 5 arguments, but only 3 given
  846 |         *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_32);
      |        ^~~~~~~~~
dl-reloc.c:166: note: macro "RESOLVE_MAP" defined here
  166 | #define RESOLVE_MAP(l, scope, ref, version, r_type)                           \
      | 
In file included from dynamic-link.h:94,
                 from dl-reloc.c:189:
../sysdeps/mips/dl-machine.h:855:8: error: macro "RESOLVE_MAP" requires 5 arguments, but only 3 given
  855 |             *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_JUMP_SLOT);
      |        ^    ~~~~
dl-reloc.c:166: note: macro "RESOLVE_MAP" defined here
  166 | #define RESOLVE_MAP(l, scope, ref, version, r_type)                           \
      | 
In file included from dynamic-link.h:94,
                 from dl-reloc.c:189:
../sysdeps/mips/dl-machine.h:863:8: error: macro "RESOLVE_MAP" requires 5 arguments, but only 3 given
  863 |         *got = RESOLVE_GOTSYM (sym, vernum, symidx, R_MIPS_32);
      |        ^~~~~~~~~
dl-reloc.c:166: note: macro "RESOLVE_MAP" defined here
  166 | #define RESOLVE_MAP(l, scope, ref, version, r_type)                           \
      | 

> ---
>
> Looks like hppa-linux-gnu may be broken in master:
>
> % (cd /tmp/glibc-many/src/glibc/; git checkout master)
> % cd ~/Dev/glibc
> % scripts/build-many-glibcs.py /tmp/glibc-many compilers hppa-linux-gnu
> ...
> % /tmp/glibc-many/install/compilers/hppa-linux-gnu/sysroot/lib/ld.so.1
>   # using qemu-hppa-static 6.1.0
> Inconsistency detected by ld.so: rtld.c: 1593: dl_main: Assertion
> `GL(dl_rtld_map).l_libname' failed!

I'm going to look into that.

Thanks,
Florian



More information about the Libc-alpha mailing list