Commit graph

21811 commits

Author SHA1 Message Date
Thomas Munro
5fac6f1687 poll(2): Add POLLRDHUP.
Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29757

(cherry picked from commit 3aaaa2efde)
2022-06-17 22:22:13 +03:00
Ed Maste
94da8ba11d getpagesize(3): add .Xr to sysconf(3)
POSIX deprecated getpagesize(3).  The portable way to obtain the page
size is `sysconf(_SC_PAGESIZE)`.

Reviewed by:	cperciva (earlier), imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35352

(cherry picked from commit 49c937e704)
2022-06-16 08:50:00 -04:00
Dimitry Andric
862668c487 Merge llvm-project release/14.x llvmorg-14.0.5-0-gc12386ae247c
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.5-0-gc12386ae247c, aka 14.0.5 release.

PR:		261742
MFC after:	3 days

(cherry picked from commit 56f451bb3b)
2022-06-15 22:45:08 +02:00
Dimitry Andric
7db7448a10 Also define THR_PAGE_SIZE_MIN for mips
Commit 6173c7833b, which cherry-picked commit c7904405a8 ("Remove
PAGE_SIZE from libthr") to stable/13 resulted in build errors on mips:

/usr/src/lib/libthr/thread/thr_barrier.c:40:50: error: use of undeclared identifier 'THR_PAGE_SIZE_MIN'
_Static_assert(sizeof(struct pthread_barrier) <= THR_PAGE_SIZE_MIN,
                                                 ^

This is because c7904405a8 defined THR_PAGE_SIZE_MIN for all supported
architectures in main/14-CURRENT, but that list no longer includes mips.
Add a similar define for mips, so libthr can build successfully again.

Direct commit to stable/13, since main no longer has mips.

Fixes:		6173c7833b
2022-06-13 20:55:23 +02:00
Gordon Bergling
bac9985f83 ipsec(4): Fix a typo in a source code comment
- s/formated/formatted/

(cherry picked from commit 7a33c6bf52)
2022-06-10 14:33:00 +02:00
Gordon Bergling
98227aff13 usbhid(3): Fix a typo in the manual page
- s/layed/laid/

(cherry picked from commit 9b15c51b05)
2022-06-10 14:30:31 +02:00
Gordon Bergling
634412571c nlist(3): Fix a common typo in a source code comment
- s/independant/independent/

(cherry picked from commit 565405095b)
2022-06-10 14:25:39 +02:00
Gordon Bergling
c79946df83 libgssapi: Fix a common typo in a source code comment
- s/independant/independent/

(cherry picked from commit 9e75b06f93)
2022-06-10 14:23:10 +02:00
Dimitry Andric
40bbef56c9 Merge llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.4-0-g29f1039a7285, aka 14.0.4 release.

PR:		261742
MFC after:	3 days

(cherry picked from commit 2a66634d1b)

Bump versions llvm-project release/14.x llvmorg-14.0.4-0-g29f1039a7285

Somehow git rebase made this squashed commit disappear. Restore it.

PR:		261742
MFC after:	3 days

(cherry picked from commit ab9d54731f)

Update rest of llvm-project build glue for 14.0.4

I completely forgot about updating the generated llvm-project config
files, which also contain version numbers, etc. Sorry for the churn.

PR:		261742
Fixes:		ab9d54731f
MFC after:	3 days

(cherry picked from commit 809922b010)

Add more old clang files to (Optional)ObsoleteFiles.inc

There were a few more libclang_rt libraries added recently, but not yet
listed in the ObsoleteFiles.inc lists.

MFC after:	3 days

(cherry picked from commit 5e383e3603)
2022-06-09 20:14:08 +02:00
Andrew Turner
6173c7833b Remove PAGE_SIZE from libthr
In libthr we use PAGE_SIZE when allocating memory with mmap and to check
various structs will fit into a single page so we can use this allocator
for them.

Ask the kernel for the page size on init for use by the page allcator
and add a new machine dependent macro to hold the smallest page size
the architecture supports to check the structure is small enough.

This allows us to use the same libthr on arm64 with either 4k or 16k
pages.

Reviewed by:	kib, markj, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34984

(cherry picked from commit c7904405a8)
2022-06-07 15:20:18 +01:00
Andrew Turner
152c34e2dd Use the existing page size in libthr
Rather than calling getpagesize() twice use the value saved after the
first call to size a mmap allocation.

Reviewed by:	kib, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34983

(cherry picked from commit 86c500937c)
2022-06-07 15:20:18 +01:00
Cy Schubert
9900b20c79 lib/libgssapi: Trailing whitespace cleanup
Clean up trailing whitespace (trailing spaces and trailing tabs).

(cherry picked from commit efbe2af2ce)
2022-06-06 11:29:49 -07:00
Dimitry Andric
9bc98563bf llvm MIPS target: add missed source file
Otherwise, linking llvm binaries with this target enabled (which is not
the default) will fail with a number of undefined symbol errors:

  ld: error: undefined symbol: llvm::initializeMipsMulMulBugFixPass(llvm::PassRegistry&)
  ld: error: undefined symbol: llvm::createMipsMulMulBugPass()

MFC after:	3 days

(cherry picked from commit 4b1174e27a)
2022-06-04 14:00:23 +02:00
Dimitry Andric
36c1a99ff4 Add several sanitizer ignore lists under /usr/lib/clang
Some of the sanitizers from compiler-rt can use ignore lists, which are
loosely modeled on valgrind's example. Upstream provides default lists
for AddressSanitizer, CFI, and MemorySanitizer, so install these in the
expected location, /usr/lib/clang/14.0.3/share.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D35338

(cherry picked from commit 7b6f5ebef6)
2022-06-04 14:00:20 +02:00
Dimitry Andric
a13b6fc619 Merge llvm-project release/14.x llvmorg-14.0.3-0-g1f9140064dfb
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.3-0-g1f9140064dfb.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 3a9a9c0ca4)
2022-06-04 14:00:08 +02:00
Dimitry Andric
d3978dca08 Apply libc++ fix for <ranges> not compiling at all
Merge commit 44cdca37c01a from llvm git (by Arthur O'Dwyer):

  [libc++] Define `namespace views` in its own detail header.

  Discovered in the comments on D118748: we would like this namespace
  to exist anytime Ranges exists, regardless of whether concepts syntax
  is supported. Also, we'd like to fully granularize the <ranges> header,
  which means not putting any loose declarations at the top level.

  Differential Revision: https://reviews.llvm.org/D118809

(cherry picked from commit 53683b95ef)
2022-06-04 14:00:04 +02:00
Dimitry Andric
3b668af44d Merge llvm-project release/14.x llvmorg-14.0.0-2-g3f43d803382d
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-2-g3f43d803382d.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit dbc822f3bc)
2022-06-04 14:00:01 +02:00
Dimitry Andric
3e9cb41400 Merge llvm-project release/14.x llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc4-2-gadd3ab7f4c8a.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit fb03ea46eb)
2022-06-04 13:59:57 +02:00
Dimitry Andric
25ab46a314 Merge llvm-project release/14.x llvmorg-14.0.0-rc2-12-g09546e1b5103
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc2-12-g09546e1b5103.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit d781ede639)
2022-06-04 13:59:49 +02:00
Dimitry Andric
26ebd6ad3b Merge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc1-74-g4dc3cb8e3255.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit d56accc7c3)
2022-06-04 13:59:42 +02:00
Dimitry Andric
74ff3f6395 Merge llvm-project release/14.x llvmorg-14-init-18315-g190be5457c90
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18315-g190be5457c90.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 1838bd0f48)
2022-06-04 13:59:32 +02:00
Dimitry Andric
67eec5325a Merge llvm-project main llvmorg-14-init-18294-gdb01b123d012
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18294-gdb01b123d012, the last commit before
the upstream release/14.x branch was created.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 1fd87a682a)
2022-06-04 13:59:26 +02:00
Dimitry Andric
390adc38fc Merge llvm-project main llvmorg-14-init-17616-g024a1fab5c35
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-17616-g024a1fab5c35.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 04eeddc0aa)
2022-06-04 13:59:19 +02:00
Dimitry Andric
8a84287b0e Merge llvm-project main llvmorg-14-init-13186-g0c553cc1af2e
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-13186-g0c553cc1af2e.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 0eae32dcef)
2022-06-04 13:59:11 +02:00
Dimitry Andric
574b7079b9 Merge llvm-project main llvmorg-14-init-11187-g222442ec2d71
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-11187-g222442ec2d71.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 4824e7fd18)
2022-06-04 13:59:04 +02:00
Dimitry Andric
1f6fd64fe9 Merge llvm-project main llvmorg-14-init-10223-g401b76fdf2b3
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-10223-g401b76fdf2b3.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 5e801ac66d)
2022-06-04 13:58:59 +02:00
Gordon Bergling
2699604d8e libc: Add HISTORY sections to the manual pages
There are some sections which could be improved
and work to do so is on going. The work will be
covered via 'X-MFC-WITH' commits.

