The multi-build.in file in libgloss duplicates common multilib logic
in the root source tree. Document it a bit, and rename the rule so
it doesn't clash with the common multi-do rule. This will let us use
them in the same makefile so we can merge aarch64/ & arm/ up (as the
only targets that use this local multi-build.in atm).
When merging iq2000 up a level, it included a partial conversion to
AM_PROG_AS in the common directory. Finish it for all directories
to kill off the custom LIB_AM_PROG_AS which we no longer need since
we require Automake 1.15 now.
Now that we use AC_NO_EXECUTABLES, and we require a recent version of
autoconf, we don't need to define our own copies of these macros. So
switch to the standard AC_PROG_CC.
- The recent change by the commit "Cygwin: console: Redesign handling
of special keys." breaks the handling of CTRL_BREAK_EVENT. The login
shell in console exits on Ctrl-Break key. This patch fixes the issue.
I split libg.a out into a sep target from libc.a for the main dir in
commit f2b053f49e ("newlib: separate out
libg from libc"), but missed the multilib dirs. That leads to an
uncommon parallel build failure:
- libc.a rule runs & finishes
- $(BUILD_MULTISUBDIR)/libc.a rule runs
-> failure due to libg.a not yet existing
- libg.a rule runs & finishes
Split the multilib libg rule out from libc too so it can depend on the
main libg directly and avoid this race.
- The inferior of the GDB cannot be continued after SIGINT even
though nopass option is set. This seems because cygwin GDB does
not support hooking cygwin signal. Therefore, a workaround for
GDB is added. With this patch, only CTRL_C_EVENT is sent to the
GDB inferior by Ctrl-C and sending SIGINT is omitted. Note that
"handle SIGINT (no)pass" command does not take effect even with
or without this patch.
- This patch rearranges the cooperation between cons_master_thread,
line_edit, and ctrl_c_handler so that only one of them operates
at the same time. Since these handle Ctrl-C individually, so the
signal may be sent multiple times to the process. This patch fixes
the issue.
Use AM_MAINTAINER_MODE so devs have to opt-in to automatic rebuilds
of autotools. This matches what newlib (and most every other GNU
toolchain package) does with automake.
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>
Remove dependency on __sdidinit member of struct _reent to check
object initialization. Like __sdidinit, the __cleanup member of
struct _reent is initialized in the __sinit() function. Checking
initialization against __cleanup serves the same purpose and will
reduce overhead in the __sfp() function in a follow up patch.
- This patch fixes the handle leak which occurs when exec() fails
with an error. The duplicated handles will be closed when the
exec'ed process is terminated. However, if exec() fails, the code
path does not reach to the code closing the duplicated handles.
To implement this fix more appropriately, the setup, cleanup and
closing pty codes which was previously located in spawn.cc are
encapsulated into the fhandler_pty_slave class functions.
- Calling fix_tab_position() is necessary in Windows 10 with xterm
compatible mode enabled, because it has a problem that the tab
positions will be broken when the window size is changed. Fortunately,
this problem has been fixed in Windows 11. Therefore, with this patch,
necessity of fix_tab_position() call is determined by referring to
wincap.has_con_broken_tabs(), which is recently introduced.
- With this patch, all set_(in|out)put_mode() calls are rearranged
as follows.
1) Setup for cygwin apps, started from non-cygwin app, is done
in fhandler_console::post_open_setup(), which overrides
fhandler_base::post_open_setup() called from dtable.cc.
2) Cleanup for cygwin app is done in fhandler_console::close().
3) Setup for cygwin apps is also in fhandler_console::bg_check(),
which overrides fhandler_termios::bg_check(). This is called
on read(), write() and select() for console. It is necessary
if cygwin and non-cygwin apps are started simultaneously in
the same process group.
4) Setup for non-cygwin apps is done in spawn.cc via
fhandler_console::setup_console_for_non_cygwin_app().
5) Cleanup for non-cygwin app is done in spawn.cc vid
fhandler_console::cleanup_console_for_non_cygwin_app().
6) Setup for non-cygwin app started by GDB is done in
fhandler_console::set_console_mode_to_native().
7) No explicit cleanup for non-cygwin app started by GDB, because
console mode is automatically reset to tty::cygwin on read()/
write() in GDB thanks to 3).
- This patch commonize the code which processes special keys in pty
and console to improve maintanancibility. As a result, some small
bugs have been fixed.
The crt0.o was handled in a subdir-by-subdir basis: it would be compiled
in one (e.g. libc/sys/$arch/), then copied up one level (libc/sys/), then
copied up another (libc/) before finally being copied & installed in the
top newlib dir. The libc/sys/ copy was cleaned up, and then the top dir
was changed to copy it directly out of the libc/sys/$arch/ dir. But the
libc/sys/ copy to libc/ was left behind. Clean that up now too.
These headers aren't installed, so use "" includes instead of <> so
we don't search system header paths. This matches the style used
elsewhere in the tree for these local headers, and makes it work
w/out explicit -I flags (as needed with non-recursive make).
Convert all the libm/ subdir makes into the top-level Makefile. This
allows us to build all of libm 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 libm.a. The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libm_a_SOURCES.
One thing to note is that this will require GNU Make because of:
libm_a_CFLAGS = ... $(libm_a_CFLAGS_$(subst /,_,$(@D)))
This was the only way I could find to supporting per-dir compiler
settings, and I couldn't find a POSIX compatible way of transforming
the variable content. I don't think this is a big deal as other
Makefiles in the tree are using GNU Make-specific syntax, but I call
this out as it's the only one so far in the new automake code that
I've been writing.
Automake doesn't provide precise control over the output object names
(by design). This is fine by default as we get consistent names in all
the subdirs: libm_a-<source>.o. But this relies on using the same set
of compiler flags for all objects. We currently compile libm/common/
with different optimizations than the rest.
If we want to compile objects differently, we can create an intermediate
archive with the subset of objects with unique flags, and then add those
objects to the main archive. But Automake will use a different prefix
for the objects, and thus we can't rely on ordering to override.
But if we leverage $@, we can turn Automake's CFLAGS into a multiplex
on a per-dir (and even per-file if we wanted) basis. Unfortunately,
since $@ contains /, Automake complains it's an invalid name. While
GNU Make supports this, it's a POSIX extension, so Automake flags it.
Using $(subst) avoids the Automake warning to get a POSIX compliant
name, albeit with a GNU Make extension.
Make this a separate target from libc so that we can migrate libc over
to automake more easily. Having it integrated into the libc target is
difficult to handle when using automake rules which expect a one-to-one
mapping between names & inputs.
When migrating the manual to the top-level, the include order was
sorted by name of the subdir. But this changed the chapter order
of the manual in the process. Change the sorting back to match
existing chapters and update the comments to explain.
Using xxx_LIBADD, xxx_DEPENDENCIES, and EXTRA_xxx_SOURCES is one way of
conditionally including files into a target. But it's meant more for the
cases where the variables added to LIBADD & DEPENDENCIES are constructed
via substitution (e.g. AC_SUBST) or other dynamic methods. With Automake
conditionals, then the much simpler form is to conditionally append to
the xxx_SOURCES variable and let Automake sort everything out.
Move the minor wince-specific logic to a dedicated file & namespace
them so we can merge its configure logic up a level. The makefile
is a bit tricky, but maybe it still works.
Commit 8fa73a9f84 changed how fenv.c is
compiled wrt mips16 targets used the wrong variable to add fenv.o to
libm.a. Fix that thinko so it's included in the build again.
We don't want libgloss building against C library headers that happened
to be installed with the toolchain, so add -nostdinc to the build. We
still need access to the compiler internal headers, so probe those and
include them via -isystem. This uses a similar probing style as glibc,
which has used it for over a decade, so it should be safe & stable.
This should prevent any latent bugs due to testing with a toolchain that
is fully configured & installed already.
The cpu-init/configure script isn't doing anything useful, so merge
the logic up to the parent dir. This is how the arm/ tree integrates
its cpu-init/ subdir too.
Move the minor mn10300-specific logic to a dedicated file & namespace
them so we can merge its configure logic up a level. part_specific_obj
wasn't used anywhere (looks like copy & paste left over from mips), so
drop it entirely.
The mn10200-specific logic (setting up part_specific_obj) isn't used
by the build anywhere -- looks like copy & paste left overs from mips.
So punt that & merge the target_makefile_frag_path up to the top-level.
Use this macro rather than hacking up the LDFLAGS settings. This will
make it easier to merge the logic into the top-level which is already
using AC_NO_EXECUTABLES.
The top-level newlib dir already takes care of recursing into the
sys/xxx/include/ subdirs and installing any headers found, so the
rtems subdir doesn't need to do this itself.
Replace the custom build rules (which require copying & pasting from the
current Makefile) with small stub files. This allows us to drop the rules
entirely and let Automake provide everything.
These subdirs don't actually use anything from libm. The common dir
in particular only has 4 header files, and none are included here.
The xstormy16 code has a comment mentioning why this hack is here, but
it refers to code that was removed when its configure script was merged
up a level.
- The capability changes since Windows 11 have been reflected in
wincap.cc. The capability has_con_broken_tabs is added, which is
false since Windows 11.
This is used in a bunch of places, but nowhere is it ever set, and
nowhere can I find any documentation, nor can I find any other project
using it. So delete the flags to simplify.