Fix a gcc 12 warning about an address known to be non-NULL in
format_proc_locale_proc().
> ../../../../src/winsup/cygwin/fhandler/proc.cc: In function ‘BOOL format_proc_locale_proc(LPWSTR, DWORD, LPARAM)’:
> ../../../../src/winsup/cygwin/fhandler/proc.cc:2156:11: error: the address of ‘iso15924’ will never be NULL [-Werror=address]
> 2156 | if (iso15924)
> | ^~~~~~~~
> ../../../../src/winsup/cygwin/fhandler/proc.cc:2133:11: note: ‘iso15924’ declared here
> 2133 | wchar_t iso15924[ENCODING_LEN + 1] = { 0 };
> | ^~~~~~~~
Fixes: c42b98bdc6 ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Fix warnings with gcc 12 about narrowing conversions of NTSTATUS
constants when used as case labels, e.g:
> ../../../../src/winsup/cygwin/exceptions.cc: In static member function ‘static int exception::handle(EXCEPTION_RECORD*, void*, CONTEXT*, PDISPATCHER_CONTEXT)’:
> ../../../../src/winsup/cygwin/exceptions.cc:670:10: error: narrowing conversion of ‘-1073741682’ from ‘NTSTATUS’ {aka ‘int’} to ‘unsigned int’ [-Wnarrowing]
See also: c5bdf60ac4
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This disables a warning seen with gcc 12 caused by intrinsics used by
the inline implementation of NtCurrentTeb() inside w32api headers.
> In function ‘long long unsigned int __readgsqword(unsigned int)’,
> inlined from ‘_TEB* NtCurrentTeb()’ at /usr/include/w32api/winnt.h:10020:86,
> [...]
> /usr/include/w32api/psdk_inc/intrin-impl.h:838:1: error: array subscript 0 is outside array bounds of ‘long long unsigned int [0]’ [-Werror=array-bounds]
See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523#c6
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Linux 6.10 changed the content of cpufeatures.h to require explicit
quoted flag names for output in comments, instead of requiring a null
quoted string "" at the start of comments to suppress flag name output.
As a result, some flags (not all for output) were renamed and others moved:
- change dts to ds; move intel_ppin down; swap ibpd and ibrs;
- change some flag names and descriptions that are not output.
Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Linux cpuinfo follows output for each processor with a blank line,
so we output newlines to get a blank line:
- newline after power management feature flags if printed;
- newline to give blank line after each processor output.
Reported-by: Achim Gratz https://cygwin.com/pipermail/cygwin/2024-July/256223.html
Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
For RISC-V, AArch64, i386, and x86_64
- k_tanl.c is required for tanl; the linker will report `__kernel_tanl`
not found when tanl is called.
- s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are already
available for ld80 but not for ld128.
This file was from a specific older FreeBSD version. There have been
multiple changes to this file with FreeBSD 14 including breaking
changes to the file. Including this file as part of newlib results
in not always having the correct version of sys/tree.h for any
specific software. RTEMS will manage its use of this file outside
of newlib.
The modifications added by the series "M-profile PACBTI-enablement"
(see 9d6b00511e) have introduced a couple
of .cfi_* instructions.
Like for e6459123e4, these instructions
create object files which contain .eh_frame sections. However, ARM uses
its own unwind info format, not .eh_frame, which is generated by
ARM-specific directives, not .cfi_*. The .eh_frame sections are useless,
but also not removed by strip and may be harmful with some linker
scripts.
Adding ".cfi_sections .debug_frame" (as in glibc) moves the generated
directives towards .debug_frame instead of .eh_frame. Making them easier
to handle.
* libc/machine/arm/aeabi_memmove-thumb2.S: Use .cfi_sections
.debug_frame.
* libc/machine/arm/aeabi_memset-thumb2.S: Likewise.
* libc/machine/arm/memchr.S: Likewise.
* libc/machine/arm/memcpy-armv7m.S: Likewise.
* libc/machine/arm/setjmp.S: Likewise.
* libc/machine/arm/strlen-armv7.S: Likewise.
* libc/machine/arm/strlen-thumb2-Os.S: Likewise.
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix
Use of stdatomic.h is undefined in C++, even the C++ 2020 standard does not
list stdatomic.h as a C library header supported by the language. More,
there are some subtle differences between the <atomic> C++ header, and
C11+ stdatomic.h provided features.
Nonetheless, it is a quality of the implementation aspect, so let mis-users
mis-use stdatomic.h as they want, by making a compat shim for _Bool.
PR: 262683
Reported by: yuri
Reviewed by: dim, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34686
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
If the master process of GNU screen or tmux is started in ConEmu
and ConEmu is closed, reattaching to the GNU screen/tmux in another
console will not work correctly. This is because the ConEmu master
process was already closed even though some console APIs are hooked
by ConEmuHk64.dll to communicate with ConEmu master process. With
this patch, to make them unhooked, DllMain() of ConEmuHk64.dll is
called with DLL_PROCESS_DETACH.
Fixes: 3721a756b0 ("Cygwin: console: Make the console accessible from other terminals.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Previously, if two or more processes request to allocate a console at
the same time, the same device number could be accidentally allocated.
This patch fixes the issue by creating a named mutex (input_mutex) and
checking if GetLastError() is ERROR_ALREADY_EXIST or not to ensure
the unit number will be allocated in an atomic way. Thanks to this,
EnumWindow() is not necessary anymore to scan console units.
This also makes minor device numbers unique and console devices visible
across sessions. This disallows duplicated device number for different
sessions, so the MAX_CONS_DEV has been increased from 64 to 128.
Additionally, the console allocation and scanning will be faster as
a side effect of eliminating EnumWindows().
Fixes: 3721a756b0 ("Cygwin: console: Make the console accessible from other terminals.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
The commit baf2764dca has a serious bug that shared_info_state is
common for all console devices despite it should be individual for
each console device. This patch fixes that.
Fixes: baf2764dca ("Cygwin: console: Fixes an issue that tmux can not run on the console.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
After the commit c77a5689f7, tmux can not run on the console.
This patch replaces the countermeasure for the race issue between
console setup and close with another mechanism using a mutex.
Fixes: c77a5689f7 ("Cygwin: console: Do not unmap shared console memory belonging to ctty.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Previously, shared names in the console were created using get_minor().
However, get_minor() was not unique to the console across sessions.
This is because EnumWindows(), which is used to look for console windows,
cannot enumerate windows across sessions. This causes conflict on the
shared names between sessions (e.g. sessions of different users,
different services, a service and a user session, etc.).
With this patch, GetConsoleWindow() is used instead of get_minor().
GetConsoleWindow() has been used for the name of shared memory, which
should be unique to each console.
Addresses: https://cygwin.com/pipermail/cygwin/2024-April/255893.html
Fixes: ff4440fcf7 ("Cygwin: console: Introduce new thread which handles input signal.");
Reported-by: Johannes Khoshnazar-Thoma <johannes@johannesthoma.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
The vfma.f32|64 z, x, y instruction performs the operation
z += x * y without intermediate rounding.
The register used for z is both read and written by the instruction.
The inline assembly must therefore use the "+" constraint modifier.
Previsouly, the following commands hangs:
mintty -e timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaa | cat'
The mechanism is as follows.
When the child process (timeout) is terminated, mintty seems to stop
reading pty master even if yes or cat still alive.
If the the pipe used to transfer output from pty slave to pty master
is full due to lack of master reader, WriteFile() to the pipe is
blocked. WriteFile() cannot be canceled by cygwin signal, therefore,
pty slave hangs.
This patch avoids hanging by checking pipe space before calling
WriteFile() and prevents writing data more than space.
Addresses: https://cygwin.com/pipermail/cygwin/2024-June/256178.html
Reported-by: jojelino <jojelino@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Previously, the following steps failed with error:
1) Open /dev/dsp with O_RDONLY
2) Open /dev/dsp with O_WRONLY
3) Issue SNDCTL_DSP_GETOSPACE ioctl() for 2)
This is because IS_WRITE() returns false for 2) due to incorrect
openflags handling in archetype instance. This patch fixes the
issue by adding open_setup() to fhandler_dev_dsp to set openflags
correctly for each instance.
Fixes: 92ddb74290 ("* fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
The SuperH target doesn't build on GCC 14.1 because of missing
function prototypes or because some function declarations use the
deprecated K&R style. This patch adds missing prototypes on the files
the functions are used and convert K&R declarations to ANSI-style.
Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
The linker needs to know whether a symbol is STT_FUNCTION when
deciding which farcall stub to emit (if needed), this patch adds this
to the FUNC_START macro which is used in crt0.
w32api 12.0.0 adds the returns_twice attribute to RtlCaptureContext().
There's some data-flow interaction with using it inside a while loop
which causes a maybe-uninitialized warning.
../../../../winsup/cygwin/exceptions.cc: In member function 'int _cygtls::call_signal_handler()':
../../../../winsup/cygwin/exceptions.cc:1720:33: error: '<anonymous>' may be used uninitialized in this function [-Werror=maybe-uninitialized]
The rest of "long double" functions aren't compiled with long double
and double are not the same. Do the same for all complex functions.
Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
If ldd is run against a DLL which links to the Cygwin DLL, ldh will end
up loading the Cygwin DLL dynamically, much like cygcheck or strace.
Addresses: https://cygwin.com/pipermail/cygwin/2024-May/255991.html
Fixes: 60675f1a7e ("Cygwin: decouple shared mem regions from Cygwin DLL")
Reviewed-by: Ken Brown <kbrown@cornell.edu>, Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
To avoid race issues, pthread::once() uses pthread_mutex. This caused
the handle leak which was fixed by the commit 2c5433e5da. However,
this fix introduced another race issue, i.e., the mutex may be used
after it is destroyed. This patch fixes the issue. Special thanks to
Bruno Haible for discussing how to fix this.
Addresses: https://cygwin.com/pipermail/cygwin/2024-May/255987.html
Reported-by: Bruno Haible <bruno@clisp.org>
Fixes: 2c5433e5da ("Cygwin: pthread: Fix handle leak in pthread_once.")
Reviewed-by: Ken Brown <kbrown@cornell.edu>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Currently, if the device does not have capability WAVECAPS_LRVOLUME,
the volume control does not work properly. This patch fixes that.
Fixes: 2a4af36614 ("Cygwin: Implement sound mixer device.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
These specs files are introduced for EMSK board:
* emsk1_em4.specs - EMSKv1 with EM4 core, everything in
ICCM/DCCM memory
* emsk1_em6.specs - EMSKv1 with EM6 core, everything in
ICCM/DCCM memory
* emsk1_em6_ram.specs - EMSKv1 with EM6 core, startup code
in ICCM and everything else in RAM
* emsk2.1_em5d.specs - EMSKv2.1 with EM5D core, everything
in ICCM/DCCM memory
* emsk2.1_em7d.specs - EMSKv2.1 with EM7D core, everything
in ICCM/DCCM memory
* emsk2.1_em7d_ram.specs - EMSKv2.1 with EM7D core, startup
code in ICCM and everything else in RAM
* emsk2.2_em7d.specs - EMSKv2.2+ with EM7D core, everything
in ICCM/DCCM memory
* emsk2.2_em7d_ram.specs - EMSKv2.2+ with EM7D core, startup
code in ICCM and everything else in RAM
* emsk2.2_em9d.specs - EMSKv2.2+ with EM9D core, everything
in ICCM/DCCM memory
* emsk2.2_em9d_ram.specs - EMSKv2.2+ with EM9D core, startup
code in ICCM and everything else in RAM
* emsk2.2_em11d.specs - EMSKv2.2+ with EM11D core, everything
in ICCM/DCCM memory
* emsk2.2_em11d_ram.specs - EMSKv2.2+ with EM11D core, startup
code in ICCM and everything else in RAM
An example of building an application:
$ arc-elf32-gcc -mcpu=em -specs=emsk2.2_em11d_ram.specs main.c -o main
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
These specs files are introduced for EM SDP board:
* emsdp1.1.specs - EM SDP 1.1, everything in ICCM/DCCM memory
* emsdp1.1_ram.specs - EM SDP 1.1, startup code in ICCM
memory and everything else in RAM
* emsdp1.2.specs - EM SDP 1.2, everything in ICCM/DCCM memory
* emsdp1.2_ram.specs - EM SDP 1.2, startup code in ICCM
memory and everything else in RAM
An example of building an application:
$ arc-elf32-gcc -mcpu=em -specs=emsdp1.1_ram.specs main.c -o main
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
An example of building an application:
$ arc-elf32-gcc -mcpu=hs -specs=hsdk.specs main.c -o main
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
An example of building an application:
$ arc-elf32-gcc -mcpu=em -specs=iotdk.specs main.c -o main
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
This library implements libgloss input/output and setup
routines for UART 8250 devices of ARC development boards:
* EM Starter Kit
* HS Development Kit
* EM Software Development Platform
* IoT Development Kit
_uart_8250_setup function with proper parameteres must be called
to setup UART 8250 device for a particular board (refer to
a board's documentation).
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
Use atexit funtion to setup fini routines to be called on exit
instead of filling in __atexit structures manually.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
There is a special interface built in ARC simulators (such as
nSIM) called MetaWare hostlink IO which can be used to implement
system calls. This commit adds support for this interface to the
ARC port of libgloss.
Here is an example of using this interface:
$ arc-elf32-gcc -mcpu=hs -specs=hl.specs main.c -o main
$ nsimdrv -tcf $NSIM_HOME/etc/tcf/templates/hs48_full.tcf main
Hello, World!
Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
The "longjmp" expects the "setjmp" to save the r58/r59 registers,
if there is any. With this change they are saved accordingly.
Checked for regression with running GCC's DejaGnu tests:
$ runtest execute.exp=pr56982.c dg-torture.exp=pr48542.c
Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
Assembler for ARCv2 always extends the name provided by
.file directive to an absolute form.
On ARCv3 targets .file directive forces assembler to put
a provided string to DW_AT_name field as is without
extending to an absolute path. Then GDB cannot find
source files because of it.
The best way to fix this issue is just delete lines
with .file directive in .S files and let the compiler
to decide what DW_AT_name must contain. Particularly,
the compiler fills this filed by an absolute path to
a .S file because only absolute paths are used in
toolchain's build process.
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
ARC supports a restricted register file with 16 registers.
However, optimized routines support only a full register
file. Thus, fallback on default implementation in case
of 16-entry register file.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
According to GCC documentation for ARC, a function marked with
the long_call attribute is always called using register-indirect
jump-and-link instructions, thereby enabling the called function
to be placed anywhere within the 32-bit address space.
exit_halt function is provided by crt0.S and it's used
in nsim-syscalls.c. Thus, we want to ensure that a linkage
issue will not arise.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
- The PRU newlib port is supposed to implement case #2 as described in
newlib/libc/include/reent.h . Thus drop the defining of
MISSING_SYSCALL_NAMES.
- libgloss/configure: Regenerate.
- libgloss/libnosys/acinclude.m4: Do not define
MISSING_SYSCALL_NAMES for pru.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>