[libphobos] Use sections_elf_shared.d on Solaris 11.5 (PR d/88150)

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Tue Jan 29 10:37:00 GMT 2019


I've successfully been using a late prototype of an implementation of
the dlpi_tls_modid field of struct dl_phdr_info on Solaris 11.5 Beta.
This allowed me to get pretty reasonable test results using
sections_elf_shared.d on Solaris.

This pretty straightforward patch implements this.  Only a few points
are worth mentioning:

* libdruntime/rt/bss_sections.c refers to __bss_start, which only gld
  defines.  Unfortunately, it's marked weak, so the absence with Solaris
  ld went unnoticed at first.  Lacking an exact equivalent, I'm using
  _edata instead, which is pretty close modulo section alignment.

* As detailed in the PR, not dlclose()ing the handle in handleForName is
  necessary to avoid an assertion failure.

* I'm removing sections_solaris.d since it wouldn't even compile and
  seems pretty useless.

This patch gave me the following testsuite results on Solaris 11.5/x86
(a few more minor testsuite fixes were included, too):

		=== gdc tests ===


Running target unix
FAIL: gdc.test/runnable/nulltype.d   execution test
FAIL: gdc.test/runnable/nulltype.d -O2   execution test
FAIL: gdc.test/runnable/nulltype.d -O2 -shared-libphobos   execution test
FAIL: gdc.test/runnable/nulltype.d -g   execution test
FAIL: gdc.test/runnable/nulltype.d -g -O2   execution test
FAIL: gdc.test/runnable/nulltype.d -g -O2 -shared-libphobos   execution test
FAIL: gdc.test/runnable/nulltype.d -g -shared-libphobos   execution test
FAIL: gdc.test/runnable/nulltype.d -shared-libphobos   execution test

		=== gdc Summary for unix ===

# of expected passes		30785
# of unexpected failures	8

Running target unix/-m64

		=== gdc Summary for unix/-m64 ===

# of expected passes		30793

		=== gdc Summary ===

# of expected passes		61578
# of unexpected failures	8
/var/gcc/gcc-9.0.1-20190128/11.5-gcc-gas-libphobos/gcc/gdc  version 9.0.1 20190128 (experimental) [trunk revision 268335] (GCC) 

		=== libphobos tests ===


Running target unix
FAIL: libphobos.shared/load.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/load_13414.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/finalize.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/linkD.c lib.so -ldl -pthread execution test
FAIL: libphobos.unittests/druntime/shared/core.sync.mutex
FAIL: libphobos.unittests/druntime/shared/core.time

		=== libphobos Summary for unix ===

# of expected passes		119
# of unexpected failures	6

Running target unix/-m64
FAIL: libphobos.shared/load.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/load_13414.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/finalize.d -shared-libphobos -ldl execution test
FAIL: libphobos.shared/linkD.c lib.so -ldl -pthread execution test
FAIL: libphobos.unittests/druntime/shared/ld.so.1:
FAIL: libphobos.unittests/druntime/shared/unittest:
FAIL: libphobos.unittests/druntime/shared/fatal:
FAIL: libphobos.unittests/druntime/shared/libgdruntime_t.so.0:
FAIL: libphobos.unittests/druntime/shared/open
FAIL: libphobos.unittests/druntime/shared/failed:
FAIL: libphobos.unittests/druntime/shared/No
FAIL: libphobos.unittests/druntime/shared/such
FAIL: libphobos.unittests/druntime/shared/file
FAIL: libphobos.unittests/druntime/shared/or
FAIL: libphobos.unittests/druntime/shared/directory

		=== libphobos Summary for unix/-m64 ===

# of expected passes		78
# of unexpected failures	15

		=== libphobos Summary ===

# of expected passes		197
# of unexpected failures	21

The 32-bit nulltype.d failures occur on Linux, too (PR d/87824), and the
64-bit libphobos.unittests/druntime/shared failures happen because
libgdruntime_t.so.0 is only built for the default multilib.  The
libphobos.shared failures clearly bear investigating.

For the amd64 results, I needed a separate patch to workaround an ld
bug, to be submitted shortly.

While I did run a sparc-sun-solaris2.11 bootstrap, too, results are
pretty useless due to PR d/88462 (the minfo alignment issue).

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-11-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libphobos:
	PR d/88150
	* libdruntime/core/sys/solaris/dlfcn.d: Mark @nogc.
	* libdruntime/core/sys/solaris/link.d (struct dl_phdr_info):
	Declare dlpi_tls_modid, dlpi_tls_data members.
	* libdruntime/core/sys/solaris/sys/link.d (Elf32_Dyn, Elf64_Dyn):
	Fix syntax.
	* libdruntime/rt/sections_elf_shared.d [Solaris] (SharedELF): Set
	to true.
	Import core.sys.solaris.dlfcn, core.sys.solaris.link,
	core.sys.solaris.sys.elf, core.sys.solaris.sys.link.
	(dummy_ref): Declare.
	(initSections): Initialize dummy_ref.
	(_Dmodule_ref): Declare.
	(getDependencies): Set strtab.
	(handleForName): Don't dlclose handle.
	(findDSOInfoForAddr): New function.
	(getprogname): Declare.
	(progname): Use it.
	(getCopyRelocSection): Set exeBaseAddr.
	* libdruntime/rt/sections.d [Solaris]: Import
	rt.sections_elf_shared instead of rt.sections_solaris.

	* libdruntime/rt/bss_section.c: Also build if __sun__ && __svr4__.
	[__sun__ && __svr4__] (_edata): Declare.
	(rt_get_bss_start): Return &_edata.

	* libdruntime/rt/sections_solaris.d: Remove.
	* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Remove
	rt/sections_solaris.d.
	* libdruntime/Makefile.in: Regenerate.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-libphobos-sections_elf_shared.patch
Type: text/x-patch
Size: 11511 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190129/84013a32/attachment.bin>


More information about the Gcc-patches mailing list