https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88150

--- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot 
Uni-Bielefeld.DE> ---
A couple of issues in the patch bear commenting:

* The core/sys/solaris/dlfcn.d change was needed to silence

/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/sections_elf_shared.d:628:15:
error: @nogc function 'rt.sections_elf_shared.linkMapForHandle' cannot call
non-@nogc function 'core.sys.solaris.dlfcn.dlinfo'
  628 |         dlinfo(handle, RTLD_DI_LINKMAP, &map) == 0 || assert(0);
      |               ^

/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/sections_elf_shared.d:977:15:
error: @nogc function 'rt.sections_elf_shared.handleForAddr' cannot call
non-@nogc function 'core.sys.solaris.dlfcn.dladdr'
  977 |     if (dladdr(addr, &info) != 0)
      |               ^

* The core/sys/solaris/sys/link.d change was required against

/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/sections_elf_shared.d:692:48:
error: need 'this' for 'd_ptr' of type 'uint'
  692 |                     strtab = cast(const(char)*)dyn.d_un.d_ptr; //
FIXME: Which one?
      |                                                ^
/vol/gcc/src/hg/trunk/local/libphobos/libdruntime/rt/sections_elf_shared.d:705:34:
error: need 'this' for 'd_val' of type 'uint'
  705 |             auto name = strtab + dyn.d_un.d_val;
      |                                  ^


  This didn't tell me anything and only after I'd closely compared the
  solaris and freebsd versions did I see the difference.

* Enabling the compilation of rt/bss_section.c on Solaris was needed to
  get definitions for rt_get_bss_start and rt_get_end.  I don't know
  what the upstream policy for linelength is, so I just use an overlong
  line here.

* As the FIXME comment says, I don't know if the _Dmodule_ref in
  rt/sections_elf_shared.d is good for anything.  I couldn't find any
  definition.

* The Solaris struct dl_phdr_info doesn't have a dlpi_tls_modid member.
  For now, I've hacked around this to make things compile.
  <rtld_db.h>'s rd_loadobj_t has a rt_tlsmodid member; maybe it's
  possible to use that.  I'll check with the Solaris linker engineers if
  I get stuck.

* Besides, dl_iterate_phdr was only introduced in some (late) Solaris 10
  patch and only lives in libdl there, not libc as on Solaris 11.
  Enabling libphobos will have to check for that condition.

* Right now, we have three identical versions of findDSOInfoForAddr.  It
  may be useful to unify them.

* Solaris 10 lacks getprogname; one could just return a hardcoded
  "a.out" instead as a fallback.

* I don't know details about the files in core/sys/solaris: according to
  their comments they were produced on/for Illumos, and Oracle Solaris
  may well have deviated since.  I'll have to compare them in detail at
  some point.  No idea if they were handwritten or generated.

* Solaris <sys/elf.h> includes <sys/elf_SPARC.h>, <sys/elf_386.h>, and
  <sys/elf/amd64.h> as appropriate.  It seems to me that
  core/sys/solaris/sys/elf.d should do the same.

Reply via email to