Obtained from:	OpenBSD
Differential Revision: https://reviews.freebsd.org/D34759

(cherry picked from commit 4b7f35db44)
2022-06-04 07:59:43 +02:00
Dimitry Andric
72562ae6e6 Export _Unwind_Complete and _Unwind_VRS_Pop from arm's libgcc_s
Apparently some ports on arm require these symbols, and while they were
available in llvm's libunwind, they were never exported via the arm
specific Symbol.map. Put them in the same version block as gcc does
(GCC_3.5).

Reported by:	Robert Clausecker <fuz_at_fuz.su>
MFC after:	3 days

(cherry picked from commit 8e5bcff58b)
2022-05-30 13:11:24 +02:00
Piotr Kubaj
e760ac89f8 powerpc: enable supported sanitizers on powerpc64*
1. Merge LLVM's 315d792130258a9b7250494be8d002ebb427b08f, adding support
for FreeBSD/powerpc64*.
2. Add sanitizer list to lib/libclang_rt/Makefile, taken from the list of
libraries that llvm-devel port builds.
3. powerpc64le supports the same sanitizers that powerpc64, but powerpc64le
also supports xray* sanitizers.
4. lib/libclang_rt/xray/Makefile hardcodes amd64-specific files, so that needs
to be conditionalized.
5. Sanitizers are not enabled for powerpc, because powerpc supports only
builtins and profile.

