Commit Graph

20575 Commits

Author SHA1 Message Date
Jeff Johnston db1fbbc495 Add tests for tzset POSIX timezone string compliance
- patch from jdbouleu <hi@jdoubleu.de>

  - create time.exp and tzset.c files in newlib/testsuite/newlib.time
2022-04-08 17:19:16 -04:00
Jeff Johnston 539ac66ffa Add angle TZ angle bracket support to tzset_r
- from Brian Inglis <Brian.Inglis@systematicsw.ab.ca>

  - add support to _tzset_unlocked_r() to support quoting std and dst
    names with angle brackets <> as per Posix
  - modify documentation of tzset.c
2022-04-08 15:10:50 -04:00
jdoubleu 2c157e7e23 fix testsuite cannot compile tests
DEJAGNU could not find the function 'newlib_target_compile', because it was defined in another file.
2022-04-07 11:27:40 -04:00
Sebastian Huber bd95aa4d33 newlib: Remove superfluous CHECK_STD_INIT() macro
This macro is unused or expands to nothing.
2022-04-01 18:17:59 +02:00
Takashi Yano e9c96f0a6d Cygwin: pipe: Avoid deadlock for non-cygwin writer.
- As mentioned in commit message of the commit b531d6b0, if multiple
  writers including non-cygwin app exist, the non-cygwin app cannot
  detect pipe closure on the read side when the pipe is created by
  system account or the the pipe creator is running as service.
  This is because query_hdl which is held in write side also is a
  read end of the pipe, so the pipe is still alive for the non-cygwin
  app even after the reader is closed.

  To avoid this problem, this patch lets all processes in the same
  process group close query_hdl using newly introduced internal signal
  __SIGNONCYGCHLD when non-cygwin app is started.

  Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251097.html
2022-04-02 01:03:15 +09:00
Matt Joyce aac414986f Remove unused _cleanup()
Removed the unused function _cleanup() from findfp.c.
2022-04-01 15:42:32 +02:00
Matt Joyce a160ee29e5 Fix bug introduced in previous patch (44b60f0c)
This fixes a bug introduced in a previous patch (Commit 44b60f0c:
Make __sdidinit unused). Removed intitialization of __cleanup from
__smakebuf_r(). All callers of __smakebuf_r() call __sinit()
through the_CHECK_INIT macro, thus __cleanup is already
initialized. This fix also allows _cleanup_r() to be made static.
Changed its name to cleanup_stdio() and removed its declaration
from local.h.
2022-04-01 15:42:32 +02:00
Brian Inglis 3e3ccfaee6 fhandler_proc.cc(format_proc_cpuinfo): add Linux Superb Owl cpuinfo flags
0x00000007:1 EBX:0  intel_ppin	Intel Protected Processor Inventory Number
0x00000006:0 EAX:19 hfi		Hardware Feedback Interface
0x00000007:0 EDX:20 ibt		Intel Indirect Branch Tracking
2022-04-01 14:53:43 +02:00
Sebastian Huber 3c722c8022 newlib: Rename __sfmoreglue() and make it static
Rename __sfmoreglue() in sfmoreglue() and make it static.  This function is
only used by __sfp() in the same translation unit.

Remove use of register keyword.
2022-03-31 07:54:04 +02:00
Sebastian Huber 7a5903078d Replace _fwalk() calls with _fwalk_reent()
Remove the _fwalk() implementation to avoid duplicated code with
_fwalk_reent().
2022-03-31 07:54:04 +02:00
Jeff Johnston 0239bc706a Commit patch from Tobias Burnus <tobias@codesourcery.com>
[PATCH] newlib: Only call _fputwc_r if ELIX_LEVEL >= 4

