summaryrefslogtreecommitdiffstats
path: root/lib/csu
Commit message (Collapse)AuthorAgeFilesLines
* MFC ↵jhibbits2017-04-011-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | r310146,r311912,r312369,r312617,r312614,r312659,r312974,r312977,r313005,r314826: A series of Clang-related powerpc commits r310146: Use the right bitwise OR operation for clearing single-step at trap time. r311912: Force all TOC references in asm to include '@toc' r312369: Use the explicit expanded form of cmp. r312617: Hide the 'MOREARGS' macro, it conflicts with contrib code, and is only used in one file. r312614: Don't pass -Wa,-many through clang, the integrated as doesn't support it. r312659: Avoid using non-zero argument for __builtin_frame_address(). r312974: Add a INTR_TRIG_INVALID, and use it in the powerpc interrupt code. r312977: Force the setting of bit 7 in the sysmouse packet byte 1 to be unsigned. r313005: Update CFLAGS for clang compatibility r314826: Clang in base now supports -mlongcall, so remove this hack
* MFC r312452-r312512:ngie2017-02-109-26/+27
| | | | | | | | | | r312452-r312512: - Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones This simplifies pathing in make/displayed output - Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc
* Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so isandrew2016-05-221-10/+1
| | | | | | no longer needed. Sponsored by: ABT Systems Ltd
* Don't reset CC away from full-pathed gcc.bdrewery2016-03-241-0/+3
| | | | | | This was breaking the build when using CROSS_TOOLCHAIN=powerpc64-gcc Sponsored by: EMC / Isilon Storage Division
* Remove the compat code to handle the kernel passing us an unalingedandrew2016-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
* Use -mlong-calls to build crt1.o and gcrt1.o. This tells the compiler toandrew2016-01-101-2/+3
| | | | | | | | generate code to branch based on an address in a register. This allows us to have binaries larger than the 32MiB limit of a branch instruction. The main use of this is with clang. Clang 3.8.0 has been shown to be larger than the above limit.
* Start support for the RISC-V 64-bit architecture developed by UC Berkeley.br2015-12-114-0/+241
| | | | | | | | | | | | | | | RISC-V is a new ISA designed to support computer research and education, and is now become a standard open architecture for industry implementations. This is a minimal set of changes required to run 'make kernel-toolchain' using external (GNU) toolchain. The FreeBSD/RISC-V project home: https://wiki.freebsd.org/riscv. Reviewed by: andrew, bdrewery, emaste, imp Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D4445
* Remove historical GNUC testemaste2015-12-088-46/+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
* Provide support for ELFv2 userland if using a newer compiler (recent clangnwhitehorn2015-12-031-6/+31
| | | | or gcc) and binutils >= 2.24. Not enabled by default.
* Annotate arm userspace assembler sources stating their tolerance tokib2015-09-292-0/+3
| | | | | | | the non-executable stack. Reviewed by: andrew Sponsored by: The FreeBSD Foundation
* META_MODE: Remove DEP_MACHINE from Makefile.depend files.bdrewery2015-09-255-10/+0
| | | | | | This has not been needed since r246865 in projects/bmake. Sponsored by: EMC / Isilon Storage Division
* META_MODE: Remove DEP_RELDIR from Makefile.depend files.bdrewery2015-09-256-12/+0
| | | | | | This has not been needed since r284171 in projects/bmake. Sponsored by: EMC / Isilon Storage Division
* Fix installation of 32bit libraries after r288074.bdrewery2015-09-218-0/+16
| | | | | | | | | | | 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
* Replace realinstall: and META_MODE staging hacks with FILES mechanism.bdrewery2015-09-219-45/+40
| | | | | | | | | | 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
* Force the dynamic linker to resolve _end early so we pick up the correctandrew2015-07-021-1/+12
| | | | | | copy. Sponsored by: ABT Systems Ltd
* Add a workaround to correctly align the stack before calling into C code.andrew2015-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
* Add META_MODE support.sjg2015-06-138-0/+111
|\ | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp
| * dirdeps.mk now sets DEP_RELDIRsjg2015-06-081-2/+0
| |
| * Merge sync of headsjg2015-05-2712-5/+236
| |\ | |/ |/|
| * Put lib/csu/amd64/Makefile back the way it is in headsjg2014-11-303-9/+9
| | | | | | | | and handle staging via ../Makefile.inc
| * Merge from head@274682sjg2014-11-192-10/+11
| |\
| * \ Merge head from 7/28sjg2014-08-196-366/+6
| |\ \
| * \ \ Merge headsjg2014-04-271-1/+1
| |\ \ \
| * \ \ \ Merge head@256284sjg2013-10-132-0/+15
| |\ \ \ \
| * \ \ \ \ Merge from headsjg2013-09-052-0/+12
| |\ \ \ \ \
| * | | | | | Updated dependenciessjg2013-02-161-2/+0
| | | | | | |
| * | | | | | Sync with HEAD.obrien2013-02-088-29/+16
| |\ \ \ \ \ \
| * \ \ \ \ \ \ Sync from headsjg2012-11-047-4/+97
| |\ \ \ \ \ \ \
| * | | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-222-3/+18
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net>
* | | | | | | | All FreeBSD platforms are elf: move i386-elf to i386emaste2015-05-196-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a leftover from when we had both i386 a.out and ELF. Reviewed by: kib, imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2591
* | | | | | | | Ensure the cross assembler, linker and objcopy are used for the build32dim2015-04-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stage, just like for the regular world stage. Reviewed by: rodrigc, imp, bapt, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D2187
* | | | | | | | Start to import support for the AArch64 architecture from ARM. This changeandrew2015-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
* | | | | | | | Add a comment explaining why gcc is needed.jhibbits2015-02-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | X-MFC-With: 278231 MFC after: 2 weeks
* | | | | | | | powerpc64 csu needs to be built by gcc, so enforce that.jhibbits2015-02-051-0/+3
| |_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, world is one step closer to being clang-able. MFC after: 2 weeks
* | | | | | | Use bsd.lib.mk here as all other csu Makefiles do.bdrewery2014-08-191-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This effectively reverts r124752. There's no reason this should be different. It resulted in needing NO_PIE in the original opt-out NO_PIE commit as this was not using the proper framework. Reported by: peter
* | | | | | | Revert r267233 for now. PIE support needs to be reworked.bdrewery2014-08-192-4/+0
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other build-only utility libraries. 2. Another 40% is fixed by generating _pic.a variants of various libraries. 3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR) where it never would work anyhow, such as csu or loader. This suggests there may be better ways of adding support to the tree. Many of these cases can be fixed such that -fPIE will work but there is really no reason to have it in those cases. 4. Some of the uses are working around hacks done to some Makefiles that are really building libraries but have been using bsd.prog.mk because the code is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have been needed. We likely do want to enable PIE by default (opt-out) for non-tree consumers (such as ports). For in-tree though we probably want to only enable PIE (opt-in) for common attack targets such as remote service daemons and setuid utilities. This is also a great performance compromise since ASLR is expected to reduce performance. As such it does not make sense to enable it in all utilities such as ls(1) that have little benefit to having it enabled. Reported by: kib
* | | | | | Reviewed by: impsjg2014-07-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LDFLAGS is supposed to be given to CC not LD. Define _LDFLAGS as a filtered version of LDFLAGS safe to give to LD
* | | | | | Remove ia64.marcel2014-07-074-363/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan
* | | | | | In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.bdrewery2014-06-082-0/+4
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is currently an opt-in build flag. Once ASLR support is ready and stable it should changed to opt-out and be enabled by default along with ASLR. Each application Makefile uses opt-out to ensure that ASLR will be enabled by default in new directories when the system is compiled with PIE/ASLR. [2] Mark known build failures as NO_PIE for now. The only known runtime failure was rtld. [1] http://www.bsdcan.org/2014/schedule/events/452.en.html Submitted by: Shawn Webb <lattera@gmail.com> Discussed between: des@ and Shawn Webb [2]
* | | | | Use the size of the MACHINE_ARCH string instead of sizeof(uint32_t). It cancognet2013-10-271-1/+1
| |_|_|/ |/| | | | | | | | | | | | | | | happen sizeof(MACHINE_ARCH) is more than 4 bytes, and bad things would happen. This should make the ctors being called again on armeb.
* | | | Add an elf note on ARM to store the MACHINE_ARCH an executable was builtandrew2013-09-262-0/+15
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | for. This is useful for software needing to know which architecture a binary is built for as arm and armv6 have slight differences meaning only some binaries build for one will work as expected on the other. It is expected pkgng will be able to make use of this to simplify the logic to determine which package ABI to use. Approved by: re (kib)
* | | Add a makefle that recurses into the right architecture-specificmarcel2013-05-211-0/+10
| | | | | | | | | | | | | | | | | | | | | sub-directory. This to allow simpler logic outside of the csu directory. Obtained from: Juniper Networks, Inc.
* | | Add the Clang specific -Wmissing-variable-declarations to WARNS=6.ed2013-04-191-0/+2
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | This compiler flag enforces that that people either mark variables static or use an external declarations for the variable, similar to how -Wmissing-prototypes works for functions. Due to the fact that Yacc/Lex generate code that cannot trivially be changed to not warn because of this (lots of yy* variables), add a NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this specific compiler warning. Announced on: toolchain@
* | Only assign the environ in the startup code when environ is NULL.kib2013-01-078-29/+16
|/ | | | | | | | | | | | | | Preloaded library could have changed the environment, and unconditional assingment to the environ undoes the customization. The binaries needs to be recompiled to get the fix. Move the common code to set up environ and __progname into the helper. Note that ia64 possibly not fixed, due to it still using old csu. Reported and tested by: John Hein <jhein@symmetricom.com> Reviewed by: kan, scf Approved by: secteam (simon) MFC after: 2 weeks
* Revert r234356 for now, as it leads to run-time problems on 32-bitdim2012-04-231-2/+1
| | | | | | | PowerPC. Note this will break world. Reported by: andreast Pointy hat to: dim
* After r217375, some startup objects under lib/csu are built in a specialdim2012-04-207-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | way: first they are compiled to assembly, then some sed'ing is done on the assembly, and lastly the assembly is compiled to an object file. This last step is done using ${CC}, and not ${AS}, because when the compiler is clang, it outputs directives that are too advanced for our old gas. So we use clang's integrated assembler instead. (When the compiler is gcc, it just calls gas, and nothing is different, except one extra fork.) However, in the .s to .o rules in lib/csu/$ARCH/Makefile, I still passed CFLAGS to the compiler, instead of ACFLAGS, which are specifically for compiling .s files. In case you are using '-g' for debug info anywhere in your CFLAGS, it causes the .s files to already contain debug information in the assembly itself. In the next step, the .s files are also compiled using '-g', and if the compiler is clang, it complains: "error: input can't have .file dwarf directives when -g is used to generate dwarf debug info for assembly code". Fix this by using ${ACFLAGS} for compiling the .s files instead. Reported by: jasone MFC after: 1 week
* Work around an issue on 32-bit PowerPC, where clang executable can getdim2012-04-161-1/+2
| | | | | | too big, causing 'relocation truncated to fit' errors at link time. Reviewed by: nwhitehorn
* Work around a binutils bug on powerpc64 where the TOC would not benwhitehorn2012-03-131-1/+2
| | | | | | | | | | properly reloaded when calling _fini() in large binaries with multiple TOC sections (e.g. GCC), leading to a segmentation fault. Adding -mlongcall to crt1 flags causes the compiler to emit explicit TOC load instructions for all function calls, including _fini(). Reviewed by: kib Pointy hat to: kib
* Stop calling _init/_fini methods from crt1 for dynamic binaries. Dokib2012-03-1116-180/+187
| | | | | | | | | | | | | call preinit, init and fini arrays methods from crt1 for static binaries. Mark new crt1 with FreeBSD-specific ELF note. Move some common crt1 code into new MI file ignore_init.c, to reduce duplication. Also, conservatively adjust nearby sources for style. Reviewed by: kan Tested by: andrew (arm), flo (sparc64) MFC after: 3 weeks
* Add a header with definitions useful for constructing ELF notes.kib2012-03-111-0/+38
| | | | | Reviewed by: kan MFC after: 3 weeks
OpenPOWER on IntegriCloud