1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-10-28 23:34:53 +03:00
Commit Graph

1791 Commits

Author SHA1 Message Date
Adhemerval Zanella
20528165bd Disable SFrame support by default
And add extra checks to enable for binutils 2.45 and if the architecture
explicitly enables it.  When SFrame is disabled, all the related code
is also not enabled for backtrace() and _dl_find_object(), so SFrame
backtracking is not used even if the binary has the SFrame segment.

This patch also adds some other related fixes:

  * Fixed an issue with AC_CHECK_PROG_VER, where the READELF_SFRAME
    usage prevented specifying a different readelf through READELF
    environment variable at configure time.

  * Add an extra arch-specific internal definition,
    libc_cv_support_sframe, to disable --enable-sframe on architectures
    that have binutils but not glibc support (s390x).

  * Renamed the tests without the .sframe segment and move the
    tst-backtrace1 from pthread to debug.

  * Use the built compiler strip to remove the .sframe segment,
    instead of the system one (which might not support SFrame).

Checked on x86_64-linux-gnu and aarch64-linux-gnu.

Reviewed-by: Sam James <sam@gentoo.org>
2025-07-24 15:51:58 -03:00
Florian Weimer
c7742069a6 manual: Use @Theglibc{} at sentence start in terminal documentation
Fixes commit 5dd2a19ad5 ("termios: manual: improve the
explanation of various tty concepts") and commit c744519bad
("termios: manual: document the SPEED_MAX and BAUD_MAX constants").

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-24 19:27:44 +02:00
H. Peter Anvin
c744519bad termios: manual: document the SPEED_MAX and BAUD_MAX constants
Add the SPEED_MAX and BAUD_MAX constants to the manual.

[ v3: drop leading underscores ]

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-20 17:17:44 +02:00
H. Peter Anvin
5dd2a19ad5 termios: manual: improve the explanation of various tty concepts
It is a lot easier to understand the meaning of the tty interface if
it is explained from the beginning as conceptually emulating an RS232
serial port.  This greatly simplifies the discussions of specific
items like the meaning of line speed.

Distinguish between "modem disconnect request" (deasserting DTR) and
"modem disconnect" (DCD deasserted).  Conflating the two terms is
confusing, especially for non-RS232 devices.  In particular, on most
systems, a pseudo-terminal will *not* respond to a modem disconnect
request by triggering a modem disconnect event for the purpose of the
HUPCL flag.

It is not necessarily true that the line speed has no effect on
non-serial port devices: e.g. an SPI port may interpret it as the
clock frequency to use; however, SPI does not use asynchronous framing
bits, instead synchronization is handled by the SS# wire.  Similarly,
it is common but not by any means universal for interfaces that employ
various forms of fixed data to symbol rate encodings to encode the
data link layer bit rate rather than the physical symbol rate, which
may be higher (e.g. 8B10B) or lower (e.g. QAM/Trellis), without the
encoding or framing overhead.

Finally, a handful of devices use the line rate for entirely
nonstandard purposes.  One example is Arduino USB interfaces, which
often interprets changing the baud rate to 1200 baud as a command to
reset the device.

[ v2: removed a bogus stray chunk from editing ]

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2025-07-20 17:11:02 +02:00
H. Peter Anvin
5e78997c56 termios: manual: remove duplicate cfgetospeed() definition
The function cfsetospeed() is defined twice in the manual. Remove the
one that seems out of place.

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-20 17:10:59 +02:00
H. Peter Anvin
118370fd78 termios: manual: fix typo: tcsettattr -> tcsetattr
Fix a typo in the manual: tcsetattr misspelled as tcsettattr.

Signed-off-by: "H. Peter Anvin" (Intel) <hpa@zytor.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-07-20 17:10:56 +02:00
Claudiu Zissulescu
3d780a44eb configure: Add --enable-sframe option
Enable SFrame stack track information. The --enable-sframe option
allows the glibc build to compile with SFrame stack track
information. Thus, enabling glibc's backtrace to work within glibc.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-07-14 10:57:53 +01:00
Claudiu Zissulescu
0ebe4fba88 elf: Add SFrame support to _dl_find_object function
The SFrame provides information to be able to do stack trace is now
well defined and implemented in Binutils 2.41.  The format simply
contains enough information to be able to do stack trace given a
program counter (PC) value, the stack pointer, and the frame pointer.
The SFrame information is stored in a .sframe ELF section, which is
loaded into its own PT_GNU_SFRAME segment. We consider for this support
SFrame version 2.

This patch adds the bits to _dl_find_object to recognize and store in
struct dl_find_object the necessary info about SFrame section.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-07-14 10:56:35 +01:00
Matteo Croce
521b4d6c4d fstat: add test and documentation for an edge case.
The fstatat behaviour when the target is a dangling symlink is different
if flags contains AT_SYMLINK_NOFOLLOW or not.
Add a test for this and document it.
2025-07-08 13:18:20 -03:00
Matteo Croce
652c36b3ea fstatat: extend tests and documentation
Document the fstatat behaviour leading to a ENOENT errno, and extend
tests to test the case where filename does not exist.

Signed-off-by: Matteo Croce <teknoraver@meta.com>
2025-07-08 13:18:08 -03:00
Collin Funk
4900f993c8 manual: Remove '.info' suffix in manual names passed to @ref [BZ #32962].
Texinfo 7.2 began warning about the '.info' suffix in the manual names
passed to @ref and similar commands.  They eventually plan to stop
stripping the '.info' suffix internally which will lead to broken links
in the manuals without this change.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2025-07-03 05:19:42 +01:00
Jitka Obselkova
53ea6db9fd manual: Clarify renameat documentation
Clarify the meaning of renameat arguments.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-26 14:24:40 +02:00
Florian Weimer
1149b4f64f Revert "manual: Clarify renameat documentation"
This reverts commit abc2e954af.
Reason for revert: Wrong version of the patch.
2025-06-26 14:22:58 +02:00
Ravina Jain
b2a8d19f4a manual: Add missing free to open_memstream example [BZ #27866]
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-25 14:26:32 +02:00
Jitka Obselkova
abc2e954af manual: Clarify renameat documentation
Clarify the meaning of renameat arguments.

Signed-off-by: Jitka Obselkova <jobselko@redhat.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-06-18 16:03:20 -03:00
H. Peter Anvin (Intel)
5f138519eb termios: add new baud_t interface, defined to be explicitly numeric
Add an explicitly numeric interface for baudrate setting. For glibc,
this only announces what is a fair accompli, but this is a plausible
way forward for standardization, and may be possible to infill on
non-compliant systems. The POSIX committee has stated:

[https://www.austingroupbugs.net/view.php?id=1916#c7135]

	A future version of this standard is expected to add at least
	the following symbolic constants for use as values of objects
	of type speed_t: B57600, B115200, B230400, B460800, and
	B921600.

	Implementations are encouraged to propose additional
	interfaces which will make it possible to set and query a
	wider range of speeds than just those enumerated by the
	constants beginning with B. If a set of common interfaces
	emerges between several implementations, a future version of
	this standard will likely add those interfaces.

This is exactly that interface.

The use of the term "baud" is due to the need to have a term
contrasting "speed", and it is already well established as a legacy
term -- including in the names of the legacy Bxxx
constants. Futhermore, it *is* valid from the point of view that the
termios interface fundamentally emulates an RS-232 serial port as far
as the application software is concerned.

The documentation states that for the current version of glibc,
speed_t == baud_t, but explicitly declares that this may not be the
case in the future.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-06-17 09:11:38 -03:00
H. Peter Anvin (Intel)
98aeca349a manual: document all the termios Bxxx constants in the manual
Add all the Bxxx constants defined in the now-generic
<bits/termios-baud.h> in the manual.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-06-17 09:11:38 -03:00
Maciej W. Rozycki
62fba6d980 manual: Add a comparative example of 'clock_nanosleep' use
Add an illustrative example of how to express 'nanosleep' in terms of
'clock_nanosleep'.
2025-06-06 18:14:34 +01:00
Arjun Shankar
25f1d94576 manual: Document futimens and utimensat
Document futimens and utimensat.  Also document the EINVAL error
condition for futimes.  It is inherited by futimens and utimensat as
well.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 20:17:04 +02:00
Arjun Shankar
75b725717f manual: Document unlinkat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 20:17:04 +02:00
Arjun Shankar
60f86c9cd0 manual: Document renameat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 20:17:04 +02:00
Arjun Shankar
49766eb1a5 manual: Document mkdirat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 20:17:04 +02:00
Arjun Shankar
941157dbcd manual: Document faccessat
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 20:17:04 +02:00
Arjun Shankar
3b21166c4d manual: Expand Descriptor-Relative Access section
Improve the clarity of the paragraphs describing common flags and add a
list of common error conditions for descriptor-relative functions.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 20:17:04 +02:00
Maciej W. Rozycki
140b20e971 manual: Document error codes missing for 'inet_pton'
Add documentation for EAFNOSUPPORT error code returned, and the possible
return values on non-success.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 16:27:20 +01:00
Maciej W. Rozycki
5a9020eeb2 manual: Document error codes missing for 'if_nametoindex'
Add documentation for ENODEV error code returned and refer to 'socket'
for further possible codes from the underlying function call.

While changing the text clarify the description by mentioning 'ifname'.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 16:27:20 +01:00
Maciej W. Rozycki
46acdf46cc manual: Document error codes missing for 'if_indextoname'
Add documentation for ENXIO error code returned and refer to 'socket'
for further possible codes from the underlying function call.

While changing the text clarify the description by mentioning 'ifname'
and replace @code tags with @var ones where referring to a function
parameter.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-06-04 16:27:20 +01:00
Arjun Shankar
591283a689 manual: Correct return value description of 'clock_nanosleep'
Commit 1a3d8f2201 incorrectly described
'clock_nanosleep' as having the same return values as 'nanosleep'.  Fix
this, clarifying that 'clock_nanosleep' returns a positive error number
upon failure instead of setting 'errno'.  Also clarify that 'nanosleep'
returns '-1' upon error.

Fixes: 1a3d8f2201
Reported-by: Mark Harris <mark.hsj@gmail.com>
Reviewed-by: Mark Harris <mark.hsj@gmail.com>
2025-06-02 16:06:11 +02:00
Arjun Shankar
1a3d8f2201 manual: Document clock_nanosleep
Make minor clarifications in the documentation for 'nanosleep' and add
an entry for 'clock_nanosleep' as a generalized variant of the former
function that allows clock selection.
Reviewed-by: Maciej W. Rozycki <macro@redhat.com>
2025-05-30 18:16:57 +02:00
Maciej W. Rozycki
9a743032cd manual: Fix invalid 'illegal' usage with 'nanosleep'
The GNU Coding Standards demand that 'illegal' only be used to refer to
activities prohibited by law.  Replace it with 'invalid' accordingly in
the description of the EINVAL error condition for 'nanosleep'.
2025-05-30 15:01:51 +01:00
Maciej W. Rozycki
bc4202521c manual: Fix duplicate 'consult' erratum
Remove 'consult' duplication appearing in Extensible Scheduling section.
2025-05-30 15:01:50 +01:00
Maciej W. Rozycki
79b5febd76 manual: Document error codes missing for 'inet_ntop'
Add documentation for EAFNOSUPPORT and ENOSPC error codes returned, and
the return value on failure.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-05-29 22:11:38 +01:00
Maciej W. Rozycki
43afae31e0 manual: Document error codes missing for 'socket'
Add missing EAFNOSUPPORT, ESOCKTNOSUPPORT, EPROTOTYPE, EINVAL, EPERM,
and ENOMEM error codes, and adjust existing descriptions accordingly.

On Linux either ENOBUFS or ENOMEM is returned in the case of a memory
allocation failure, depending on the namespace requested, e.g. AF_INET
returns ENOMEM while AF_INET6 returns ENOBUFS, so document these codes
as alternatives.

Similarly EPERM is returned rather than EACCES on Linux, so document
these codes as alternatives as well.  We might want to convert EPERM to
EACCES for POSIX compliance, but it is beyond the scope of this change,
and software has to expect either anyway, owing to the long-established
practice.

Finally ESOCKTNOSUPPORT is returned rather than EPROTONOSUPPORT for an
unsupported style except for the AF_QIPCRTR namespace where EPROTOTYPE
is used, so document these codes as alternatives too.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-05-29 22:11:38 +01:00
Yury Khrustalev
ea30c67030 manual: mention PKEY_UNRESTRICTED macro in the manual
Also use this macro in one of the examples.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-05-28 11:00:02 +01:00
Jonathan Wakely
a484b76cd7 doc: Add missing space in documentation of __TIMESIZE 2025-05-27 11:42:50 +01:00
Jonathan Wakely
b4784d61b3 doc: Fix typos in documentation of _TIME_BITS 2025-05-27 11:42:49 +01:00
Tomas Volf
99c70ae6e9 manual: Document getopt_long_only with single letter options (bug 32980)
Signed-off-by: Tomas Volf <~@wolfsden.cz>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-05-26 15:53:54 +02:00
Carlos O'Donell
4052d99ead manual: Use more inclusive language in comments.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-05-21 12:48:25 -04:00
DJ Delorie
579f866881 manual: add sched_getcpu()
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-05-16 13:16:08 -04:00
Florian Weimer
6c9bb270d6 manual: Clarifications for listing directories
Support for seeking is limited.  Using the d_off and d_reclen members
of struct dirent is discouraged, especially with readdir.  Concurrent
modification of directories during iteration may result in duplicate
or missing etnries.
2025-05-16 16:47:02 +02:00
DJ Delorie
21e54f160f manual: add remaining CPU_* macros
Adds remaining CPU_* macros, including the CPU_*_S macros
for dynamic-sized cpu sets.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-05-15 16:25:17 -04:00
Joseph Myers
06caf53adf Implement C23 rootn.
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the rootn functions, which compute the Yth root of X for
integer Y (with a domain error if Y is 0, even if X is a NaN).  The
integer exponent has type long long int in C23; it was intmax_t in TS
18661-4, and as with other interfaces changed after their initial
appearance in the TS, I don't think we need to support the original
version of the interface.

As with pown and compoundn, I strongly encourage searching for worst
cases for ulps error for these implementations (necessarily
non-exhaustively, given the size of the input space).  I also expect a
custom implementation for a given format could be much faster as well
as more accurate, although the implementation is simpler than those
for pown and compoundn.

This completes adding to glibc those TS 18661-4 functions (ignoring
DFP) that are included in C23.  See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118592 regarding the C23
mathematical functions (not just the TS 18661-4 ones) missing built-in
functions in GCC, where such functions might usefully be added.

Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-05-14 10:51:46 +00:00
Stefan Liebler
4b1ffb828c powerpc64le: Remove configure check for objcopy >= 2.26.
Due to raising the minimum binutils version to >= 2.26, the configure
check for testing support of --update-section is not needed anymore.
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
2025-05-14 10:35:55 +02:00
Stefan Liebler
e53ab20892 Raise the minimum binutils version to 2.39
The recent commit 27b96e069a raises the minimum
GCC version to 12.1 which was released in 2022.

The current minimum bintuils version 2.25 was released end of 2014.  This patch
now raises the minimum binutils version to 2.39 which was also released in 2022.

The hint for ARC is not needed anymore.

In sysdeps/[alpha|hppa|csky]/configure.ac, PIE is unsupported with this comment:
PIE builds fail on binutils 2.37 and earlier, see:
https://sourceware.org/bugzilla/show_bug.cgi?id=28672
This patch keeps PIE unsupported and let the machine maintainers test and
enable it later.

In sysdeps/arm/configure.ac, there is a check whether TPOFF relocs with addends
are assembled correctly, which is known to be broken in binutils 2.24 and 2.25.
See: https://sourceware.org/bugzilla/show_bug.cgi?id=18383
This patch keeps the check as is and let the machine maintainers check if it
still required.

According to Florian Weimer:
Having at least binutils 2.38 will allow us to assume that this linker
bug is fixed:
Bug 28743 - -z relro creats holes in the process image on GNU/Linux
<https://sourceware.org/bugzilla/show_bug.cgi?id=28743>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-05-14 10:35:55 +02:00
DJ Delorie
f176bf2a06 manual: fix typo for sched_[sg]etattr
Originally added in 41a90f3f5f which says it's adding sched_getattr
and sched_setattr.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-05-12 17:07:23 -04:00
Joseph Myers
f451a02a8c Document all CLOCK_* values
The manual documents CLOCK_REALTIME and CLOCK_MONOTONIC but not other
CLOCK_* values.  Add documentation of the POSIX clocks
CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID, along with a
reference to the Linux man pages for the semantics of the
Linux-specific clocks supported (as with some other functionality
coming direct from the Linux kernel where the man pages can be
considered the main documentation).

Note: CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE and
CLOCK_MONOTONIC_COARSE are also defined in the toplevel bits/time.h,
as used for Hurd.  Nevertheless, I see no sign that the Hurd code in
glibc actually has any support for those clocks, so I think it is
correct to document them as Linux-specific (and to refer only to the
Linux man pages for their semantics).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2025-05-12 14:56:07 +00:00
Joseph Myers
ae31254432 Implement C23 compoundn
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the compoundn functions, which compute (1+X) to the
power Y for integer Y (and X at least -1).  The integer exponent has
type long long int in C23; it was intmax_t in TS 18661-4, and as with
other interfaces changed after their initial appearance in the TS, I
don't think we need to support the original version of the interface.

Note that these functions are "compoundn" with a trailing "n", *not*
"compound" (CORE-MATH has the wrong name, for example).

As with pown, I strongly encourage searching for worst cases for ulps
error for these implementations (necessarily non-exhaustively, given
the size of the input space).  I also expect a custom implementation
for a given format could be much faster as well as more accurate (I
haven't tested or benchmarked the CORE-MATH implementation for
binary32); this is one of the more complicated and less efficient
functions to implement in a type-generic way.

As with exp2m1 and exp10m1, this showed up places where the
powerpc64le IFUNC setup is not as self-contained as one might hope (in
this case, without the changes specific to powerpc64le, there were
undefined references to __GI___expf128).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-05-09 15:17:27 +00:00
DJ Delorie
3270c50e48 manual: add more pthread functions
Add stubs and partial docs for many undocumented pthreads functions.
While neither exhaustive nor complete, gives minimal usage docs
for many functions and expands the pthreads chapters, making it
easier to continue improving this section in the future.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
2025-05-05 22:42:26 -04:00
Aurelien Jarno
9df92958c1 manual/tunables: fix a trivial typo
Fixes: 12a497c716 ("elf: Extend glibc.rtld.execstack tunable to force executable stack (BZ 32653)"
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2025-04-14 10:24:55 -03:00
Collin Funk
363bbdbd2a manual: Mention POSIX-1.2024 requires time_t to be 64 bit or wider.
* manual/time.texi (Time Types): Mention POSIX-1.2024 requires 64 bit
time_t.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-04-14 10:10:17 -03:00