(nano-)vfprintf.c is enabled for ELIX_LEVEL >= 1. When _WIDE_ORIENT
is set, its __sprint_r / __sfputs_r functions unconditionally called
_fputwc_r which is only in ELEX_LEVEL >= 4. With this commit,
the _WIDE support in (nano-)vfprintf.c is disabled for ELEX_LEVEL < 4.
2022-03-30 15:58:06 -04:00
Takashi Yano 49a00a0673 Cygwin: pty: Fix crash on master close in Windows 7.
- The 4th parameter of WriteFile() cannot be NULL especially in
  Windows 7 as mentioned in Microsoft documentation. This patch
  fixes that.

Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251162.html
2022-03-30 12:46:08 +09:00
Mike Frysinger be9c0561e7 newlib: drop phoenix support
This code has not been updated since 2016, and it looks like it has
rotted quite a bit since.  It does not build against the current set
of phoenix sources -- I had to hack both the kernel headers and the
newlib headers up to get it to build, and I still have no idea if it
actually links or runs.  It seems like the project itself has moved
away from newlib and to its own C library:
https://phoenix-rtos.com/documentation/libc/README.md

So since there's no interest from the phoenix folks to maintain this,
and it has a significant amount of non-standard code that we try to
keep up-to-date (without actually testing it), just punt it all.
2022-03-28 23:17:06 -04:00
Andrew Stubbs 761ef3b434 amdgcn: Fix build failure
The recent makefile reorganization broke the amdgcn port by creating
duplicate __malloc_lock symbols.  This patch fixes the problem by renaming
the malloc_support.c file to mlock.c, thus overriding the default symbol
properly.  Actually, I'm not sure how this ever worked?
2022-03-22 21:45:16 -04:00
Sebastian Huber 64b208103d iconv: Fix EL/IX level 2 handling
Consistently use

	if !ELIX_LEVEL_1

to enable EL/IX level 2 interfaces.
2022-03-21 11:32:59 +01:00
Jeff Law 157f03053d Revert accidental change to v850/sim.ld 2022-03-20 10:19:45 -04:00
Jeff Law 0c8679e080 Avoid using common symbols in v850 libgloss
I've had this lying around for probably a year or two at this point.
It just changes all the instance of "errno" from a common symbol to an
extern.  I can't offhand recall where the actual definition is, but it
certainly exists in the generic code.
2022-03-19 20:01:33 -04:00
Takashi Yano 090797e3d3 Cygwin: console: Do not use memcmp() to compare INPUT_RECORD.
- Using memcmp() to compare structure such as INPUT_RECORD is not
  correct manner because padding may not be initialized. This patch
  stops to use memcmp() for comparison of INPUT_RECORD.
2022-03-19 09:21:04 +09:00
Takashi Yano 92519e3d0c Cygwin: console: Ignore dwControlKeyState in event comparison.
- dwControlKeyState also may be null'ed on WriteConsoleInputW().
  Therefore ignore it in event comparison as well as wVirtualKeyCode
  and wVirtualScanCode.
2022-03-19 08:43:24 +09:00
Takashi Yano 8d3271b7fa Cygwin: console: Add attach_mutex guard that was not added. 2022-03-18 23:28:36 +09:00
Takashi Yano fcb182387a Cygwin: console: Fix typeahead key swapping which still occurs.
- The commit "Cygwin: console: Improve the code to avoid typeahead
  key swapping." did not solve the problem enough. Two unexpected
  things happen.
  (1) wVirtualKeyCode and wVirtualScanCode of readback key event may
      be null'ed even if they are not zero on WriteConsoleInputW().
      Therefore, memcmp() may report the event sequence is not equal.
  (2) WriteConsoleInputW() may not be atomic. The event sequence
      which is written by WriteConsoleInputW() may be inserted by
      key input in the middle of the sequence. Current code gives
      up to fix in this situation.
  This patch should fix that issue.
2022-03-18 22:47:01 +09:00
Mike Frysinger d88cbd0e7c newlib: enable automatic dependency generation
This was disabled as part of the migration away from the cygnus option
as that implied no-dependencies.

We currently have 1-to-1 updates enabled -- if you touch a .c file,
the corresponding .o file will be rebuilt.  But if you touch a header
file, none of the files using that get rebuilt.
2022-03-17 20:38:17 -04:00
Mark Geisert 48c9ef6780 Cygwin: document recent gmondump formatting fix 2022-03-17 10:14:38 +01:00
Mark Geisert 3976513b99 Cygwin: Fix gmondump formatting goofs
The rewrite of %X to %p was malhandled.  Fix that/them.
2022-03-17 10:14:23 +01:00
Mike Frysinger 461a28a566 winsup: disable fortify source
When using a compiler that automatically enables -D_FORTIFY_SOURCE,
building winsup fails with errors like below.  Since winsup is not
setup to compile itself with _FORTIFY_SOURCE, disable it for now.

