aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-01-11libgloss: arm: break newlib dependencyMike Frysinger23-203/+25
The libgloss port has been reaching back into newlib internals for a single header whose contents have been frozen for almost a decade. To break this backwards libgloss->newlib dependency, move the acle header to the srcroot include/ so everyone can use the same copy.
2023-01-10newlib: libc: setjmp M-profile PACBTI-enablementVictor L. Do Nascimento1-0/+43
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. Save the PAC value in the jump buffer so that longjmp can only return to the authenticated location.
2023-01-10newlib: libc: aeabi_memset M-profile PACBTI-enablementVictor L. Do Nascimento1-3/+11
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags.
2023-01-10newlib: libc: aeabi_memmove M-profile PACBTI-enablementVictor L. Do Nascimento1-5/+12
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags.
2023-01-10newlib: libc: memcpy M-profile PACBTI-enablementVictor L. Do Nascimento1-9/+24
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags.
2023-01-10newlib: libc: memchr M-profile PACBTI-enablementVictor L. Do Nascimento1-6/+44
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags.
2023-01-10newlib: libc: strlen M-profile PACBTI-enablementVictor L. Do Nascimento2-6/+25
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. This patch enables PACBTI for all relevant variants of strlen: * Newlib for armv8.1-m.main+pacbti * Newlib for armv8.1-m.main+pacbti+mve * Newlib-nano
2023-01-10newlib: libc: strcmp M-profile PACBTI-enablementVictor L. Do Nascimento3-31/+60
Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. This patch enables PACBTI for all relevant variants of strcmp: * Newlib for armv8.1-m.main+pacbti * Newlib for armv8.1-m.main+pacbti+mve * Newlib-nano
2023-01-10newlib: libc: define M-profile PACBTI-enablement macrosVictor L. Do Nascimento1-0/+441
Augment the arm_asm.h header file to simplify function prologues and epilogues whilst adding support for PACBTI enablement via macros for hand-written assembly functions. For PACBTI, both prologues/epilogues as well as cfi-related directives are automatically amended accordingly, depending on the compile-time mbranch-protection argument values. It defines the following preprocessor macros: * HAVE_PAC_LEAF: Indicates whether pac-signing has been requested for leaf functions. * PAC_LEAF_PUSH_IP: Whether leaf functions should push the pac code to the stack irrespective of whether the ip register is clobbered in the function or not. * STACK_ALIGN_ENFORCE: Whether a dummy register should be added to the push list as necessary in the prologue to ensure stack alignment preservation at the start of assembly function. The epilogue behavior is likewise affected by this flag, ensuring any pushed dummy registers also get popped on function return. It also defines the following assembler macros: * prologue: In addition to pushing any callee-saved registers onto the stack, it generates any requested pacbti instructions. Pushed registers are specified via the optional `first', `last', `push_ip' and `push_lr' macro argument parameters. when a single register number is provided, it pushes that register. When two register numbers are provided, they specify a rage to save. If push_ip and/or push_lr are non-zero, the respective registers are also saved. Stack alignment is requested via the `align` argument, which defaults to the value of STACK_ALIGN_ENFORCE, unless manually overridden. For example: prologue push_ip=1 -> push {ip} prologue push_ip=1, align8=1 -> push {r2, ip} prologue push_ip=1, push_lr=1 -> push {ip, lr} prologue 1 -> push {r1} prologue 1, align8=1 -> push {r0, r1} prologue 1 push_ip=1 -> push {r1, ip} prologue 1 4 -> push {r1-r4} prologue 1 4 push_ip=1 -> push {r1-r4, ip} * epilogue: pops registers off the stack and emits pac key signing instruction, if requested. The `first', `last', `push_ip', `push_lr' and `align' function as per the prologue macro, generating pop instead of push instructions. Stack alignment is enforced via the following helper macro call-chain: {prologue|epilogue} ->_align8 -> _preprocess_reglist -> _preprocess_reglist1 -> {_prologue|_epilogue} Finally, the necessary cfi directives for adding debug information to prologue and epilogue are generated via the following macros: * cfisavelist - prologue macro helper function, generating necessary .cfi_offset directives associated with push instruction. Therefore, the net effect of calling `prologue 1 2 push_ip=1' is to generate the following: push {r1-r2, ip} .cfi_adjust_cfa_offset 12 .cfi_offset 143, -4 .cfi_offset 2, -8 .cfi_offset 1, -12 * cfirestorelist - epilogue macro helper function, emitting .cfi_restore instructions prior to resetting the cfa offset. As such, calling `epilogue 1 2 push_ip=1' will produce: pop {r1-r2, ip} .cfi_register 143, 12 .cfi_restore 2 .cfi_restore 1 .cfi_def_cfa_offset 0
2023-01-10Cygwin: ctty: Add comments for the special values: -1 and -2.Takashi Yano2-2/+7
_pinfo::ctty has two special values other than the device id of the allocated ctty: -1: CTTY is not initialized yet. Can be associated with the TTY which is associated with the session leader. -2: CTTY has been released by setsid(). Can be associate only with new TTY which is not associated with any other session as CTTY, but cannot be associate with the TTYs already associated with other sessions. This patch adds the comments in some source files. Suggested-by: Corinna Vinschen <corinna@vinschen.de> Signedoff-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-01-10Cygwin: pinfo: Additional fix for CTTY behavior.Takashi Yano2-3/+3
The commit 25c4ad6ea52f did not fix the CTTY behavior enough. For example, in the following test case, TTY will be associated as a CTTY on the second open() call even though the TTY is already CTTY of another session. This patch fixes the issue. #include <unistd.h> #include <sys/fcntl.h> int main() { if (fork () == 0) { char *tty = ttyname(0); int fd; setsid(); fd = open(tty, O_RDWR); close(fd); fd = open(tty, O_RDWR); usleep (60000000L); } return 0; } Fixes: 25c4ad6ea52f ("Cygwin: pinfo: Align CTTY behavior to the statement of POSIX.") Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-01-10Cygwin: cygheap: Initialize myself_pinfo before child_copy().Takashi Yano2-2/+2
After the commit 30add3e6b3e3, the problem: https://cygwin.com/pipermail/cygwin/2022-December/252759.html occurs rarely. It seems that myself_pinfo should be initialized where the timing before child_copy() and after cygheap allocation. This patch moves the initialization there. Fixes: 30add3e6b3e3 ("Cygwin: exec: don't access cygheap before it's initialized") Reported-by: Brian Inglis <Brian.Inglis@Shaw.ca> Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2023-01-10Cygwin: /proc/<PID>/status: avoid crash computing signal infoCorinna Vinschen2-1/+5
The code computing the mask of pending signals used the per-queued signal TLS pointer without checking it for NULL. Fix this by using the process-wide signal mask in that case. Fixes: 195169186bfd5 ("Cygwin: wait_sig: allow to compute process-wide mask of pending signals") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-10Cygwin: Run testsuite against the just-built DLLJon Turney7-16/+18
Since 4e7817498efc, we're just running the tests against the installed DLL. We're arranging to put the build directory on the path, but since it doesn't contain cygwin1.dll (since it's built with a different name and renamed on installation), that doesn't have any effect. Arrange to place the just-built DLL into a directory which the testsuite can place on it's path (while running the test, but not while compiling it). Also fix any remaining references to cygwin0.dll in testsuite, documentation and comments. Fixes: 4e7817498efc ("Cygwin: Makefile: Drop all the "test dll" considerations")
2023-01-09libgloss: merge aarch64 into top-level MakefileMike Frysinger8-347/+342
Avoid a recursive make to speed things up a bit.
2023-01-09Cygwin: /proc/<PID>/status: simplify code generating signal infoCorinna Vinschen1-21/+21
The code generating the signal info in _pinfo::siginfo() and in commune_process() are doing the same thing. Create a local static function commune_process_siginfo() to have the code in one place only. Remove a useless sigpending() call. Fixes: 9a3c058f6612 ("Cygwin: /proc/<PID>/status: Fill SigPnd, SigBlk and SigIgn values with life") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-01-09Cygwin: reinstantiate exporting _allocaCorinna Vinschen3-1/+6
This basically reverts commit 1556b96b1b3b03112f271dfe30e043ed538354fd. Turns out that _alloca is actually used, for instance, by clang.
2023-01-03Fix memccpy to handle end char >= x80CompilerAI Research Group1-3/+3
- use unsigned char variables for optimized version of memccpy
2022-12-23Cygwin: CI: Fix thinko of 'ncores' for 'nproc'Jon Turney1-1/+1
2022-12-23fhandler/proc.cc(format_proc_cpuinfo): add Linux 6.1 cpuinfoBrian Inglis1-0/+4
Intel 0x00000007:1 EAX:26 lam Linear Address Masking (& recent entries)
2022-12-22Cygwin: Add release message for latest console change.Takashi Yano1-0/+3
3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2022-12-22Cygwin: console: Make the console accessible from other terminals.Takashi Yano7-138/+418
Previously, the console device could not be accessed from other terminals. Due to this limitation, GNU screen and tmux cannot be opened in console. With this patch, console device can be accessed from other TTYs, such as other consoles or ptys. Thanks to this patch, screen and tmux get working in console. Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2022-12-22Cygwin: devices: Make generic console devices invisible from pty.Takashi Yano2-2/+8
The devices /dev/conin,conout,console were wrongly visible from ptys, though they are inaccessible. This is because fhandler_console::exists() returns true due to existing invisible console. This patch makes these devices invisible from ptys. Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2022-12-22Cygwin: pinfo: Align CTTY behavior to the statement of POSIX.Takashi Yano3-17/+29
POSIX states "A terminal may be the controlling terminal for at most one session." https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap11.html However, in cygwin, multiple sessions could be associated with the same TTY. This patch aligns CTTY behavior to the statement of POSIX. Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2022-12-22nvptx: Implement '_exit' instead of 'exit'Thomas Schwinge3-24/+26
... so that all of 'exit', '_exit', '_Exit' work. 'exit' thus becomes the standard 'newlib/libc/stdlib/exit.c' -- and functions registered via 'atexit' are now called at return from 'main' or manual 'exit' invocation.
2022-12-22Cygwin: console: Fix hangup of less on quit after the window is resized.Takashi Yano2-0/+8
https://cygwin.com/pipermail/cygwin/2022-December/252737.html If the less is started from non-cygwin shell and window size is changed, it will hang-up when quitting. The cause of the proglem is that less uses longjump() in signal handler. If the signal handler is called while cygwin is acquiring the mutex, cygwin loses the chance to release mutex. With this patch, the mutex is released just before calling kill_pgrp() and re-acquired when kill_pgrp() returns. Reported-by: Gregory Mason <grmason@epic.com> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2022-12-21remove +x bit on source filesMike Frysinger16-0/+0
These should never be marked executable as they have no shebang and are pure source files.
2022-12-21Cygwin: Makefile: Drop all the "test dll" considerationsJon Turney2-8/+3
After 90236c3a2cf6, the testsuite is failing, as the cygwin0.dll referenced by the implib that testsuite programs are linked with doesn't exist anymore. We don't need to make and link the testsuite with a specially named DLL, as the cygwin DLL (since 526b0fbca377) takes into consideration the path it's executing from to define separate "Cygwin installations", which don't interact. Fixes: 90236c3a2cf6 ("Cygwin: Makefile: build new-cygwin1.dll in a single step")
2022-12-21Cygwin: path_conv: make sure sym.path_flags is always initializedCorinna Vinschen2-1/+6
Commit c1023ee353705 introduced a split between mount flags and path flags. It didn't initialize symlink_info::path_flags in path_conv::check, because that's done in symlink_info::check. However, there are two code paths expecting symlink_info::path_flags being already initialized and both skip symlink_info::check. Make sure symlink_info::path_flags is initalized to 0 early in path_conv::check. Fixes: c1023ee353705 ("Cygwin: path_conv: decouple path_types from mount types") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-21Cygwin: configure: Add option to disable building 'dumper'Jon Turney2-4/+7
Rather than guessing, based on just the presence of libbfd, add an explicit configuration option, to build dumper or not, defaulting to building it. This might have some use when bootstrapping Cygwin for a new architecture, or when building your own Cygwin-targetted cross-compiler, rather than installing one from the copr, along with the dependencies of libbfd.
2022-12-21Cygwin: FAQ: Mention configure options to build with reduced dependenciesJon Turney1-4/+11
2022-12-20Cygwin: x86_64: import swab.S from NetBSDCorinna Vinschen2-0/+48
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20Cygwin: x86_64: import latest NetBSD bcopy.SCorinna Vinschen8-131/+227
Tweak slightly to allow implementing entire {w}mem{p}{cpy,move} family: Add WIDE macro processing for wmem* and POST macro processing for memp* functions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20Cygwin: x86_64: import memchr.S from NetBSDCorinna Vinschen2-2/+112
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20Cygwin: x86_64: import new memset.S from NetBSDCorinna Vinschen1-57/+81
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20Cygwin: add local machine/asm.h headerCorinna Vinschen1-0/+78
This header supports including BSD assembler sources. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20Cygwin: use .S suffix for assembler filesCorinna Vinschen2-0/+0
Automake generates different recipies for .s.o vs. .S.o rules. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-20Cygwin: check_reparse_point_target: fix comment formatCorinna Vinschen1-4/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2022-12-19libgloss: rs6000: fix incorrect install dir for xil filesMike Frysinger1-2/+2
The install steps were missing the multilib qualifier causing them to always install in the same location and stomp each other.
2022-12-19libgloss: merge arm configure script up a levelMike Frysinger9-5643/+99
Move the minor arm-specific logic to a dedicated variable so we can merge its configure logic up a level.
2022-12-19libgloss: merge aarch64 configure script up a levelMike Frysinger9-5431/+45
Move the minor aarch64-specific logic to a dedicated variable so we can merge its configure logic up a level.
2022-12-19libgloss: drop unused multi-build logicMike Frysinger2-69/+1
Now that aarch64 & arm have migrated off this, we can punt it.
2022-12-19libgloss: arm: inline multi-build logicMike Frysinger1-45/+47
Since no other port uses this custom libgloss multi-build.in logic, and it's making things difficult to unify, drop it all. The set of installed objects and their content should be the same. There is a difference in the builds: currently we compile all the objects in this subdir twice, but only a subset of them use a diff set of flags, and are actually installed (the librdimon.a and its objects). So this change speeds things up by removing the duplicate compilation. There is a short term cost in having to duplicate the compile rules for the files that are different, but this is minor when compared to being able to delete the unused multi-build logic (which we'll do in a sep commit), and we'll be able to clean this up when we move the code to unified automake. None of this should be confused with the common multilib logic. This is *multi-build* which is processed in parallel.
2022-12-19libgloss: aarch64: delete unused multi-build logicMike Frysinger1-43/+16
This logic looks like it was copied from the arm port, but it isn't actually used here. Since no other port uses this custom libgloss multi-build.in logic, and it's making things difficult to unify, and aarch64 isn't even using it, drop it all. The set of installed objects and their content should be the same. Once we move this to unified automake, if we want to readd support for subdir multi-builds, it'll be a lot easier as we can just add another set of objects with custom flags. None of this should be confused with the common multilib logic. This *multi-build* which is processed in parallel.
2022-12-19libc: arm: setjmp.S code cleanupVictor L. Do Nascimento1-12/+0
The code for setjmp and longjmp contains unconditionally-disabled legacy FPA code. Given the code is not used by any targets, remove the code.
2022-12-19Fix a bug in setjmp for MIPS o32/o64 FPXX/FP64Giovanni Bajo1-1/+1
It seems there is a swapped logic in one of the subcases of setjmp.S for MIPS: when the FPU registers are 64-bit within a 32-bit aligned jmp_buf, the code realigns the pointers before doing 64-bit writes, but the branch logic is swapped: we must avoid the address adjustement when bit 2 is zero (that is, the address is already 8-byte aligned). This always triggers an address error when run, as tested on a MIPS VR4300 with O64 ABI.
2022-12-16Fix 3 other instances of Reme typo (should be Remez)Jeff Johnston3-3/+3
2022-12-16Revert "amdgcn: Add vectorized math routines"Jeff Johnston95-8074/+46
This reverts commit 125e39bfea1a39341a60348c93a65cf4894e0f2a.
2022-12-16Fix a typo in the comment.Nadav Rotem1-1/+1
The implementation of expf() explains how approximation in the range [0 - 0.34] is done. The comment describes the "Reme" algorithm for constructing the polynomial. This is a typo and should be the "Remez" algorithm. The remez algorithm (or minimax) is used to calculate the coefficients of polynomials in other implementations of exp(0 and log(). See more: https://en.wikipedia.org/wiki/Remez_algorithm
2022-12-16amdgcn: Add vectorized math routinesKwok Cheung Yeung95-46/+8074
This implements a set of vectorized math routines to be used by the compiler auto-vectorizer. Versions for vectors with 2 lanes up to 64 lanes (in powers of 2) are provided. These routines are based on the scalar versions of the math routines in libm/common, libm/math and libm/mathfp. They make extensive use of the GCC C vector extensions and GCN-specific builtins in GCC.