Commit Graph

20556 Commits

Author SHA1 Message Date
Takashi Yano 29d8a83008 Cygwin: console: Rearrange set_(in|out)put_mode() calls.
- 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).
2022-02-20 19:22:02 +09:00
Takashi Yano 2cab4d0bb4 Cygwin: pty, console: Refactor the code processing special keys.
- 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.
2022-02-20 19:21:51 +09:00
Mike Frysinger 416792d59a newlib: libc: delete crt0.o duplication
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.
2022-02-18 21:25:32 -05:00
Mike Frysinger 56c65fb8d9 newlib: posix: use local includes for local headers
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).
2022-02-18 18:40:57 -05:00
Mike Frysinger ac9f8c46b1 newlib: libm: merge build up a directory
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.
2022-02-17 20:56:32 -05:00
Mike Frysinger f2b053f49e newlib: separate out libg from libc
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.
2022-02-17 20:54:21 -05:00
Mike Frysinger c75bb30fc1 newlib: libc: reshuffle include order for the manual
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.
2022-02-17 20:43:51 -05:00
Mike Frysinger 48942fe31a newlib: powerpc: switch to Automake conditionals
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.
2022-02-17 20:43:51 -05:00
Mike Frysinger 2d53aadcc5 libgloss: have README point to the manual
The README has such little info in it, so point people to the much
more extensive porting manual.
2022-02-17 20:41:53 -05:00
Mike Frysinger 7a1c557b8e libgloss: merge mips configure script up a level
Move the minor mips-specific logic to a dedicated file & namespace
them so we can merge its configure logic up a level.
2022-02-17 20:36:41 -05:00
Mike Frysinger f9dc151186 libgloss: merge wince configure script up a level
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.
2022-02-17 20:35:32 -05:00
Mike Frysinger bf9f6a0984 newlib: use https:// URIs in more places 2022-02-17 00:48:58 -05:00
Mike Frysinger beadbdfc04 newlib: fix mips fenv.o handling
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.
2022-02-16 20:40:53 -05:00
Mike Frysinger e0c0ad8268 libgloss: build with -nostdinc
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.
2022-02-16 20:29:08 -05:00
Mike Frysinger 5ca1f8c7ff libgloss: sparc: merge libsys/ up a level
The libsys/configure script isn't doing anything useful, so merge
the logic up to the parent dir.
2022-02-16 20:24:27 -05:00
Mike Frysinger aff735e4c6 libgloss: aarch64: merge cpu-init/ up a level
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.
2022-02-16 20:23:26 -05:00
Mike Frysinger 538a37be5b libgloss: merge mn10300 configure script up a level
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.
2022-02-16 20:20:14 -05:00
Mike Frysinger 0c45c7ce67 libgloss: merge mn10200 configure script up a level
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.
2022-02-16 20:16:05 -05:00
Mike Frysinger 9a5f78d80e libgloss: merge m68k configure script up a level
Move the minor m68k-specific logic to a dedicated file & namespace them
so we can merge its configure logic up a level.
2022-02-16 20:14:55 -05:00
Mike Frysinger 7d565fe013 libgloss: m68k: switch to AC_NO_EXECUTABLES
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.
2022-02-16 20:12:42 -05:00
Mike Frysinger 91019da446 libgloss: merge mcore configure script up a level
Move the minor mcore-specific logic to a dedicated file & namespace them
so we can merge its configure logic up a level.
2022-02-16 20:11:55 -05:00
Mike Frysinger e7f8999918 libgloss: merge moxie configure script up a level
Move the minor moxie-specific logic to a dedicated file & namespace them
so we can merge its configure logic up a level.
2022-02-16 20:10:48 -05:00
Mike Frysinger 5200f756cc libgloss: merge i386 configure script up a level
Move the minor i386-specific logic to a dedicated variable so we can
merge its configure logic up a level.
2022-02-16 20:08:55 -05:00
Mike Frysinger e05f9c0c05 libgloss: i386: simplify target flags
Collapse these 3 settings into one variable to make it easier to
merge into the top-level.
2022-02-16 20:08:18 -05:00
Mike Frysinger 2a83e65fc2 newlib: rtems: drop redundant header install
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.
2022-02-16 20:03:57 -05:00
Mike Frysinger 01ed65ed09 newlib: add missing mkdir to header install
Make sure these subdirs exist before trying to install headers into them.
2022-02-16 20:03:07 -05:00
Mike Frysinger 40748cd73a newlib: powerpc: simplify reallocr & callocr build logic
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.
2022-02-16 20:00:27 -05:00
Mike Frysinger d1591ed4a1 newlib: i386/xstormy16: drop unused -I libm/common flag
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.
2022-02-16 19:58:13 -05:00
Takashi Yano 9f1930bf34 Cygwin: wincap: Add capabilities for Windows 11.
- 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.
2022-02-16 19:59:14 +09:00
Brian Inglis 97b8a93b3c fhandler_proc.cc(format_proc_cpuinfo): fix bad bits in last change
move Linux 5.16 Gobble Gobble flags to 5.17 Superb Owl correct positions:
0x00000007:1 Intel Advanced Matrix eXtensions:
		 EAX:22 amx_bf16 Brain Float 16 dot product
		 EAX:24 amx_tile Tile matrix multiply
		 EAX:25 amx_int8 Int 8 byte dot product