make[4]: Entering directory '.../x86_64-pc-cygwin/winsup/cygwin'
  CC       libc/minires-os-if.o
In file included from .../newlib/newlib/libc/include/ssp/strings.h:34,
                 from .../newlib/newlib/libc/include/strings.h:77,
                 from .../newlib/newlib/libc/include/string.h:24,
                 from ../../../../../winsup/cygwin/string.h:12,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
                 from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
                 from ../../../../../winsup/cygwin/winlean.h:56,
                 from ../../../../../winsup/cygwin/winsup.h:84,
                 from ../../../../../winsup/cygwin/libc/minires-os-if.c:13:
.../newlib/winsup/cygwin/include/ssp/socket.h:9:1: error: conflicting types for 'recv';
  have 'ssize_t(int,  void *, size_t,  int)' {aka 'long int(int,  void *, long unsigned int,  int)'}
    9 | __ssp_redirect0(ssize_t, recv, \
      | ^~~~~~~~~~~~~~~
In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17,
                 from ../../../../../winsup/cygwin/libc/minires-os-if.c:14:
/usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1022:34: note: previous declaration of 'recv' with
  type 'int(SOCKET,  char *, int,  int)' {aka 'int(long long unsigned int,  char *, int,  int)'}
 1022 |   WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags);
      |                                  ^~~~
In file included from .../newlib/newlib/libc/include/ssp/strings.h:34,
                 from .../newlib/newlib/libc/include/strings.h:77,
                 from .../newlib/newlib/libc/include/string.h:24,
                 from ../../../../../winsup/cygwin/string.h:12,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
                 from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
                 from ../../../../../winsup/cygwin/winlean.h:56,
                 from ../../../../../winsup/cygwin/winsup.h:84,
                 from ../../../../../winsup/cygwin/libc/minires-os-if.c:13:
.../newlib/winsup/cygwin/include/ssp/socket.h:13:1: error: conflicting types for 'recvfrom';
  have 'ssize_t(int,  void *, size_t,  int,  struct sockaddr *, socklen_t *)' {aka 'long int(int,  void *, long unsigned int,  int,  struct sockaddr *, int *)'}
   13 | __ssp_redirect0(ssize_t, recvfrom, \
      | ^~~~~~~~~~~~~~~
In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17,
                 from ../../../../../winsup/cygwin/libc/minires-os-if.c:14:
/usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1023:34: note: previous declaration of 'recvfrom' with
  type 'int(SOCKET,  char *, int,  int,  struct sockaddr *, int *)' {aka 'int(long long unsigned int,  char *, int,  int,  struct sockaddr *, int *)'}
 1023 |   WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen);
      |                                  ^~~~~~~~
make[4]: *** [Makefile:1930: libc/minires-os-if.o] Error 1
  CC       gmon.o
../../../../../winsup/cygwin/gmon.c:60: error: "bzero" redefined [-Werror]
   60 | #define bzero(ptr,size) memset (ptr, 0, size);
      |
In file included from .../newlib/newlib/libc/include/strings.h:77,
                 from .../newlib/newlib/libc/include/string.h:24,
                 from ../../../../../winsup/cygwin/string.h:12,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163,
                 from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9,
                 from /usr/x86_64-pc-cygwin/usr/include/windows.h:69,
                 from ../../../../../winsup/cygwin/winlean.h:56,
                 from ../../../../../winsup/cygwin/winsup.h:84,
                 from ../../../../../winsup/cygwin/gmon.h:69,
                 from ../../../../../winsup/cygwin/gmon.c:47:
.../newlib/newlib/libc/include/ssp/strings.h:43: note: this is the location of the previous definition
   43 | #define bzero(dst, len) \
      |
cc1: all warnings being treated as errors
2022-03-16 22:03:33 -04:00
Mike Frysinger fb42151a18 newlib: libm: integrate tests subdir
Integrate the old libm/test/ subdir into the main build.  It hasn't
been used in a long time causing the code to rot a bit.  I've fixed
some of those, but it still fails for many ports, so it's disabled
by default.  People who want to take a closer look can run:
$ make libm/test/test
2022-03-16 22:01:19 -04:00
Mike Frysinger 958833a0d3 newlib: integrate iconv update to maintainer build
To help prevent people from missing running this script, integrate it
into the build via maintainer mode.

