aboutsummaryrefslogtreecommitdiff
path: root/lib/csu/aarch64
Commit message (Collapse)AuthorAgeFilesLines
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* csu: Find the main pointer through the GOTAndrew Turner2024-05-221-2/+2
| | | | | | | | | | | | | Use the Global Offset Table to find the location of main in crt1. With lld the old code would point to main@plt, however ld.bfd fails to link when main is in a shared library. Fix this by using the GOT address to find main as it works with both lld and bfd. Reviewed by: jrtc27 Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45259
* csu: Teach csu about PAC and BTIAndrew Turner2023-10-303-0/+15
| | | | | | | | | | | | | | | | | Add the Branch Target Identification (BTI) note to libc assembly sources and Pointer Authentication Code (PAC) instructions to _init and _fini. _init and _fini may be called indirectly so need a BTI landing pad. As they are non-leaf functions use the appropriate PAC instruction that also guards against changing the link register. As all object files need the note for any binary using these object files we need to insert it in all asm files. Reviewed by: markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42227
* dirdeps: Add missing dependency filesStephen J. Kiernan2023-10-291-0/+11
| | | | | Some leaf directories were missing Makefile.depend files or needed architecture-specific Makefile.depend.* files.
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-164-8/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* csu: Implement _start using as to satisfy unwinders on aarch64Dmitry Chagin2023-07-073-17/+25
| | | | | | | | | | | | The right unwinding stop indicator should be CFI-undefined PC. https://dwarfstd.org/doc/Dwarf3.pdf - page 118: If a Return Address register is defined in the virtual unwind table, and its rule is undefined (for example, by DW_CFA_undefined), then there is no return address and no call address, and the virtual unwind of stack activations is complete. Reviewed by: Differential Revision: https://reviews.freebsd.org/D40623
* csu: Add the prologue and epilogue to the _init and _fini on aarch64Dmitry Chagin2023-07-072-8/+6
| | | | | | | | | | | | | Normally, modern unwinders uses Dwarf information to unwind stack, however in case when the code is not annotated by Dwarf instructions, unwinders fallbacks to a frame-pointer based algorithm. That is allows libunwind to unwind stack from global constructors and destructors. Also it makes gdb happy as it printed nonexistent frame before. Reviewed by: Differential Revision: https://reviews.freebsd.org/D40842
* csu: move common code to libcKonstantin Belousov2023-03-113-75/+5
| | | | | | | | | | | | | | | | | | | | | | Why? Most trivial point, it shaves around 600 bytes from the dynamic binaries on amd64. Less trivial, the removed code is no longer part of the ABI, and we can ship updates to it with libc updates. Right now most of the csu is linked into the binaries and require us to do somewhat tricky ABI compat when it needs to change. For instance, the init_array change would be much simpler and does not require note tagging if we have init calling code in libc. This could be improved more, by splitting dynamic and static initialization. For instance, &_DYNAMIC tests can be removed then. Such change, nonetheless, would require building libc three times. I left this for later, after this change stabilizes, if ever. Reviewed by: markj Discussed with: jrtc27 (some objections, see the review), imp Tested by: markj (aarch64) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D37220
* Add arm64 ifunc support in static binariesAndrew Turner2021-08-233-2/+51
| | | | | | | | | | | Add support for the R_AARCH64_IRELATIVE relocation type in static binaries on arm64. This is based on the powerpc code, updating it to use the arm64 resolver ABI, and use the arm64 relocation type. Tested by: brd Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31641
* Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc.John Baldwin2020-07-031-30/+1
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25537 Notes: svn path=/head/; revision=362902
* Only include object files from .ALLSRC when linking crt1 objects.John Baldwin2020-06-261-3/+3
| | | | | | | | | | Reported by: np, peterj Reviewed by: kib, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25469 Notes: svn path=/head/; revision=362660
* Always compile the brand and ignore init ELF notes standalone.John Baldwin2020-06-242-9/+7
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25374 Notes: svn path=/head/; revision=362589
* Remove the sed hack for ABI tag notes.John Baldwin2020-06-153-37/+60
| | | | | | | | | | | | | | | | | | The ELF notes compiled in C were placed in a section with the wrong type (SHT_PROGBITS instead of SHT_NOTE). Previously, sed was used on the generated assembly to rewrite the section type. Instead, write the notes in assembly which permits setting the correct section type directly. While here, move inline assembly entry points out of C and into assembly for aarch64, arm, and riscv. Reviewed by: kib Tested on: amd64 (cirrus-ci), riscv64 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25211 Notes: svn path=/head/; revision=362203
* Implement a BSD licensed crtbegin/crtendAndrew Turner2018-10-251-0/+2
| | | | | | | | | | | | | | | | | These are needed for .ctors/.dtors and .jcr handling. The former needs all the function pointers to be called in the correct order from the .init/.fini section. The latter just needs to call a gcj specific function if it exists with a pointer to the start of the .jcr section. This is currently disabled until __dso_handle support is added. Reviewed by: emaste MFC after: 1 month Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17587 Notes: svn path=/head/; revision=339738
* Process irelocs for statically linked binaries from crt1 on x86.Konstantin Belousov2018-10-131-0/+1
| | | | | | | | | | | | | This makes statically linked binaries with ifuncs operational. Reported and tested by: mjg Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation Approved by: re (rgrimes) Differential revision: https://reviews.freebsd.org/D17363 Notes: svn path=/head/; revision=339351
* Rework r234502 to include a modified CFLAGS along with ACFLAGS.John Baldwin2017-04-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | On most architectures crt objects are compiled in a multiple-step process so that sed can be run on the generated assembly. As the final step, the C compiler generates an object file from the modified assembly output. Currently this last step uses $CC with only $ACFLAGS. However, for other uses in the tree, $ACFLAGS is meant to include assembly-specific compiler flags that are in addition to $CFLAGS (see default .S.o rules bsd.suffixes.mk). In particular, external toolchains may require additional flags to select a non-default target which will be present in CFLAGS but not ACFLAGS. To support this while still mitigating the issue with CFLAGS described in r234502, include a modified CFLAGS that excludes "-g" when assembling the modified assembly files. Note that normally an assembler ($AS) is used to assemble .s flags to object files (see bsd.suffixes.mk). However, llvm-based toolchains do not currently have a stand-alone assembler. Reviewed by: imp Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D10085 Notes: svn path=/head/; revision=316620
* Use SRCTOP-relative paths and .CURDIR with :H instead of ".." specified pathsEnji Cooper2017-01-201-3/+3
| | | | | | | | | | This implifies pathing in make/displayed output MFC after: 3 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312455
* Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so isAndrew Turner2016-05-221-10/+1
| | | | | | | | | no longer needed. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=300406
* Remove the compat code to handle the kernel passing us an unalingedAndrew Turner2016-01-131-5/+1
| | | | | | | | | | | stackpointer. Userland expects the kernel to pass it an aligned sp and pass a pointer to the arguments in x0. The kernel side was updated in r289502, 3 months ago. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=293832
* Remove historical GNUC testEd Maste2015-12-081-6/+0
| | | | | | | | | | | | The requirement is for a GCC-compatible compiler and not necessarily GCC itself. However, we currently expect any compiler used for building the whole of FreeBSD to be GCC-compatible and many things will break if not; there's no longer a need to have an explicit test for this in csu. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=292000
* Fix installation of 32bit libraries after r288074.Bryan Drewery2015-09-211-0/+2
| | | | | | | | | | | | | | FILES is not used when LIBRARIES_ONLY is set, which is used to build and install the lib32 sysroot. All of the csu files do quality as "libraries" for this case so just undefine LIBRARIES_ONLY. This is still better than the previous realinstall handling as it does not hook into META_MODE properly. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288076
* Replace realinstall: and META_MODE staging hacks with FILES mechanism.Bryan Drewery2015-09-211-5/+5
| | | | | | | | | | | | | This partially reverts r270170 for lib/csu/i386 while retaining the change for using bsd.lib.mk. These FILES groups could go into lib/csu/Makefile.inc but I've kept them in the Makefiles for clarity. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288074
* Force the dynamic linker to resolve _end early so we pick up the correctAndrew Turner2015-07-021-1/+12
| | | | | | | | | copy. Sponsored by: ABT Systems Ltd Notes: svn path=/head/; revision=285044
* Add a workaround to correctly align the stack before calling into C code.Andrew Turner2015-06-221-3/+7
| | | | | | | | | | | | | | | | | When enough time has passed for users to update their userland the kernel fix will be applied. This will change the ABI to have x0 point to the args and sp be correctly aligned. It is expected this compatibility code can be removed when the kernel and qemu usermode emulation have both been updated for the new ABI. This fixes clang failures, and most likely other crashes. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=284707
* Start to import support for the AArch64 architecture from ARM. This changeAndrew Turner2015-03-194-0/+225
only adds support for kernel-toolchain, however it is expected further changes to add kernel and userland support will be committed as they are reviewed. As our copy of binutils is too old the devel/aarch64-binutils port needs to be installed to pull in a linker. To build either TARGET needs to be set to arm64, or TARGET_ARCH set to aarch64. The latter is set so uname -p will return aarch64 as existing third party software expects this. Differential Revision: https://reviews.freebsd.org/D2005 Relnotes: Yes Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=280259