aboutsummaryrefslogtreecommitdiff
path: root/lib/csu/mips
Commit message (Collapse)AuthorAgeFilesLines
* ld.bfd requires an explicit emulation for MIPS for ld -r.John Baldwin2020-08-041-0/+21
| | | | | | | | | | Unlike lld, ld.bfd doesn't infer the emulation from the first object file, but assumes its compiled in default for ld -r. Differential Revision: https://reviews.freebsd.org/D25728 Notes: svn path=/head/; revision=363848
* Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc.John Baldwin2020-07-031-31/+0
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25537 Notes: svn path=/head/; revision=362902
* Remove the sed hack for ABI tag notes.John Baldwin2020-06-152-24/+14
| | | | | | | | | | | | | | | | | | 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
* csu: Avoid additional nops in the MIPS INIT_CALL_SEQ macroAlex Richardson2020-06-051-5/+7
| | | | | | | | | | | | | Since we had a .set reorder, the nop after the "jal" was being placed after the delay slot, resulting in two nops. While changing this code also guard the .set noreorder with .set push/pop and use $zero as the cpsetup save register since we don't need to save $gp. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D25025 Notes: svn path=/head/; revision=361830
* mips !o32: fix csu buildKyle Evans2020-01-031-2/+2
| | | | | | | Pointy hat to: kevans Notes: svn path=/head/; revision=356328
* mips: csu: fix compilation w/ LLVMKyle Evans2020-01-031-2/+7
| | | | | | | | | | | | | | | GCC issues the warning, but with LLVM it is fatal- no matching .cprestore with .cpload. Reserve some place on the stack and and add the proper .cprestore to pair it with. nop added in the !o32 branch to fill out delay slot instruction, just in case. Reviewed by: arichardson Differential Revision: https://reviews.freebsd.org/D21697 Notes: svn path=/head/; revision=356327
* mips: remove 16-byte alignment from .init and .fini epiloguesEd Maste2019-05-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | The .init and .fini epilogues from crtn should be placed immediately after any instructions in .init and .fini sections from the linked objects. Using 16-byte alignment for the epilogues on MIPS was a bug, but it did not cause any issue with GNU ld as GNU ld (2.17.50) fills the padding with NOPs. Current versions of LLD fill any padding between different object files with trap instructions. Inserting trap padding prior to the .init/.fini epilogue is undesriable as the resulting binary will crash at runtime. The .init and .fini sections in object files linked between crti and crtn must already be a multiple of the instruction size and so no alignment directive is required in crtn. Indeed, other architectures (except sparc64) do not specify alignment in their crtn implementations. Reported by: arichardson Reviewed by: andrew Event: Waterloo Hackathon 2019 Differential Revision: https://reviews.freebsd.org/D18291 Notes: svn path=/head/; revision=348008
* Mark the function called by the MIPS .init/.fini sequence with .local.Andrew Turner2018-11-231-0/+2
| | | | | | | | | | | | As with r328939 we need to mark local symbols as such. Without this the assembly parser treats the symbols as global and created relocations against these private symbols. MFC with: r339738 Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=340840
* Add the (untested) mips and sparc64 .init call sequences.Andrew Turner2018-11-071-0/+20
| | | | | | | | | | | The BSD crtbegin/crtend code now builds on all architectures, however further work is needed to check if it works correctly. MFC with: r339738 Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=340213
* Build the csu tests on all architectures.Andrew Turner2018-10-301-0/+31
| | | | | | | | | | | The tests haven't been run them, but this is enough to build them so I can get feedback on if the various crt.h headers are correct. MFC with: r339738 Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=339916
* 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
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-261-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
* Don't include GNU object attributes when building with clang.John Baldwin2017-08-302-0/+4
| | | | | | | | | | | | | LLVM's MIPS assembler parser does not understand the GNU as '.gnu_attribute' keyword. This could be re-enabled if LLVM is updated in the future. The desired floating point ABI is already described in the .MIPS.abiflags section. Reviewed by: emaste Sponsored by: DARPA / AFRL Notes: svn path=/head/; revision=323028
* 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
* Make MIPS startup assembly files use neutral float ABI.Alexander Kabaev2016-11-162-0/+2
| | | | | | | | | | | This allows these files to be used with hard and softfloat targets with no special flags passed to the compiler. Reviewed by: adrian, br, imp Differential Revision: https://reviews.freebsd.org/D8506 Notes: svn path=/head/; revision=308712
* Remove historical GNUC testEd Maste2015-12-081-4/+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
* META_MODE: Remove DEP_MACHINE from Makefile.depend files.Bryan Drewery2015-09-251-2/+0
| | | | | | | | | This has not been needed since r246865 in projects/bmake. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288228
* META_MODE: Remove DEP_RELDIR from Makefile.depend files.Bryan Drewery2015-09-251-2/+0
| | | | | | | | | This has not been needed since r284171 in projects/bmake. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=288226
* 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
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+16
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=284345
| * Sync with HEAD.David E. O'Brien2013-02-081-3/+1
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=246555
| * Sync from headSimon J. Gerraty2012-11-041-0/+15
| | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
* | Only assign the environ in the startup code when environ is NULL.Konstantin Belousov2013-01-071-3/+1
|/ | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=245133
* After r217375, some startup objects under lib/csu are built in a specialDimitry Andric2012-04-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=234502
* Stop calling _init/_fini methods from crt1 for dynamic binaries. DoKonstantin Belousov2012-03-112-25/+9
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=232832
* - Remove one more no-op #ifndefOleksandr Tymoshenko2012-03-061-2/+0
| | | | Notes: svn path=/head/; revision=232616
* - Remove NOSHARED parts since it seems to be no-opOleksandr Tymoshenko2012-03-061-4/+3
| | | | | | | - Call _init_tls for statically linked binaries Notes: svn path=/head/; revision=232580
* Whitespace nitWarner Losh2011-02-011-1/+1
| | | | Notes: svn path=/head/; revision=218179
* Apply a workaround for a binutils issue with the .note.ABI-tag sectionDimitry Andric2011-01-131-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | generated from lib/csu/common/crtbrand.c (which ultimately ends up in executables and shared libraries, via crt1.o, gcrt1.o or Scrt1.o). For all arches except sparc, gcc emits the section directive for the abitag struct in crtbrand.c with a PROGBITS type. However, newer versions of binutils (after 2.16.90) require the section to be of NOTE type, to guarantee that the .note.ABI-tag section correctly ends up in the first page of the final executable. Unfortunately, there is no clean way to tell gcc to use another section type, so crtbrand.c (or the C files that include it) must be compiled in multiple steps: - Compile the .c file to a .s file. - Edit the .s file to change the 'progbits' type to 'note', for the section directive that defines the .note.ABI-tag section. - Compile the .s file to an object file. These steps are done in the invididual Makefiles for each applicable arch. Reviewed by: kib Notes: svn path=/head/; revision=217375
* Fix spelling of noreorder.Juli Mallett2010-03-131-1/+1
| | | | Notes: svn path=/head/; revision=205112
* Use default WARNS setting (of 6) for lib/csu.Ulrich Spörlein2010-03-052-6/+3
| | | | | | | | | PR: bin/140089 Reviewed by: jmallett Approved by: ed (co-mentor) Notes: svn path=/head/; revision=204757
* Properly declare non-extern functions in crt1Ulrich Spörlein2010-03-051-0/+2
| | | | | | | | | | | Also move the declarations after __progname consistently to make the distinction clearer. Reviewed by: jmallett Approved by: ed (co-mentor) Notes: svn path=/head/; revision=204756
* Use ABI neutral macrosaWarner Losh2010-03-032-29/+51
| | | | | | | Submitted by: jmallet Notes: svn path=/head/; revision=204674
* __main and __gccmain are no longer required, so eliminate them.Warner Losh2010-03-031-3/+0
| | | | | | | Submitted by: jmallet@ Notes: svn path=/head/; revision=204673
* Build lib/ with WARNS=6 by default.Ed Schouten2010-01-021-0/+2
| | | | | | | | | | | | Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and lower it when needed. I'm setting WARNS?=0 for secure/. It seems secure/ includes the Makefile.inc provided by lib/. I'm not going to touch that directory. Most of the code there is contributed anyway. Notes: svn path=/head/; revision=201381
* Properly support -fPIE by linking PIE binaries with specially-builtKonstantin Belousov2009-12-021-1/+4
| | | | | | | | | | | | | | | | | Scrt1.o instead of crt1.o, since the later is built as non-PIC. Separate i386-elf crt1.c into the pure assembler part and C code, supplying all data extracted by assembler stub as explicit parameters [1]. Hide and localize _start1 symbol used as an interface between asm and C code. In collaboration with: kan Inspired by: PR i386/127387 [1] Prodded and tested by: rdivacky [1] MFC after: 3 weeks Notes: svn path=/head/; revision=200038
* Bring C runtime bits for FreeBSD/mips from p4 mips2-jnpr branch.Oleksandr Tymoshenko2008-05-034-0/+191
Approved by: cognet (mentor) Notes: svn path=/head/; revision=178739