Also fix the inverted exit status to make this work correctly -- for
some reason, it exited 1 when it worked, and 0 when it failed.
2022-03-16 21:59:57 -04:00
Mike Frysinger f2471da7db newlib: update build system generation documentation
Replace all of the individual autotool steps with a single autoreconf.
This simplifies the documentation greatly, and in the current system,
only takes ~10 seconds to regenerate everything.

Update the developer documentation to cover all the major components
of the current build system.  Hopefully this is a fairly complete road
map to everything.  I tried to include everything that I wish I knew
when I started hacking on this :P.
2022-03-16 21:59:09 -04: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
Takashi Yano ed32020682 Cygwin: Add description of fsync() fix to 3.3.5 release notes. 2022-03-15 08:15:29 +09:00
Takashi Yano 0dad577b4b Cygwin: path: Convert type of variable 'remlen' to DWORD.
- Variable remlen stores the return value of QueryDosDeviceW(), so
  it is better to be DWORD.
2022-03-14 21:56:03 +09:00
Takashi Yano 7df94e3b4f Cygwin: path: Add fallback for DFS mounted drive.
- If UNC path for DFS is mounted to a drive with drive letter, the
  error "Too many levels of symbolic links" occurs when accessing
  to that drive. This is because GetDosDeviceW() returns unexpected
  string such as "\Device\Mup\DfsClient\;Z:000000000003fb89\dfsserver
  \dfs\linkname" for the mounted UNC path "\??\UNC\fileserver\share".
  This patch adds a workaround for this issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2022-March/250979.html
2022-03-14 20:29:23 +09:00
Takashi Yano af8a7c13b5 Cygwin: fsync: Return EINVAL for special files.
- Unlike linux, fsync() calls FlushFileBuffers() even for special
  files. This causes the problem reported in:
    https://cygwin.com/pipermail/cygwin/2022-March/251022.html
  This patch fixes the issue.
2022-03-14 19:38:49 +09:00
Mike Frysinger b2d4dc167c newlib: xstormy16: move malloc multiplex logic from build to source files
Rather than define per-object rules in the Makefile, have small files
that define & include the right content.  This simplifies the build
rules, and makes understanding the source a little easier (imo) as it
makes all the subdirs behave the same: you have 1 source file and it
produces 1 object.  It's also about the same amount of boiler plate,
without having to define custom build rules that can fall out of sync.

We also realign the free & pvalloc definitions: common code puts these
in malloc.o & valloc.o respectively, not in free.o & pvalloc.o objects.

This will also be important as we merge the libc.a build into the top
dir since it relies on a single flat list of objects for overrides.
2022-03-13 17:12:03 -04:00
Mike Frysinger 8c383e9ae7 newlib: xstormy16: break up mallocr stubs
Move the multiplex logic out of the build and into source files to
make the build rules a lot simpler.
2022-03-13 17:12:03 -04:00
Mike Frysinger 5cd957ff66 newlib: xstormy16: fix mallopt definition & mstats handling
The mallopt symbol is defined in tiny-malloc.c, not mallocr.c, but
the Makefile in here tries to compile it out of the latter.  This
leads to mallopt never being defined.

The build also creates mallinfo.o & mallopt.o & mallstats.o objects
to override common ones, but the common dir doesn't use these names.
Instead, it places these all in mstats.o.

So move the build define logic to a dedicated file and compile it
directly to make things a bit simpler while fixing the missing func
and aligning objects with the cmomon code.
2022-03-13 17:12:03 -04:00
Takashi Yano b1743c94e2 Cygwin: console, pty: Fix segfault in child_info_spawn::worker().
- After the commit "Cygwin: pty, console: Fix handle leak which
  occurs on exec() error.", startxwin cannot start X due to the
  error "Failed to activate virtual core keyboard: 2". The problem
  is access violation in the code retrieving the pgid of the ctty.
  This patch fixes the issue.

  Addresses: https://cygwin.com/pipermail/cygwin/2022-March/251013.html