0x00000007:0 Intel Advanced Matrix eXtensions:
		 EDX:22 amx_bf16 Brain Float 16 dot product
		 EDX:24 amx_tile Tile matrix multiply
		 EDX:25 amx_int8 Int 8 byte dot product
2022-02-16 09:31:32 +01:00
Mike Frysinger 907764ebec newlib/libgloss: drop unused $(CROSS_CFLAGS)
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.
2022-02-15 20:02:51 -05:00
Mike Frysinger df5808b771 newlib: drop support for decstation & sunos systems
These targets don't actually cross-compile -- they try to pull some
objects out of the host's /lib/libc.a, /lib/libm.a, and /lib/crt0.o
directly and merge them into newlib's own libraries.  This is hard
to keep working and impossible to test.  Considering the vintage of
such targets, and gcc dropping them many many years ago, drop them
from newlib too.  This will make cleaning up the build a lot easier.
2022-02-15 20:00:58 -05:00
Mike Frysinger b7f2965dc3 newlib: rename doc/local.mk to Makefile.inc
For consistency across the whole tree.
2022-02-15 19:59:53 -05:00
Mike Frysinger ac90a6590b newlib: phoenix: merge configure up to top-level
Merge sys/phoenix/ configure logic into libc/ itself.  This kills
off the last lingering script in this tree (other than libc itself).
2022-02-15 19:59:08 -05:00
Mike Frysinger 86432e55b4 newlib: phoenix: merge machine/ configure scripts up a level
The machine configure scripts are all effectively stub scripts that
pass the higher level options to its own makefile.
2022-02-15 19:59:08 -05:00
Mike Frysinger d470ef6463 newlib: phoenix: merge machine/ trampoline up a level
The machine/{configure,Makefile} files exist only to fan out to the
specific machine/$arch/ subdir.  We already have all that same info
in the phoenix/ dir itself, so by moving the recursive configure and
make calls into it, we can cut off this logic entirely and save the
overhead.
2022-02-15 19:59:08 -05:00
Mike Frysinger 16c12761fd newlib: phoenix: drop missing machine subdirs
These were never added to the tree, and as we transition from autoconf
to automake, it really wants the latter subdirs to always exist.  These
don't, so delete the logic.
2022-02-15 19:59:08 -05:00
Mike Frysinger 5a6bf1749f newlib: phoenix: move some logic from configure to the Makefile
These configure scripts hardcode some settings, so move them to the
Makefile to simplify so we can drop the configure scripts entirely.
2022-02-15 19:59:08 -05:00
Andoni Arregi ec69debcb9 Improve lgammaf range for very small cases
The original cut for small arguments at |x|<2**-70 (copied from the
double version) produces that when computing nadj we get a subnormal
number for t*x and thus, the division of pi/subnormal will be INF and
the logarithm of it too, which is wrong as a result for lgammaf in this
range.
The proposed new limit seems to be safe and has been tested to
produce accurate results.
(Courtesy of Andreas Jung, ESA)
2022-02-14 14:44:11 +01:00
Takashi Yano dd65342315 Cygwin: console: Set console mode even if stdin/stdout is redirected.
- When non-cygwin app is started in console, console mode is set to
  tty::native. However, if stdin is redirected, current code does not
  set the input mode of the console. In this case, if the app opens
  "CONIN$", the console mode will not be appropriate for non-cygwin
  app. This patch fixes the issue.