Reviewed by:	dim
Differential Revision: https://reviews.freebsd.org/D35228
Relnotes:	yes
MFC after:	3 days

(cherry picked from commit f5024381ac)
2022-05-21 16:40:14 +02:00
Piotr Kubaj
3d38a083c7 riscv: also enable includes, stats and stats_client in libclang_rt
Reviewed by:	dim (earlier version)
Differential Revision: https://reviews.freebsd.org/D34735
MFC after:	3 days

(cherry picked from commit c1e0431c22)
2022-05-21 16:40:14 +02:00
Corvin Köhne
346876412a bhyve: add ROM emulation
Some PCI devices especially GPUs require a ROM to work properly.
The ROM is executed by boot firmware to initialize the device.
To add a ROM to a device use the new ROM option for passthru device
(e.g. -s passthru,0/2/0,rom=<path>/<to>/<rom>).

It's necessary that the ROM is executed by the boot firmware.
It won't be executed by any OS.
Additionally, the boot firmware should be configured to execute the
ROM file.
For that reason, it's only possible to use a ROM when using
OVMF with enabled bus enumeration.

Differential Revision:	https://reviews.freebsd.org/D33129
Sponsored by:   Beckhoff Automation GmbH & Co. KG
MFC after:      1 month

(cherry picked from commit e47fe3183e)
2022-05-16 14:41:14 +02:00
Ed Maste
72bcf2fe90 libutil: eliminate one syscall from kinfo_getproc
Previously we invoked the sysctl with a NULL buffer to query the size,
allocated a buffer, then invoked it again to fetch the data.

As we only handle the case where the sysctl provides data of the
expected size we can just allocate a correctly-sized buffer to begin
with.

Reported by:	Thomas Hurst via Twitter
Reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35140

(cherry picked from commit 904c148f1c)
2022-05-16 08:28:24 -04:00
Andrew Turner
658631a37d Add PT_GETREGSET
This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be
used to access all the registers from a specified core dump note type.
The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other
machine-dependant types are expected to be added in the future.