2022-03-10 20:38:20 +09:00
Mike Frysinger 4ad6b4d4df newlib: libc: move stdlib multiplex logic from build to source files
Rather than define per-object rules in the Makefile, have small files
that define & include the right content.  This simplifies the build
rules, and makes understanding the source a little easier (imo) as it
makes all the subdirs behave the same: you have 1 source file and it
produces 1 object.  It's also about the same amount of boiler plate,
without having to define custom build rules that can fall out of sync.

This will also be important as we merge the libc.a build into the top
dir since it relies on a single flat list of objects for overrides.

Also take the opportunity to clean up the unnecessary header deps in
here.  Automake provides dependency generation for free now.
2022-03-09 16:58:46 -05:00
Sebastian Huber 332df71d34 build: Avoid length() awk function
Some awk implementations such as old versions of mawk do not support the
length() function.  Use the return value of the POSIX split() function instead.
2022-03-09 12:04:11 +01:00
Mike Frysinger b1b44f777c newlib: rename mallocr.c to _mallocr.c
This file is a little confusing: it provides all of the mallocr logic,
but is compiled multiple times to produce a unique symbol each time.
For example, building mallocr.c with -DDEFINE_FREER produces freer.o
that only defines _free_r().  This is fine for most symbols, but it's
a little confusing when defining mallocr itself -- we produce a file
with the same symbol name, but we still need -DDEFINE_MALLOCR.  In
order to move the logic from the build rules to source files, using
mallocr.c both as a multiplexer and for defining a single symbol is a
bit tricky.  It's possible (if we add a lot of redundant preprocessor
checks to mallocr.c, or we add complicated build flags just for this
one files), but it's easier if we simply rename this to a dedicated
file.  So let's do that.

We do this as a dedicated commit because the next one will create a
new mallocr.c file and git's automatic diff algorithms can handle
trivial renames, but it can't handle renames+creates in the same
commit.
2022-03-09 04:12:46 -05:00
Mike Frysinger d7b16b0576 newlib: move nano-malloc logic from build to source files
Simplify the build system logic a bit by moving the mallocr.c ->
nano-mallocr.c redirection from the Makefile to the source files.
This allows for consistent object name usage regardless of the
configuration options used in case a machine dir wants to define
its own override.
2022-03-09 04:12:45 -05:00
Jeff Johnston 5fca4e0f18 Fix Bug libc/28945
- apply fix from Tom de Vries <vries@gcc.gnu.org>
  to have calloc zero out storage for nvptx calloc function
2022-03-07 15:35:02 -05:00
Takashi Yano 9e1b329431 Cygwin: update 3.3.5 release notes 2022-03-05 18:21:09 +09:00
Takashi Yano 33dda55d14 Cygwin: add 3.3.5 release notes 2022-03-05 11:19:20 +09:00
Takashi Yano 7c87cce6e2 Cygwin: pty: Adopt the variable name to the name generally used.
- Generally, '\n' is called "line feed" (not "new line"), so the
  variable name p_nl has been changed to p_lf.
2022-03-05 09:39:26 +09:00
Takashi Yano 6c622490a5 Cygwin: pty: Add several further comments to the pty code. 2022-03-05 08:39:05 +09:00
Takashi Yano 21860254da Cygwin: pty: Take account of CR+NL line feed in input.
- Currently, individual CR or NL is treated as line feed in
  accept_input() and transfer_input(). This patch takes account
  of CR+NL as well.
2022-03-05 00:29:11 +09:00
Takashi Yano 51095fe2ba Cygwin: pty: Fix a possible race issue in initialization of pcon.
- Currently, tty::pcon_start flag is cleared before transfer_input()
  in master::write(), however, the code in setup_pseudoconsole()
  waits for transfer_input() using tty::pcon_start. This possibly
  causes the race issue. The patch fixes this potential issue.
2022-03-04 22:23:39 +09:00
Takashi Yano 3d46583d4f Cygwin: pty: Update some comments in pty code. 2022-03-04 22:00:24 +09:00
Takashi Yano bb98c26e16 Cygwin: pty: Omit transfer_input() call where it is no longer needed.
- This patch removes the old code which calls transfer_input() but
  is no longer needed. These code was necessary indeed in the past,
  however, as a result of recent frequent code changes, it is no
  longer needed.
2022-03-04 20:04:24 +09:00