summaryrefslogtreecommitdiffstats
path: root/lib/csu
Commit message (Collapse)AuthorAgeFilesLines
* MFC r280980:dim2015-04-091-2/+2
| | | | | | | | Ensure the cross assembler, linker and objcopy are used for the build32 stage, just like for the regular world stage. Reviewed by: rodrigc, imp, bapt, emaste Differential Revision: https://reviews.freebsd.org/D2187
* MFC 257233: Use size of the MACHINE_ARCH string instead of sizeof(uint32_t).ian2014-05-181-1/+1
|
* 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
* - Remove one more no-op #ifndefgonzo2012-03-061-2/+0
|
* - Remove NOSHARED parts since it seems to be no-opgonzo2012-03-061-4/+3
| | | | - Call _init_tls for statically linked binaries
* Build Scrt.o on powerpc64. Its introduction on other platforms got lostnwhitehorn2011-06-271-4/+10
| | | | during the period of time the powerpc64 port was on a project branch.
* Turn off default generation of userland dot symbols on powerpc64 now thatnwhitehorn2011-02-181-8/+6
| | | | | we have a binutils that supports it. Kernel dot symbols remain on to assist DDB.
* Whitespace nitimp2011-02-011-1/+1
|
* Mark csu on PowerPC as not requiring executable stack.kib2011-01-144-0/+8
| | | | Reviewed and tested by: nwhitehorn
* The (%esp & 0xf) == 0 should be true before the call instruction iskib2011-01-131-0/+1
| | | | | | | | executed, for the properly aligned stack. Reported and tested by: rstone Pointy hat to: kib MFC after: 3 days
* Apply a workaround for a binutils issue with the .note.ABI-tag sectiondim2011-01-138-28/+171
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Add section .note.GNU-stack for assembly files used by 386 and amd64.kib2011-01-075-0/+10
|
* Add a .note.ABI-tag section to ia64 startup files by linking crtbrand.ctijl2010-12-101-8/+29
| | | | | | | | | in crt1.o. On other architectures crtbrand.c is included from crt1.c, but that's not a C source code file on ia64. Instead it is compiled separately and included in crt1.o using incremental linking. Tested by: dim (previous version) Approved by: kib (mentor)
* Let all .c and .S files under lib/csu consistently use the __FBSDID()dim2010-12-0921-50/+61
| | | | | macro for identification, instead of several different hand-rolled variants (plain .ident, .ascii, etc).
* Remove two .endp's without matching .proc in lib/csu/ia64/crtn.S.dim2010-10-151-2/+0
| | | | | | This allows it to assemble with newer binutils. Reviewed by: marcel
* C startup support for 64-bit PowerPC.nwhitehorn2010-07-104-0/+248
| | | | Obtained from: projects/ppc64
* Add unwind annotations to the asm part of crt1 on i386. Terminate thekib2010-06-181-1/+8
| | | | | | | process with SIGTRAP if _start1() unexpectedly returns. Reviewed by: kan MFC after: 2 weeks
* Do not create *.gmon files for PIE executables on i386.jilles2010-03-201-1/+1
| | | | | | | | | | | | Scrt1_c.o was accidentally compiled with -DGCRT (profiling), like gcrt1_c.o. This problem is i386-specific, the other architectures are OK. If you have problems with PIE executables such as samba and cups leaving behind gmon files, rebuild them after installing this change. PR: ports/143924 Reviewed by: kib MFC after: 3 days
* Fix spelling of noreorder.jmallett2010-03-131-1/+1
|
* Use default WARNS setting (of 6) for lib/csu.uqs2010-03-056-15/+7
| | | | | | PR: bin/140089 Reviewed by: jmallett Approved by: ed (co-mentor)
* Properly declare non-extern functions in crt1uqs2010-03-055-5/+13
| | | | | | | | Also move the declarations after __progname consistently to make the distinction clearer. Reviewed by: jmallett Approved by: ed (co-mentor)
* Use ABI neutral macrosaimp2010-03-032-29/+51
| | | | Submitted by: jmallet
* __main and __gccmain are no longer required, so eliminate them.imp2010-03-031-3/+0
| | | | Submitted by: jmallet@
* Build lib/ with WARNS=6 by default.ed2010-01-024-1/+6
| | | | | | | | | 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.
* Properly support -fPIE by linking PIE binaries with specially-builtkib2009-12-029-35/+93
| | | | | | | | | | | | | | 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
* Fix build when WITH_SSP is set explicitly.ru2009-02-211-1/+1
| | | | Submitted by: Jeremie Le Hen
* Add -fno-omit-frame-pointer to CFLAGS used to compile crt1.c on amd64.kib2008-08-221-0/+1
| | | | | | | | | | For gcc' __builtin_frame_address() to work, all call frames need to save frame pointer. In particular, this is important for the upper frame that should terminate the chain. No objections from: jhb PR: amd64/126543 MFC after: 1 week
* Enable GCC stack protection (aka Propolice) for userland:ru2008-06-251-0/+3
| | | | | | | | | | | | | | | | | | | | | - It is opt-out for now so as to give it maximum testing, but it may be turned opt-in for stable branches depending on the consensus. You can turn it off with WITHOUT_SSP. - WITHOUT_SSP was previously used to disable the build of GNU libssp. It is harmless to steal the knob as SSP symbols have been provided by libc for a long time, GNU libssp should not have been much used. - SSP is disabled in a few corners such as system bootstrap programs (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves. - It should be safe to use -fstack-protector-all to build world, however libc will be automatically downgraded to -fstack-protector because it breaks rtld otherwise. - This option is unavailable on ia64. Enable GCC stack protection (aka Propolice) for kernel: - It is opt-out for now so as to give it maximum testing. - Do not compile your kernel with -fstack-protector-all, it won't work. Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
* Bring C runtime bits for FreeBSD/mips from p4 mips2-jnpr branch.gonzo2008-05-034-0/+191
| | | | Approved by: cognet (mentor)
* The __used (== __attribute__((__used)) ) silences the warning producedkib2007-12-041-1/+1
| | | | | | by unreferenced symbol. Apply __used instead of rev. 1.5. Requested by: kan
* Restore the branding of the ELF executables. The structure was optimized out.kib2007-12-031-1/+1
| | | | MFC after: 3 days
* Fix TLS on sparc64 for statically and dynamically linked binarieskmacy2006-10-081-4/+3
| | | | | Approved by: rwatson (mentor) Reviewed by: jmg and marcel
* Remove alpha left-overs.ru2006-08-224-233/+0
|
* GC these crt{begin,end}.c, which are unused since the last FreeBSD platformmarius2006-05-222-114/+0
| | | | switched to those created from GCC's crtstuff.c 4 years ago.
* Fixed profiling of main() for amd64 and i386. This started rottingbde2005-10-072-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | in 1993 in rev.1.5 of the i386 a.out version (csu/i386/crt0.c). Profiling uses a magic label "eprol" to delimit the start of the part of the text section covered by profiling. This label must be placed before the call to main() to get main() properly profiled. It was placed there in rev.1.1 of crt0.c. Rev.1.5 imported the initial implementation of shared libraries in FreeBSD and misplaced the label. Fortunately, the misplaced label was misspelled and the old label wasn't removed, so the new label had no effect. Unfortunately, when profiling was implemented for the ELF in 1998 in rev.1.2 of csu/i386-elf/crt1.c, only the incorrectly placed label was copied (after fixing its name). The bug was then copied to all other arches. The label seems to be still misplaced in NetBSD for most arches. It is in common.c for most arches so it is even further from being inside the function that calls main(). I think "eprol" is short for "end of prologue", but it must be placed before the end of the prologue so that it covers main(). crt0.c has it before the calls atexit(_mcleanup) and monstartup(...), but it cannot affect these calls so I moved it after the call to monstartup(). It now also covers the call to _init() but not the newer call to _init_tls(). Profiling of _init() seems to be harmless, and the call to _init_tls() seems to be misplaced. Reviewed by: jdp (long ago, for a slightly different i386 version)
* Align the stack to a 16 byte boundary so that we can safely call functionsdfr2005-05-191-0/+3
| | | | | | | | | that use SSE. The compiler does attempt to do this in main() but not very successfully - it still manages to use unaligned offsets from %ebp in some cases. Also we need to have an aligned stack in case something uses SSE via _init(). MFC After: 1 week
* Keep the stack aligned to a 16 byte boundary when calling init functionsdfr2005-05-192-0/+4
| | | | | | | so that we don't cause a bus error if they start storing SSE math stuff on the stack. MFC After: 1 week
* Remnant code (broken, unhooked) from a.out which I missed.trhodes2005-01-113-527/+0
| | | | Noticed by: ru
* Implement .init and .fini.cognet2004-09-233-8/+27
|
* Back out the call to _init_tls() - something is broken there and itdfr2004-08-211-2/+0
| | | | prevents all static binaries from running.
* Bring ia64 back from the dead. After a call one needs to restore themarcel2004-08-181-1/+1
| | | | | | | | | GP register, because it's clobbered for calls across load modules. The previous commit inserted the call to _init_tls() between the call to atexit() and the restoration of the GP register clobbered by it. Fix: restore GP before we call _init_tls(). Pointy hat: dfr@
OpenPOWER on IntegriCloud