The definition of PTR has been dropped from newer versions
of ansidecl.h.
Convert definition of print_section_name to use void * instead,
as required by bfd_map_over_sections.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The new _MB_CAPABALE-only _misc_reent member getlocalename_l_buf was
incorrectly initialized in the _REENT_INIT_MISC macro, so the build
failed for _REENT_SMALL targets, independet of the _MB_CAPABALE setting.
Fixes: 71511d4ac8 ("getlocalename_l: implement per SUS Base Specifications Issue 8 draft")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
...in a non-Cygwin child process. Backported from MSYS2.
Downstream commit message follows.
In https://github.com/msys2/msys2-runtime/pull/18, we discussed a change
that would allow default Windows error handling of spawned processes to
kick in (such as registered JIT debuggers). We even agreed that it would
make sense to hide this functionality behind a flag, `winjitdebug`.
However, when this got upstreamed as 21ec498d7f (cygwin: use
CREATE_DEFAULT_ERROR_MODE in spawn, 2020-12-09), that flag was deemed
unnecessary.
But it would appear that it _is_ necessary: As reported in
https://github.com/msys2/MSYS2-packages/pull/2414#issuecomment-810841296
this new behavior is pretty disruptive e.g. in CI scenarios.
So let's introduce that `winjitdebug` flag (settable via the environment
variable `MSYS`) at long last.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Currently, if_nametoindex() and if_indextoname() handle interface names
such as "ethernet_32777", while if_nameindex() returns the names such
as "{5AF7ACD0-D52E-4DFC-A4D0-54D3E6D6B2AC}". This patch unifies the
interface names to the latter.
Fixes: c356901f0d ("Rename if_indextoname to cygwin_if_indextoname (analag for if_nametoindex)")
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
If disable_master_thread flag is set between the code checking that
flag not be set and the code acquiring input_mutex, input record is
processed once after setting disable_master_thread flag. This patch
prevents that.
Fixes: d4aacd50e6 ("Cygwin: console: Add missing input_mutex guard.")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
If non-cygwin process is executed in console, the exit code is not
set correctly. This is because the stub process for non-cygwin app
crashes in fhandler_console::set_disable_master_thread() due to NULL
pointer dereference. This bug was introduced by the commit:
3721a756b0 ("Cygwin: console: Make the console accessible from
other terminals."), that the pointer cons is accessed before fixing
when it is NULL. This patch fixes the issue.
Fixes: 3721a756b0 ("Cygwin: console: Make the console accessible from other terminals.")
Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
cmdline has to be initialized, otherwise the return value is
undefined in case generating the command line fails.
Fixes: 732afede93 ("Cygwin: redefine CW_CMDLINE to CW_CMDLINE_ALLOC")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
IsBadStringPtr is deprecated and just gives a wrong sense
of memory safety. Replace with check for NULL pointer.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
On Linux, __progname and program_invocation_short_name are just
different exported names of the same string. Do the same in Cygwin.
This requires to tweak the mkglobals_h so as not to touch the
EXPORT_ALIAS expression. Also, use the base variable
program_invocation_short_name throughout. __progname is just
the export for getopt.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Since it's possible to change the __argv array, we should not rely
on __argv[0] actually representing the windows executable path in
any way. Use the real path stored in global_progname instead.
Fixes: 521953a83a ("* common.din: Export GetCommandLine{A,W}.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
So far ps(1) always prints the full path of the executable under
the COMMAND heading.
With -f, print the command line instead.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Make sure to
- append a trailing \0 as with Windows multistrings, so the end of
the string can be recognized by the caller, and
- allocate cmdline on the user heap so the caller can free the
multistring after usage.
Fixes: 831d6fa520 ("* external.cc (cygwin_internal): Implement CW_CMDLINE.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- Basically maintain a hidden DIR* inside fhandlers.
- lseek has to be tweaked to allow basic seeking on the directory
descriptor.
- the current implementation does not keep the dir positions
between duplicated descriptor in sync. In fact, every descriptor
keeps its own copy of the DIR* and after dup/fork/exec, the
directory position is reset to 0, i. e., to the start of the
directory, as if rewinddir() has been called on the new descriptors.
While this behaviour isn't yet covered by the Issue 8 draft,
a bug report along these lines exists and will probably be
picked up for TC1.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
The content of DIR should never have been exposed into userspace.
Move struct __DIR to local dirent.h and only keep forward declaration
in exported dirent.h.
This allows to tweak the structure in future, for instance, to
add thread-safety.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This change is in preparation of adding posix_getdents() from
the upcoming POSIX Base Specification Issue 8.
- Add d_reclen
- Add GLibC compatible test macros for dirent members
- Bump dirent version
- Set d_reclen to the fixed size of the dirent struct
We can do that because the size is a multiple of 8, so it fits
snugly in the buffer filled by posix_getdents and keep the
alignement.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
#include <locale.h>
const char *getlocalename_l(int category, locale_t locobj);
Most notably, we need a per-thread space to store the string
returned if locobj is LC_GLOBAL_LOCALE. No errors are defined
for getlocalename_l. So we can't use buffer allocation which
might lead to an ENOMEM error. We have to use a "static" buffer
in the per-thread state.
Note that the feature test macro in locale.h is not quite correct.
This needs to be fixed as soon as the
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
- drop appending .exe.lnk to files
- drop exe_suffixes, it's the same as stat_suffixes for a long time
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Remove a stray __END_DECLS. It didn't hurt in the only
(plain C) file including this header, but still...
Fixes: 030a762535 ("Cygwin: fix arc4random after fork(2)")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
If specified, use __builtin_dynamic_object_size() instead of
__builtin_object_size() if supported (GCC 12.0 or later).
This enables buffer overflow checks if the buffer size is non-const
but known during runtime.
Use new macro __ssp_bos_known() instead of the (bos(p) != (size_t)-1)
checks. The latter is no longer a compile time constant in all cases.
This avoids the generation of unused code.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
After using fork(), arc4random does not reseed itself, which
causes the results to become predictable. Activate droppingfork-recognition
Fixes: e0fc33322d ("Delete Cygwin's arc4random in favor of new Newlib implementation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
So far the global variable in_forkee only indicated if the
process is the child process during fork(2) itself.
However, we need an indicator accessible from plain C code
in newlib, allowing to check for a process being a forked
process all the time, after fork(2) succeeded.
Redefine bool in_forkee to int __in_forkee to allow exposing
it to newlib. Redefine how it indicates fork state (not
forked, forking, forked).
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
If pthread_once() is called with pthread_once_t initialized using
PTREAD_ONCE_INIT, pthread_once does not release pthread_mutex used
internally. This patch fixes that by calling pthread_mutex_destroy()
in the thread which has called init_routine.
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
A process which is exiting due to a core dumping signal doesn't
propagate the correct exist status after dumping core, because 'dumper'
itself forcibly terminates the process.
Use 'dumper -n' to avoid killing the dumped process, so we continue to
the end of signal_exit(), to exit with the 128+signal exit status.
Busy-wait in exec_prepared_command() in an attempt to reliably notice
the dumper attaching, so we don't get stuck there.
Also: document these important facts for custom uses of error_start.
Avoid a recursive make to speed things up a bit.
A cr16-elf build shows installed objects & libs produce same code.
The test targets were dropped as they didn't actually work -- there
is no test.o rule in here.
This patch is required to fix how the newlib headers are installed
when using a sysroot install directory.
The cross compiler expects headers to be in
.../host/usr/arm-none-eabi/sysroot/usr/include/newlib.h
by default newlib installed the headers into
.../host/usr/arm-none-eabi/sysroot/usr/arm-none-eabi/include/newlib.h
${exec_prefix} provides the .../host/usr/arm-none-eabi/sysroot path
${target_noncanonical} provides an extra arm-none-eabi/ that must be removed.
With this patch, users can specify the tooldir path that is needed.
Signed-off-by: Neal Frager <neal.frager@amd.com>
Co-developed-by: Chris Wardman <cjwfirmware@vxmdesign.com>
Strip a few more instructions from crt0-minrt.S:
- Remove "halt" and rely on the infinite loop after main()'s return.
- Remove main()'s argc and argv argument initialization. Host loader
does not set them, and typical firmware does not use them, either.
- Remove the __dso_handle symbol.
This should be safe because the default crt0.S is fully standards
compliant. Whereas crt0-minrt.S has been documented from the beginning
to intentionally miss features in order to reduce firmware size, while
still enabling typical PRU firmware to operate.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Avoid a recursive make to speed things up a bit. This change was
inspired by the recent similar patch for c6x:
https://sourceware.org/pipermail/newlib/2023/020869.html
While at it, fork crt0-minrt.S into a separate source file instead of
relying on a predefined macro to generate two different object files.
This improves clarity, simplifies the build rules, and would allow
further optimization in crt0-minrt.S to be implemented more cleanly.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Commit 3f3bd10104 ("* Throughout, use __try/__except/__endtry blocks [...]")
introduced setting EINVAL, marked as "Diagnosis". The reason
for this is lost in time and space, but looks very much like
a debug helper which was supposed to be removed before release.
It's rather pointless, so remove it.
Fixes: 3f3bd10104 ("* Throughout, use __try/__except/__endtry blocks [...]")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
When creating a split manual with one-node-per-page, the main index.html
ends up getting clobbered by the page for the index() function because
it uses "@node index" which, for html, also creates an index.html page.
To remedy this, add "Function " to every function node so now we output
"Function-index.html" and avoid clobbering. It also namespaces every
other function and helps make sure we don't clobber anything else.
Otherwise, there isn't really much rendering difference as @node text
is mostly internal. Node title text comes from @section instead.
The generated function documentation makes sure to include entries for
every function in the function index via @findex, but then the manuals
forget to actually print the index.