The ptrace addr points to a struct iovec pointing at memory to hold the
registers along with its length. On success the length in the iovec is
updated to tell userspace the actual length the kernel wrote or, if the
base address is NULL, the length the kernel would have written.

Because the data field is an int the arguments are backwards when
compared to the Linux PTRACE_GETREGSET call.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19831

(cherry picked from commit 548a2ec49b)
2022-05-12 15:12:59 -07:00
John Baldwin
c1ccbc7f51 libpmcstat: Fix a few ARM-specific issues with function symbols.
- Refine the checks for ARM mapping symbols and apply them on arm64 as
  well as 32-bit arm.  In particular, mapping symbols can have
  additional characters and are not strictly limited to just "$a" but
  can append additional characters (e.g. "$a.1").  Add "$x" to the
  list of mapping symbol prefixes.

- Clear the LSB of function symbol addresses.  Thumb function
  addresses set the LSB to enable Thumb mode.  However, the actual
  function starts at the aligned address with LSB clear.  Not clearing
  the LSB can cause pmcannotate to pass misaligned addresses to
  objdump when extracting disassembly.

Reviewed by:	andrew
Obtained from:	CheriBSD
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34416

(cherry picked from commit a6db407f15)
2022-05-11 11:57:17 -07:00
Alexander Motin
217a0796fb GEOM: Fix regression after 7f16b501e2.
find_geom() in some classes trim leading "/dev/" from geom names.
Lack of that in geom_gettree_geom() broke some existing scripts.

PR:		262554
MFC after:	2 months

(cherry picked from commit bd0f3d34fa)
2022-05-10 21:20:25 -04:00
Alexander Motin
5f6a3a81f6 GEOM: Introduce partial confxml API
Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl.  It is convenient and informative, representing full state of
GEOM in a single XML document.  But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents.  It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml.  This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by:	imp
MFC after:	2 month
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D34529

(cherry picked from commit 7f16b501e2)
2022-05-10 21:20:25 -04:00
John Baldwin
56152f833b Remove an always-true check.
This fixes a -Wtype-limits error from GCC 9.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31936

(cherry picked from commit 5ac4ac85ca)
2022-05-10 15:51:49 -07:00
Alex Richardson
afab9d5ffe Export _mmap and __sys_mmap from libc.so
Unlike the other syscalls these two symbols were missing from the
version script. I noticed this while looking into the compiler-rt
runtime libraries for CHERI.

Reviewed by:	brooks
Obtained from:	https://github.com/CTSRD-CHERI/cheribsd/pull/1063
MFC after:	3 days

(cherry picked from commit 395db99f32)
2022-05-07 12:55:00 +01:00
Kristof Provost
03f6d8361a libpfctl: grow request buffer on ENOSPC
When we issue a request to pf and expect a serialised nvlist as a reply
we have to supply a suitable buffer to the kernel.
The required size for this buffer is difficult to predict, and may be
(slightly) different from request to request.
If it's insufficient the kernel will return ENOSPC. Teach libpfctl to
catch this and send the request again with a larger buffer.

MFC after:	2 weeks
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34908

(cherry picked from commit 7ed19f5c77)
2022-05-04 08:22:37 +02:00
Andrew Turner
3935c58c21 Have stpncpy tests ask the kernel for the page size
It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.

(cherry picked from commit 748f7c8db7)
2022-05-03 15:04:04 +01:00
Konstantin Belousov
aca70bd01e sched_getaffinity(3): more compatibility with Linux
(cherry picked from commit 67fc95025c)
2022-05-02 21:08:44 +03:00
Stefan Eßer
6e1f0f8006 libfetch: remove a set-but-not-used variable
(cherry picked from commit ce700f78f7)
2022-04-30 09:55:31 +02:00
John Baldwin
ffd150099c Extend the VMM stats interface to support a dynamic count of statistics.
- Add a starting index to 'struct vmstats' and change the
  VM_STATS ioctl to fetch the 64 stats starting at that index.
  A compat shim for <= 13 continues to fetch only the first 64
  stats.

- Extend vm_get_stats() in libvmmapi to use a loop and a static
  thread local buffer which grows to hold the stats needed.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D27463

