Commit Graph

48 Commits

Author SHA1 Message Date
Christian Franke f5e37b93a0
Cygwin: Add initial support for SOURCE_DATE_EPOCH
If specified, set version timestamp to this value.
Enable deterministic archives for ar and ranlib.
Set cygwin1.dll PE and export table header timestamps to zero.

Signed-off-by: Christian Franke <christian.franke@t-online.de>
2023-09-10 14:42:21 +01:00
Takashi Yano 2a4af36614 Cygwin: Implement sound mixer device.
This patch adds implementation of OSS-based sound mixer device. This
allows applications to change the sound playing volume.

NOTE: Currently, the recording volume cannot be changed.

Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-09-01 21:33:38 +09:00
Jon Turney e8c1a579cd
Cygwin: testsuite: Setup test prereqs in 'installation' the tests run in
Do some setup in the Cygwin 'installation' at testsuite/testinst/:

* Ensure /tmp exists

* Use BusyBox to provide executables needed by tests which use system()
(sh, sleep, ls)

This enables tests which use system(), or require /tmp to exist to pass.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2023-07-14 14:02:37 +01:00
Corinna Vinschen be67844f5d Cygwin: Makefile.am: fix rule to create version from git describe
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-02-15 15:04:16 +01:00
Jon Turney 1a9f95d894
Cygwin: Run testsuite against the just-built DLL
Since 4e7817498e, we're just running the tests against the installed
DLL.  We're arranging to put the build directory on the path, but since
it doesn't contain cygwin1.dll (since it's built with a different name
and renamed on installation), that doesn't have any effect.

Arrange to place the just-built DLL into a directory which the testsuite
can place on it's path (while running the test, but not while compiling
it).

Also fix any remaining references to cygwin0.dll in testsuite,
documentation and comments.

Fixes: 4e7817498e ("Cygwin: Makefile: Drop all the "test dll" considerations")
2023-01-10 10:27:13 +00:00
Jon Turney 4e7817498e
Cygwin: Makefile: Drop all the "test dll" considerations
After 90236c3a2c, the testsuite is failing, as the cygwin0.dll
referenced by the implib that testsuite programs are linked with doesn't
exist anymore.

We don't need to make and link the testsuite with a specially named DLL,
as the cygwin DLL (since 526b0fbca3) takes into consideration the path
it's executing from to define separate "Cygwin installations", which
don't interact.

Fixes: 90236c3a2c ("Cygwin: Makefile: build new-cygwin1.dll in a single step")
2022-12-21 17:43:11 +00:00
Corinna Vinschen 2af7dd9567 Cygwin: x86_64: import swab.S from NetBSD
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20 10:19:23 +01:00
Corinna Vinschen 43743ed754 Cygwin: x86_64: import latest NetBSD bcopy.S
Tweak slightly to allow implementing entire {w}mem{p}{cpy,move}
family:

Add WIDE macro processing for wmem* and POST macro processing for
memp* functions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20 10:13:59 +01:00
Corinna Vinschen b09617a828 Cygwin: x86_64: import memchr.S from NetBSD
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20 10:13:59 +01:00
Corinna Vinschen 90236c3a2c Cygwin: Makefile: build new-cygwin1.dll in a single step
The complicated build routine was only required because we needed
the .cygheap section at the end of the file, and the debug sections
broke this.  Now that the cygheap is out of the way, we really don't
have to do this anymore, and the build can just generate a DLL with
integrated debug info.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-13 14:16:13 +01:00
Corinna Vinschen f34db341fc Cygwin: Makefile: only regenerate cygwin_version.c if it changes
Make sure to create a new cygwin_version.c if it either doesn't
exist yet, or if it would be different from the former file.
This avoids unnecessary DLL rebuilding.

Fixes: 97eb64b909 ("Cygwin: uname: generate default release string from git as well")
Fixes: 4949a82cde ("Cygwin: uname: fix building in non-git source dir")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-13 14:16:13 +01:00
Corinna Vinschen 4949a82cde Cygwin: uname: fix building in non-git source dir
commit 97eb64b909 broke building outside of a git dir, because
the git describe command would fail.  Fix this by checking if
we're in a git tree at all and just generate an empty string
as version string.  Use this in uname_x to generate a fallback
version.

