From fdfcb5353cc2b06fc80205cfcb3bc5ba25556264 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 26 Mar 2021 15:46:24 +0100 Subject: libphobos: Build all modules with -fversion=Shared when configured with --enable-shared The libgdruntime_convenience library was built with `-fversion=Shared', but the libphobos part wasn't when creating the static library. As there are no issues compiling in Shared code into the static library, to avoid mismatches the flag is now always present when --enable-shared is turned on. Libtool's compiler PIC D flag is now the combination of compiler PIC and D Shared flags, and AM_DFLAGS passes `-prefer-pic' to libtool unless --enable-shared is turned off. libphobos/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Substitute enable_shared, enable_static, and phobos_lt_pic_flag. * libdruntime/Makefile.am (AM_DFLAGS): Replace phobos_compiler_pic_flag with phobos_lt_pic_flags, and phobos_compiler_shared_flag. * libdruntime/Makefile.in: Regenerate. * src/Makefile.am (AM_DFLAGS): Replace phobos_compiler_pic_flag with phobos_lt_pic_flag, and phobos_compiler_shared_flag. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * testsuite/libphobos.druntime_shared/druntime_shared.exp: Remove -fversion=Shared and -fno-moduleinfo from default extra test flags. * testsuite/libphobos.phobos_shared/phobos_shared.exp: Likewise. * testsuite/testsuite_flags.in: Add phobos_compiler_shared_flag to --gdcflags. --- libphobos/testsuite/Makefile.in | 3 +++ libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp | 4 ++-- libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp | 4 ++-- libphobos/testsuite/testsuite_flags.in | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in index c38a468..51eb4ef 100644 --- a/libphobos/testsuite/Makefile.in +++ b/libphobos/testsuite/Makefile.in @@ -242,6 +242,8 @@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ +enable_shared = @enable_shared@ +enable_static = @enable_static@ exec_prefix = @exec_prefix@ gcc_version = @gcc_version@ gdc_include_dir = @gdc_include_dir@ @@ -271,6 +273,7 @@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ phobos_compiler_pic_flag = @phobos_compiler_pic_flag@ phobos_compiler_shared_flag = @phobos_compiler_shared_flag@ +phobos_lt_pic_flag = @phobos_lt_pic_flag@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ diff --git a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp index 6ca62a3..2b25613 100644 --- a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp +++ b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp @@ -34,8 +34,8 @@ dg-init # Main loop. foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]" - dg-runtest $test "-fversion=Shared -shared-libphobos" \ - "-fmain -fbuilding-libphobos-tests -fno-moduleinfo $version_flags" + dg-runtest $test "-shared-libphobos" \ + "-fmain -fbuilding-libphobos-tests $version_flags" set libphobos_test_name "" } diff --git a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp index da31304..3a847e7 100644 --- a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp +++ b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp @@ -45,8 +45,8 @@ dg-init # Main loop. foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../src $test]" - dg-runtest $test "-fversion=Shared -shared-libphobos" \ - "-fmain -fbuilding-libphobos-tests -fno-moduleinfo $version_flags" + dg-runtest $test "-shared-libphobos" \ + "-fmain -fbuilding-libphobos-tests $version_flags" set libphobos_test_name "" } diff --git a/libphobos/testsuite/testsuite_flags.in b/libphobos/testsuite/testsuite_flags.in index 6a2d79f..bafd5ad4 100755 --- a/libphobos/testsuite/testsuite_flags.in +++ b/libphobos/testsuite/testsuite_flags.in @@ -28,7 +28,8 @@ case ${query} in ;; --gdcflags) GDCFLAGS_default="-fmessage-length=0 -fno-show-column" - GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_DFLAGS@ -fno-release -funittest" + GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_DFLAGS@ + @phobos_compiler_shared_flag@ -fno-release -funittest" echo ${GDCFLAGS_default} ${GDCFLAGS_config} ;; --gdcpaths) -- cgit v1.1 From 5a0aa603b2452dca48ad86d97d4b918187d259fc Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Fri, 2 Apr 2021 13:29:22 +0200 Subject: d: Merge upstream dmd 3b808e838, druntime 483bc129, phobos f89dc217a D front-end changes: - Explicit package visibility attribute is now always applied to introducing scopes. - Added `__traits(totype, string)' to convert mangled type string to an existing type. - Printf-like and scanf-like functions are now detected by prefixing them with `pragma(printf)' for printf-like functions or `pragma(scanf)' for scanf-like functions. - Added `__c_wchar_t', `__c_complex_float', `__c_complex_double', and `__c_complex_real' types for interfacing with C and C++. - Template alias parameters can now be instantiated with basic types, such as `int` or `void function()`. - Mixins can now be used as types in the form `mixin(string) var'. - Mixin expressions can take an argument list, same as `pragma(msg)'. - Implement DIP1034, add `typeof(*null)' types to represent `noreturn'. - `pragma(msg)' can print expressions of type `void'. - It is now an error to use private variables selectively imported from other modules. Due to a bug, some imported private members were visible from other modules, violating the specification. - Added new syntax to declare an alias to a function type using the `alias' syntax based on the assignment operator. - Function literals can now return a value by reference. Phobos changes: - Synchronize C bindings with the latest port fixes in upstream druntime. - Added alias for a `noreturn' type in object.d - Make use of the new `pragma(printf)' and `pragma(scanf)' pragmas, fix all code that got flagged as being incorrect. - Fixed code that relied on bugs in the D import package system. Reviewed-on: https://github.com/dlang/dmd/pull/12339 https://github.com/dlang/druntime/pull/3422 https://github.com/dlang/phobos/pull/7932 gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 3b808e838. * Make-lang.in (D_FRONTEND_OBJS): Add d/chkformat.o. * d-codegen.cc (build_struct_literal): Handle special enums. * d-convert.cc (convert_expr): Handle noreturn type. (convert_for_condition): Likewise. * d-target.cc (Target::_init): Set type for wchar_t. (TargetCPP::derivedClassOffset): New method. (Target::libraryObjectMonitors): New method. * decl.cc (get_symbol_decl): Set TREE_THIS_VOLATILE for functions of type noreturn. * toir.cc (IRVisitor::visit (ReturnStatement *)): Handle returning noreturn types. * types.cc (TypeVisitor::visit (TypeNoreturn *)): New method. (TypeVisitor::visit (TypeEnum *)): Handle special enums. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 483bc129. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/fcntl.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/unistd.d. (DRUNTIME_DSOURCES_WINDOWS): Add core/sys/windows/stdc/malloc.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos f89dc217a. * src/Makefile.am (PHOBOS_DSOURCES): Add std/regex/internal/tests2.d. * src/Makefile.in: Regenerate. * testsuite/libphobos.exceptions/chain.d: Fix format arguments. * testsuite/libphobos.exceptions/line_trace.d: Likewise. --- libphobos/testsuite/libphobos.exceptions/chain.d | 4 ++-- libphobos/testsuite/libphobos.exceptions/line_trace.d | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/libphobos.exceptions/chain.d b/libphobos/testsuite/libphobos.exceptions/chain.d index 462ba24..0305707 100644 --- a/libphobos/testsuite/libphobos.exceptions/chain.d +++ b/libphobos/testsuite/libphobos.exceptions/chain.d @@ -65,14 +65,14 @@ void main() string prefix = ""; for ({ size_t i; Throwable ex = original; } ex; ex = ex.next, ++i) { - printf("%.*s%.*s\n", prefix.length, prefix.ptr, ex.msg.length, ex.msg.ptr); + printf("%.*s%.*s\n", cast(int)prefix.length, prefix.ptr, cast(int)ex.msg.length, ex.msg.ptr); prefix = prefix~" "; } printf("Bypassed chain was:\n"); prefix = ""; for ({ size_t i; Throwable ex = original.bypassedException; } ex; ex = ex.next, ++i) { - printf("%.*s%.*s\n", prefix.length, prefix.ptr, ex.msg.length, ex.msg.ptr); + printf("%.*s%.*s\n", cast(int)prefix.length, prefix.ptr, cast(int)ex.msg.length, ex.msg.ptr); prefix = prefix~" "; } } diff --git a/libphobos/testsuite/libphobos.exceptions/line_trace.d b/libphobos/testsuite/libphobos.exceptions/line_trace.d index 7b75d3a..70762ff 100644 --- a/libphobos/testsuite/libphobos.exceptions/line_trace.d +++ b/libphobos/testsuite/libphobos.exceptions/line_trace.d @@ -9,7 +9,7 @@ void main() { import core.stdc.stdio; auto str = e.toString(); - printf("%.*s\n", str.length, str.ptr); + printf("%.*s\n", cast(int)str.length, str.ptr); } } -- cgit v1.1 From 38258326dc9e5581e2cd6318ae1b5e675dd00d4a Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 10 Apr 2021 12:01:04 +0200 Subject: libphobos: Re-add -fno-moduleinfo flag to dg-runtest [PR99812] libphobos/ChangeLog: PR d/99812 * testsuite/libphobos.druntime_shared/druntime_shared.exp: Re-add -fno-moduleinfo flag to dg-runtest. * testsuite/libphobos.phobos_shared/phobos_shared.exp: Likewise. --- libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp | 2 +- libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp index 2b25613..51f9c2c 100644 --- a/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp +++ b/libphobos/testsuite/libphobos.druntime_shared/druntime_shared.exp @@ -35,7 +35,7 @@ dg-init foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]" dg-runtest $test "-shared-libphobos" \ - "-fmain -fbuilding-libphobos-tests $version_flags" + "-fmain -fbuilding-libphobos-tests -fno-moduleinfo $version_flags" set libphobos_test_name "" } diff --git a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp index 3a847e7..8498522 100644 --- a/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp +++ b/libphobos/testsuite/libphobos.phobos_shared/phobos_shared.exp @@ -46,7 +46,7 @@ dg-init foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../src $test]" dg-runtest $test "-shared-libphobos" \ - "-fmain -fbuilding-libphobos-tests $version_flags" + "-fmain -fbuilding-libphobos-tests -fno-moduleinfo $version_flags" set libphobos_test_name "" } -- cgit v1.1 From 2b778748319ffe8434f68d147c168423a1af388d Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 10 Apr 2021 12:18:57 +0200 Subject: libphobos: Remove is-effective-target static from druntime and phobos tests This test isn't compiling with `-static', it's there to verify that the libphobos is functional when linked in statically. libphobos/ChangeLog: * testsuite/libphobos.druntime/druntime.exp: Remove is-effective-target static. * testsuite/libphobos.phobos/phobos.exp: Likewise. --- libphobos/testsuite/libphobos.druntime/druntime.exp | 2 +- libphobos/testsuite/libphobos.phobos/phobos.exp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/libphobos.druntime/druntime.exp b/libphobos/testsuite/libphobos.druntime/druntime.exp index 2f3a36f..df01fcc 100644 --- a/libphobos/testsuite/libphobos.druntime/druntime.exp +++ b/libphobos/testsuite/libphobos.druntime/druntime.exp @@ -15,7 +15,7 @@ # . # Immediately exit if we can't run target executables. -if { ![isnative] || ![is-effective-target static] } { +if { ![isnative] } { return } diff --git a/libphobos/testsuite/libphobos.phobos/phobos.exp b/libphobos/testsuite/libphobos.phobos/phobos.exp index 0975ab1..770e576 100644 --- a/libphobos/testsuite/libphobos.phobos/phobos.exp +++ b/libphobos/testsuite/libphobos.phobos/phobos.exp @@ -15,7 +15,7 @@ # . # Immediately exit if we can't run target executables. -if { ![isnative] || ![is-effective-target static] } { +if { ![isnative] } { return } -- cgit v1.1 From 385ee099eeae53bff5dd5adf673ad4f4b8d22981 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 10 Apr 2021 12:24:40 +0200 Subject: libphobos: Explicitly use -static-libphobos in druntime and phobos tests Linking to libphobos statically is the default in the driver, however this may change in future. Be explicit that the static libphobos is what's being tested. libphobos/ChangeLog: * testsuite/libphobos.druntime/druntime.exp: Compile all tests with -static-libphobos. * testsuite/libphobos.phobos/phobos.exp: Likewise. --- libphobos/testsuite/libphobos.druntime/druntime.exp | 3 ++- libphobos/testsuite/libphobos.phobos/phobos.exp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/libphobos.druntime/druntime.exp b/libphobos/testsuite/libphobos.druntime/druntime.exp index df01fcc..daedfd7 100644 --- a/libphobos/testsuite/libphobos.druntime/druntime.exp +++ b/libphobos/testsuite/libphobos.druntime/druntime.exp @@ -34,7 +34,8 @@ dg-init # Main loop. foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../libdruntime $test]" - dg-runtest $test "" "-fmain -fbuilding-libphobos-tests $version_flags" + dg-runtest $test "-static-libphobos" \ + "-fmain -fbuilding-libphobos-tests $version_flags" set libphobos_test_name "" } diff --git a/libphobos/testsuite/libphobos.phobos/phobos.exp b/libphobos/testsuite/libphobos.phobos/phobos.exp index 770e576..937849e 100644 --- a/libphobos/testsuite/libphobos.phobos/phobos.exp +++ b/libphobos/testsuite/libphobos.phobos/phobos.exp @@ -45,7 +45,8 @@ dg-init # Main loop. foreach test $tests { set libphobos_test_name "$subdir/[dg-trim-dirname $srcdir/../src $test]" - dg-runtest $test "" "-fmain -fbuilding-libphobos-tests $version_flags" + dg-runtest $test "-static-libphobos" \ + "-fmain -fbuilding-libphobos-tests $version_flags" set libphobos_test_name "" } -- cgit v1.1 From d118ec221dd5fc829d2170c257e10b8159dce274 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Thu, 8 Apr 2021 18:31:04 +0200 Subject: libphobos: Build runtime library with -ffunction-sections -fdata-sections Tests for `-ffunction-sections -fdata-sections' and sets SECTION_FLAGS accordingly. If there is no warning when using it, take advantage of the smaller executables that can be had with `--gc-sections'. libphobos/ChangeLog: * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Call DRUNTIME_SECTION_FLAGS. * libdruntime/Makefile.am: Add SECTION_FLAGS to AM_DFLAGS. * libdruntime/Makefile.in: Regenerate. * m4/druntime.m4 (DRUNTIME_SECTION_FLAGS): New macro. * src/Makefile.am: Add SECTION_FLAGS to AM_DFLAGS. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. --- libphobos/testsuite/Makefile.in | 1 + 1 file changed, 1 insertion(+) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in index 51eb4ef..8855480 100644 --- a/libphobos/testsuite/Makefile.in +++ b/libphobos/testsuite/Makefile.in @@ -215,6 +215,7 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +SECTION_FLAGS = @SECTION_FLAGS@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -- cgit v1.1 From 6eae7549b8a350b92435be904efed195bd190bae Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 19 Apr 2021 14:48:32 +0200 Subject: libphobos: Add Thread/Fiber support code for Darwin (PR98058) libphobos/ChangeLog: PR d/98058 * configure: Regenerate. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_DARWIN): Add core/sys/darwin/config.d * libdruntime/Makefile.in: Regenerate. * libdruntime/config/powerpc/switchcontext.S: Implement fiber_switchContext for __MACH__. * libdruntime/config/x86/switchcontext.S: Likewise. * libdruntime/core/sys/darwin/config.d: New file. * libdruntime/core/thread/fiber.d (Fiber.getThis): Mark noinline. (UnsafeFiberMigration): Define for OSX/X86 and OSX/X86_64. * libdruntime/core/thread/osthread.d (callWithStackShell): Add inline assembler implementation for X86, X86_64, PPC, and PPC64. * libdruntime/core/thread/threadbase.d (ThreadBase.getThis): Mark noinline. * libdruntime/gcc/deh.d (FuncTable): Remove definition. * m4/druntime/os.m4 (DRUNTIME_OS_MINFO_BRACKETING): Check for right bracket symbol on darwin* targets. * testsuite/libphobos.thread/fiber_guard_page.d: Update test to support ucontext-based Fibers. --- libphobos/testsuite/libphobos.thread/fiber_guard_page.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libphobos/testsuite') diff --git a/libphobos/testsuite/libphobos.thread/fiber_guard_page.d b/libphobos/testsuite/libphobos.thread/fiber_guard_page.d index 9f754e1..ca54a19 100644 --- a/libphobos/testsuite/libphobos.thread/fiber_guard_page.d +++ b/libphobos/testsuite/libphobos.thread/fiber_guard_page.d @@ -1,13 +1,15 @@ // { dg-options "-O0" } // { dg-shouldfail "segv or bus error" } import core.thread; +import core.sys.posix.signal; import core.sys.posix.sys.mman; // this should be true for most architectures // (taken from core.thread) -version = StackGrowsDown; +version (GNU_StackGrowsDown) + version = StackGrowsDown; -enum stackSize = 4096; +enum stackSize = MINSIGSTKSZ; // Simple method that causes a stack overflow void stackMethod() -- cgit v1.1