(cherry picked from commit 6426978617)
2022-04-29 16:08:17 -07:00
John Baldwin
c4ec1f6efb libthr: Use TLS_TCB_* in _tcb_[cd]tor.
This matches libc and rtld in using the alignment (TLS_TCB_ALIGN) from
machine/tls.h instead of hardcoding 16.

Reviewed by:	kib
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D34023

(cherry picked from commit 8de1a8131e)
2022-04-29 16:05:18 -07:00
John Baldwin
1d290d36d8 iscsi: Handle large Text responses.
Text requests and responses can span multiple PDUs.  In that case, the
sender sets the Continue bit in non-final PDUs and the Final bit in
the last PDU.  The receiver responds to non-final PDUs with an empty
text PDU.

To support this, add a more abstract API in libiscsi which accepts and
receives key sets rather than PDUs.  These routines internally send or
receive one or more PDUs.  Use these new functions to replace the
handling of TextRequest and TextResponse PDUs in discovery sessions in
both ctld and iscsid.

Note that there is not currently a use case for large Text requests
and those are still always sent as a single PDU.  However, discovery
sessions can return a text response listing targets that spans
multiple PDUs, so the new API supports sending and receiving multi-PDU
responses.

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33548

(cherry picked from commit b406897911)
2022-04-29 14:17:43 -07:00
John Baldwin
54262b09e5 libiscsiutil: Change keys_load/save to operate on data buffers.
This will be used in future changes to support large text requests
spanning multiple PDUs.

Provide wrapper functions keys_load/save_pdu that operate use a PDU's
data buffer.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33547

(cherry picked from commit 25700db366)
2022-04-29 14:15:45 -07:00
John Baldwin
a96064b669 libiscsiutil: Fix a memory leak with negotiation keys.
When keys are loaded from a received PDU, a copy of the received keys
block is saved in the keys struct and the name and value pointers
point into that saved block.  Freeing the keys frees this block.

However, when keys are added to a keys struct to build a set of keys
later sent in a PDU, the keys data block pointer is not used and
individual key names and values hold allocated strings.  When the keys
structure was freed, all of these individual key name and value
strings were leaked.

Instead, allocate copies of strings for names and values when parsing
a set of keys from a received PDU and free all of the individual key
name and value strings when deleting a set of keys.

Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33545

(cherry picked from commit fd99905b45)
2022-04-29 14:15:38 -07:00
John Baldwin
f5a4ae2539 libiscsiutil: Use open_memstream to build the outgoing block of keys.
Reviewed by:	mav
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33546

(cherry picked from commit 2ccb8fde5e)
2022-04-29 14:14:37 -07:00
John Baldwin
ec79933e61 Add an internal libiscsiutil library.
Move some of the code duplicated between ctld(8) and iscsid(8) into a
libiscsiutil library.

Sharing the low-level PDU code did require having a
'struct connection' base class with a method table to permit separate
initiator vs target behavior (e.g. in handling proxy PDUs).

Reviewed by:	mav, emaste
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33544

(cherry picked from commit 6378393308)
2022-04-29 14:13:00 -07:00
John Baldwin
a641444939 TLS: Use <machine/tls.h> for libc and rtld.
- Include <machine/tls.h> in MD rtld_machdep.h headers.

- Remove local definitions of TLS_* constants from rtld_machdep.h
  headers and libc using the values from <machine/tls.h> instead.

- Use _tcb_set() instead of inlined versions in MD
  allocate_initial_tls() routines in rtld.  The one exception is amd64
  whose _tcb_set() invokes the amd64_set_fsbase ifunc.  rtld cannot
  use ifuncs, so amd64 inlines the logic to optionally write to fsbase
  directly.

- Use _tcb_set() instead of _set_tp() in libc.

- Use '&_tcb_get()->tcb_dtv' instead of _get_tp() in both rtld and libc.
  This permits removing _get_tp.c from rtld.

- Use TLS_TCB_SIZE and TLS_TCB_ALIGN with allocate_tls() in MD
  allocate_initial_tls() routines in rtld.

Reviewed by:	kib, jrtc27 (earlier version)
Differential Revision:	https://reviews.freebsd.org/D33353

(cherry picked from commit 8bcdb144eb)
2022-04-29 13:50:05 -07:00