Fixes: 97eb64b909 ("Cygwin: uname: generate default release
string from git as well"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-07 22:22:38 +01:00
Corinna Vinschen 97eb64b909 Cygwin: uname: generate default release string from git as well
When building a release with cygport, we get uname version info
from cygport, which in turn gets version info from `git describe'.

During development, the release info for local builds was not
that helpful yet.  Fix that, by creating version info from
`git describe' if CYGPORT_RELEASE_INFO isn't given.  Make sure to
always force rebuild of the version info to pick up source file
changes as well as git actions.

Rearrange code slightly to generate machine info first, release info
after that.  Use snprintf to generate release string safely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-07 21:30:23 +01:00
Corinna Vinschen 95f5b0a620 Cygwin: link mcountFunc.o to libgmon.a
Commit 188d5f6c9a erroneously moved the mcountFunc.S file to the
TARGET_FILES target, rather than keeping it in GMON_FILES.  The
result is that the __fentry__ entry point is now entirely undefined,
so `gcc -pg' is broken.

Create new target-specific GMON_TARGET_FILES and move mcountFunc.S
into it.  Add $(GMON_TARGET_FILES) to GMON_FILES.

Fixes: 188d5f6c9a ("Cygwin: x86_64: add wmemset assembler entry point")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-07 12:28:33 +01:00
Takashi Yano 2e4ecbb3f0 Cygwin: pty: Rename fhandler/tty.cc to fhandler/pty.cc.
- Previously, we have two tty.cc, one is winsup/cygwin/tty.cc and
  the other is winsup/cygwin/fhandler/tty.cc. This is somewhat
  confusing. This patch renames fhandler/tty.cc to fhandler/pty.cc.
2022-11-25 09:33:27 +09:00
Corinna Vinschen 943433b00c Cygwin: Enable dynamicbase on the Cygwin DLL by default
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-28 16:26:53 +02:00
Corinna Vinschen ebbff10ae1 Cygwin: drop objcopy .gnu_debuglink juggle
Prior to 591fec858d01 ("Cygwin: decouple cygheap from Cygwin DLL")
the .cygheap section was required to stay the last section in the
final binary.  That required some juggling with objcopy to make
sure the .gnu_debuglink section is prior to the .cygheap section
in the final DLL.

This isn't required anymore, so just drop it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-10-28 16:26:53 +02:00
Corinna Vinschen 782ef53619 Cygwin: rename CygwinCreateThread to create_posix_thread
Rename CygwinCreateThread to create_posix_thread and move
from miscfuncs.cc to create_posix_thread.cc, inbcluding all
related functions.  Analogue for the prototypes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-10 18:06:28 +02:00
Corinna Vinschen 9fbfccff71 Cygwin: move memory management sources into mm subdir
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-10 18:05:12 +02:00
Corinna Vinschen 719224492a Cygwin: drop building modelibs
They never worked as desired anyway. Use the object files.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-10 18:05:11 +02:00
Corinna Vinschen 34872ce1a1 Cygwin: pthreads: merge pthread.cc into thread.cc
provide entire internal and external pthread API from inside the
same file.

While I dislike to have another even larger file, this is basically
cleaning up the source and grouping the external API into useful
chunks. Splitting the file cleanly is tricky due to usage of inline
methods is_good_object and verifyable_object_isvalid.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-09 22:48:43 +02:00
Corinna Vinschen 3ba050dfcd Cygwin: fold common.din and x86_64.din into cygwin.din
We don't need a target-specific DEF file anymore

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 17:47:46 +02:00
Corinna Vinschen 188d5f6c9a Cygwin: x86_64: add wmemset assembler entry point
So far, wmemset used the C implemantation from newlib.  Let's use
the optimized assembler code instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 16:50:04 +02:00
Corinna Vinschen 3e13d93554 Cygwin: split out x86_64 memset/memcpy functions
move the assembler memset and memcpy functions into their own
assembler files.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-08 16:25:41 +02:00
Ken Brown 1213f7bf15 Cygwin: update the "dirs" variable in Makefile.am
Add the new fhandler and sec subdirs.
2022-08-05 12:02:11 +02:00
Corinna Vinschen 007e23d639 Cygwin: Reorganize cygwin source dir
Create subdirs and move files accordingly:

- DevDocs:  doc files
- fhandler: fhandler sources, split fhandler.cc into base.cc and null.cc
- local_includes: local include files
- scripts:  scripts called during build
- sec:      security sources

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-08-05 12:02:11 +02:00
Corinna Vinschen 0597c84b9b Cygwin: revamp TLS offsets computation
- convert gentls_offsets to a shell script, only running the target
  compiler and gawk.

- Simplify cygtls.h.  The new gentls_offsets script only requires two
  lines with the "public:" keyword as markers.  The comments are not
  used anymore, the output is a preprocesses file without comments.
  Align Makefile rules accordingly.

- Rather than generating perl variables and C #defines, just generate
  .ecu statements and .include the TLS offsets file right from the
  generated assembler file sigfe.s.  It's the only place we really
  need (some of) the offsets.

- Drop the target-specific name of the TLS offsets file and generate
  it on the fly in the build dir.  Fix configure and Makefile rules
  accordingly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 14:11:58 +02:00
Corinna Vinschen fcb32b7374 Cygwin: configure: disable i686 builds
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-05-13 13:42:54 +02:00
Mike Frysinger 96bc16f6b2 newlib: libc: merge build up a directory
Convert all the libc/ subdir makes into the top-level Makefile.  This
allows us to build all of libc from the top Makefile without using any
recursive make calls.  This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libc.a.  The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libc_a_SOURCES.

There's a few dummy.c files that are no longer necessary since we aren't
doing the lib.a accumulating, so punt them.

The winsup code has been pulling the internal newlib ssp library out,
but that doesn't exist anymore, so change that to pull the objects.
2022-03-16 21:18:25 -04:00
Corinna Vinschen 9551e617e7 Cygwin: Makefile: fix ctags --extras option
--extra is deprectated, use --extras

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-03-01 16:23:24 +01:00
Johannes Schindelin 4ec08891a0 Cygwin: Implicitly support the /dev/fd symlink and friends
Bash has a very convenient feature that is called process substitution
(e.g. `diff -u <(seq 0 10) <(seq 1 11)`). To make this work, Bash
requires the `/dev/fd` symlink to exist, and Cygwin therefore creates
this symlink (together with the `stdin`, `stdout` and `stderr` ones)
upon start-up.

This strategy is incompatible with the idea of providing a subset of
Cygwin in a `.zip` file (because there is no standard way to represent
symlinks in `.zip` files, and besides, older Windows versions would
potentially lack support for them anyway).

That type of `.zip` file is what Git for Windows wants to use, though,
bundling a minimal subset for third-party applications in MinGit (see
https://github.com/git-for-windows/git/wiki/MinGit for details).

Let's side-step this problem completely by creating those symlinks
implicitly, similar to the way `/dev/` is populated with special
devices.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-02-22 13:33:00 +01:00
Corinna Vinschen 8bb6821c7a Cygwin: Adjust path to newlib libc.a, too
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-02-22 12:49:33 +01:00
Jon Turney 56ec1fcb0d Cygwin: Adjust path to newlib libm.a in builddir
Adjust path to newlib libm.a in builddir, changed by ac9f8c46
2022-02-22 12:49:33 +01:00
Corinna Vinschen c3efc81658 Cygwin: drop dllfixdbg script
On second thought, we don't actually need this script.
Express the entire action as sufficiently simple Makefile rule.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-02-05 10:42:27 +01:00
Corinna Vinschen 899cf3c952 Cygwin: fix dependency to dllfixdbg script
Only the files created from cygwin0.dll depend on the script, not
cygwin0.dll as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-02-04 18:27:14 +01:00
Corinna Vinschen 4aeba49016 Cygwin: dllfixdbg: honor Makefile verbositiy flag "V"
In Makefile.am, add the value of $(V) to the dllfixdbg call.
In dllfixdbg, if V=1, print what the script is doing.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-02-03 16:22:46 +01:00
Corinna Vinschen 7ae91f3b56 Cygwin: dllfixdbg: don't overwrite input DLL
Change dllfixdbg to keep the input DLL intact and just generate
a new DLL matching the debug file.  Fix Makefile rule accordingly.
The result is, cygwin0.dll is the original DLL created with full
debug sections and stays that way throughout the build process.
Only new-cygwin1.dll will become the stripped DLL matching with
the file containing the debug sections cygwin1.dbg.  This is ok,
because commit ba02fef995 ("Cygwin: Makefile.am: fix DLL build rule")
made new-cygwin1.dll the DLL to be installed.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-02-03 16:22:46 +01:00
Corinna Vinschen ba02fef995 Cygwin: Makefile.am: fix DLL build rule
A single Makefile rule creates three files in three steps, the second
and third one never showing up in dependencies.  The next step creating
the link lib only depends on the first of these files.  Even if the
second or third step in the DLL build rule fails, the next make
invocation never picks up on this and just goes ahead creating the
link lib.

Fix this by splitting the DLL build rule into three rules, with
every step on the way depending on the previous rule.  Also fix up
the names, TEST_DLL_NAME just doesn't cut it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-02-02 21:30:20 +01:00
Jon Turney 9c546e0fd2
Cygwin: silence most custom build rules 2022-01-19 17:13:44 +00:00
Corinna Vinschen f574c30857 Cygwin: Makefile: add dependency to newlib's libs
We need deps to newlib's libc.a and libm.a, otherwise changes
in newlib code don't trigger a rebuild of the Cygwin DLL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-01-12 11:45:54 +01:00
Corinna Vinschen cb21b9cc57 Cygwin: drop outdated -O3 optimization for malloc and sync
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-10-22 12:47:09 +02:00
Corinna Vinschen 88c0276358 Cygwin: Allow using CFLAGS also for C++ files
This was used before switching to automake to allow easy tweaking
of optimization and debugging settings from the command line during
testing.  Reenable.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-08-26 22:21:53 +02:00
Corinna Vinschen 4fc922b2c8 Cygwin: POSIX msg queues: Convert mqd_t to a descriptor
So far, the mqd_t type returned a pointer to an allocated
area under the hood.  The mutex and event objects attached
to the message queue were implemented as inheritable types.

As unfortunate side effect the HANDLEs to these objects
were inherited by exec'd child processes, even though all
other message queue properties are not inherted, per POSIX.

Fix this by converting an mqd_t to a descriptor, and create a
matching fhandler_mqueue object to handle various aspects of
the message queues inside the fhandler.  Especially, create the
IPC objects as non-inheritable and duplicate the HANDLEs as
part of the fixup_after_fork mechanism.

Drop using mmap and create the memory map with NT functions.
This allows to control duplication of handle and mapping in the
forked child process, without the requirement to regenerate the
map in the same spot.  It also allows to dup() the descriptor,
as on Linux, albeit this isn't implemented yet.

This patch is the first cut.  There's a bit more to do, like
moving more functionality from the POSIX functions into the
fhandler and making sure the mqd_t type can't be used in other
descriptor-related functions willy-nilly.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-21 13:43:24 +02:00
Corinna Vinschen 9ea0f37667 Cygwin: revert handwritten tags/ctags target, take 2
Fix accidental checkin of the wrong test version

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-06 13:35:26 +02:00
Corinna Vinschen a5b24cb241 Cygwin: revert handwritten tags/ctags target
Converting to automake dropped the former, handwritten tags/ctags
target.  This leads to a couple of problems:

- For no good reason the tags file gets written to the builddir
  instead of to the srcdir where it's needed.

- `make tags' requires etags to exist, rather than checking if it
  exists and skipping it.

- Adding the extra ctags arguments to AM_CTAGSFLAGS still results
  in a shortened tags file.

(Temporary?) solution: Revert the old tags/ctags rules and silence
the automake warnings.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-06 11:12:46 +02:00
Jon Turney b05b790689 Cygwin: Ensure toollibdir exists before installing a link there
This helps 'make install -j2' work.
2021-04-30 21:06:33 +02:00
Jon Turney 0bf0cf48ff Cygwin: specify toollibdir toolincludedir in terms of tooldir
Specify toollibdir and toolincludedir in terms of tooldir, so the
install location is correct if tooldir is the default
($(exec_prefix)/$(target_alias)), or explicitly specified on the 'make'
command line.
2021-04-29 11:20:37 +02:00
Jon Turney 247ce0ca3a
Cygwin: Use automake (v5)
v2:
* Include tzmap.h in BUILT_SOURCES
* Make per-file flags appear after user-supplied CXXFLAGS, so they can
override optimization level.
* Correct .o files used to define symbols exported by libm.a
* Drop gcrt0.o mistakenly included in libgmon.a
* Add missing line continuations in GMON_FILES value

v3:
* use per-file flags for .c compilation
* override C{XX,}FLAGS, as they are set on the command line by top-level make

v4:
* Drop -Wno-error=write-strings from path_testsuite CXXFLAGS

v5:
* Update for changes in master
- Add -fno-threadsafe-statics to CXX flags
- Add hypotl.cc
- Remove fenv.cc (in favour of newlib), add fenv.c stub
- Add proc.5 manpage rules
2021-04-27 16:49:56 +01:00