Addresses:
https://github.com/GitCredentialManager/git-credential-manager/issues/576
2022-02-13 23:55:59 +09:00
Takashi Yano cb0e392903 Cygwin: console: Fix console mode for non-cygwin inferior of GDB.
- Currently, there is no chance to change console mode for non-cygwin
  inferior of GDB. With this patch, the console mode is changed to
  tty::native in CreateProcess() and ContinueDebugEvent() hooked in
  fhandler_console.
2022-02-13 23:55:59 +09:00
Takashi Yano bed1add783 Cygwin: pty: Fix a bug in tty_min::segpgid().
- In tty_min::setpgid(), a pointer to fhandler instance is casted to
  fhandler_pty_slave and accessed even if terminal is not a pty slave.
  This patch fixes the issue.
2022-02-13 23:55:59 +09:00
Takashi Yano c4704c7c20 Cygwin: pty: Discard input in from_master_nat pipe on signal as well.
- Currently, pty discards input only in from_master pipe on signal.
  Due to this, if pty is started without pseudo console support and
  start a non-cygwin process from cmd.exe, type adhead input is not
  discarded on signals such as Ctrl-C. This patch fixes the issue.
2022-02-13 23:55:59 +09:00
Takashi Yano b958e1f03a Cygwin: pty: Revise the code to wait for completion of forwarding.
- With this patch, the code to wait for completion of forwarding of
  output from non-cygwin app is revised so that it can more reliably
  detect the completion.
2022-02-13 23:55:59 +09:00
Takashi Yano bddd9c1c41 Cygwin: pty: Prevent deadlock on echo output.
- If the slave process writes a lot of text output, doecho() can
  cause deadlock. This is because output_mutex is held in slave::
  write() and if WriteFile() is blocked due to pipe full, doecho()
  tries to acquire output_mutex and gets into deadlock. With this
  patch, the deadlock is prevented on the sacrifice of atomicity
  of doecho().
2022-02-13 23:55:59 +09:00
Takashi Yano b04aea00f1 Cygwin: pty: Pass Ctrl-Z (EOF) to non-cygwin apps with disable_pcon.
- Previously, non-cygwin app running in pty started without pseudo
  console support was suspended by Ctrl-Z rather than sending EOF.
  Even worse, suspended app could not be resumed by fg command. With
  this patch, Ctrl-Z (EOF for non-cygwin apps) is passed to non-cygwin
  app instead of suspending that app. This patch also handles Ctrl-\
  (QUIT) and Ctrl-D (EOF) as well.
2022-02-13 23:55:59 +09:00
Takashi Yano c05c36a7c8 Cygwin: pty, console: Fix Ctrl-C handling for non-cygwin apps.
- Currently, if cat is started from cmd.exe which is started in cygwin
  console, Ctrl-C terminates not only cat but also cmd.exe. This also
  happens in pty in which pseudo console is disabled. This patch fixes
  the issue.
2022-02-13 23:55:59 +09:00
Mike Frysinger d4fa7379b0 libgloss: bfin: fix various warnings
No functional changes here, just fix warnings the compiler noticed.

bfin/syscalls.c:156:13: warning: conflicting types for built-in function ‘memset’

bfin/syscalls.c: In function ‘_unlink’:
bfin/syscalls.c:193:3: warning: passing argument 2 of ‘do_syscall’ discards qualifiers from pointer target type
bfin/syscalls.c:33:1: note: expected ‘void *’ but argument is of type ‘const char *’

bfin/syscalls.c: In function ‘_exit’:
bfin/syscalls.c:104:1: warning: ‘noreturn’ function does return
2022-02-12 01:34:21 -05:00
Mike Frysinger 395ce0f4c0 libgloss: bfin: fix local header usage after automake move
Compiling the basiccrt .S files missed an include to the local bfin/
headers causing the build to break when installing anew.

Reported-by: Jeff Law <jeffreyalaw@gmail.com>
2022-02-12 01:29:33 -05:00
Mike Frysinger bf167aade1 newlib: remove unused fenv flags
These look like they were just copied & pasted from common/Makefile.am.
The funcs in this dir are all stubs that don't actually call any math
or builtin functions, and a simple compile shows they produce identical
object code.  So delete to simplify the build rules.
2022-02-11 06:26:01 -05:00