summaryrefslogtreecommitdiff
path: root/lib/csu/common
AgeCommit message (Collapse)Author
2022-06-21Support ifunc on aarch64. The tests pass at least.skrll
2022-06-21Wrap long #if defined(...) || ... and sort. NFCI.skrll
2022-06-21Trailing whitespaceskrll
2021-04-20Instead of compiling files with -fcommon, create an include file and declarechristos
the 3 symbols that need to be common using an attribute. Put all the 3 symbol definitions in libc in one place (initfini.c). Reviewed by joerg@
2018-12-28Re-do previous (always make available preinit/initarray/finiarray), withchristos
less disruption.
2018-12-28Undo previous; breaks macppc/m68k (at least)christos
2018-12-28Avoid duplicate definitions on arm (reported by kre@)christos
2018-12-27Allow both array and non-array constructors for transition.christos
2018-12-27Enable initfini array support for everyone.christos
2018-11-26Do not pass the main object handle from the assembler startup stub tojoerg
the common ___start routine. It's only used for a pointless magic version check. Thanks to martin@ for testing various architectures.
2018-07-13i386/amd64 build fix. Fix "possibly used uninitialized" from gcc.kre
These changes should make no practical effect - but because external data is being examined, it would be possible to contrive a situation (perhaps) where uninit'd vars could actually be used (unless the format has been checked elsewhere earlier - I did not look ... we have to appease gcc anyway). Joerg: Please review (& fix)
2018-07-12Add static PIE support for i386 and AMD64.joerg
The basic glue works with mininal changes for other architectures as well, but those require linker changes first to avoid leaking dynamic relocations into the binary.
2018-07-12_DYNAMIC is present for static PIE as well, so loosen rtld check.joerg
2018-03-29Move the complex logic for dynamically writing branches from ld.elf_sojoerg
into a header for reuse in crt0.o for static ifunc support. Change the existing logic for sparc64 to use the Bicc variant of ba,a as it allows +-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc variant the same trick for using ba,a and not sethi+jmp when possible.
2018-03-09Add ifunc support for statically linked applications on x86, ppc, sparcjoerg
and ARM.
2017-07-18.eh_frame should be read-only on MIPS too.joerg
2016-06-29For some mind-boogling reasons, GCC 5.4 believes that a weak referencejoerg
cannot alias with an extern. While this is clearly bogus, avoid yet another alias handling bug and use strong aliases. It's actually slightly simpler, too.
2016-06-07Fun fact of the weak: a weak reference doesn't have visibility attached.joerg
As such, reorganize the start/end references to use a weak reference only, if we use it to remove size knowledge. Otherwise use weak external declarations.
2016-06-05Make older GCC and Clang happy and use weak references to the elements,joerg
not declared as arrays.
2016-06-01Revert -O1 hack for GCC 5.3, replaced by workaround in the code.joerg
2016-06-01PR toolchain/51121:joerg
__CTOR_LIST__ and __CTOR_LIST_END__ are logically the same object, but due to the start marker, the former has to be declared as array of fixed size. Newer GCC versions take the liberty of exploiting the UB of accessing global objects past the end to unconditionally load zero values in that case. Two fixes are possible: (1) Pruning via inline assembler as done by GCC's own CRT copy. (2) Pruning via weak references as done for linker sets. Since the second part is known and required to work anyway, prefer this approach. In theory, the labels could be replaced completely, except that GNU as doesn't provide start/end symbols for sections containing dots.
2016-05-10We need the -O1 hack (for gcc 5.3) for crtbegin.c as well.martin
Works around PR toolchain/51121.
2016-05-01Change section flags to "MG" and put it into comdat.martin
Makes new binutils happy.
2016-05-01Revert previous (fallout is more subtle but there).martin
Rework the conditionon so it depends on .S existence instead of an arch list.
2016-04-30Gcc 5.3 seems to do fine compiling this for sparc64, so exclude itmartin
from the -O1 hack
2016-04-04For the benefit of compilers not using our native C runtime environment,martin
install a "sysident.o" file providing the note identifying NetBSD executables (and marking the currently installed version).
2016-03-29crt0-common.c is miscompiled by gcc 5.3 on evbarm with -O2 so use -O1. Doskrll
this for all non-x86 arches.
2016-03-27add a hack for GCC 5 and non-x86 platforms:mrg
build crtbeginS.o with -O1 as GCC tries to be very smart with the __DTOR_LIST__ as it believes it knows the size of the array at compile time (which is not true until link time). on SPARC and MIPS, the result was emitting a call to 0. technically, i believe that GCC isn't "wrong" to make this choice, as the array is declared with a well-known initialiser size in the crtbegin.c compilation unit, and we have noticed that the libgcc version of this code has some hacks added, most likely to avoid being bitten by this optimisation. this makes sshd work for me on earm and sparc with GCC 5.
2014-05-14Ensure notes are properly padded to 32bit length.joerg
2014-05-06Make EHABI optional.joerg
2014-03-04Add GENASSYM_CPPFLAGS in two more places.joerg
2014-02-26Make the .note section mergable and set proper "item" length.martin
XXX seems to be impossible to do that with gas w/o causing a (bogus) warning - but the resulting object file is fine.
2014-01-29Also make sure the __CTOR_LIST__ is just aligned to a pointer boundary.bouyer
By default, mips N32 will aligned to a 64-bit boundary not 32-bit which causes an extra NULL entry to be added. Fix "segfault on exit" several people have noticed on mips N32, caused by a jr to a NULL address.
2014-01-11Using ${LD} -x screws up BE arm. Use ${OBJCOPY} ${OBJCOPYLIBFLAGS} insteadmatt
so the $a/$t/$d symbols are preserved.
2013-12-11Make sure the __CTOR_LIST__ is just aligned to a pointer boundary.matt
By default, mips N32 will aligned to a 64-bit boundary not 32-bit which causes an extra NULL entry to be added.
2013-11-29Include crtbegin.h first to make it possible to build with the stricterjoerg
attribute consistency checks in clang.
2013-11-17Simplify previous by using CSU_MACHINE_ARCH. Hint from Takeshi Nakayama.martin
2013-11-16We do not want to build the code model markes when creating the 32bitmartin
compat libs for sparc64
2013-11-14On sparc64: create additional "marker" object files, that can be used by themartin
compiler to encode the used code model in binaries.
2013-11-11Explicitly depend on sys/param.h to pick up __NetBSD_Version changes.joerg
2013-09-18Fix previous: use PICFLAGS for crtbeginS.ouwe
Should unbreak sh3 builds. XXX: PICFLAGS is defined in bsd.lib.mk which lib/csu does not use. For now supply a local definition. joerg@, please fix appropriately.
2013-09-12Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is smalljoerg
vs big PIC mode. Retire -DPIC and -DBIGPIC.
2013-09-10MARCH note is conditionalmatt
2013-09-10Add support for a NetBSD MARCH elf note to record the MACHINE_ARCH formatt
which a program was compiled.
2013-08-26MIPS wants a read/write eh_frame.matt
2013-08-19Put the ctors code in .text.startup and dtors code in .text.exitmatt
2013-08-05Alpha needs crtfm.o for USE_COMPILERCRTSTUFF=nomatt
2013-07-18Only supplie -fPIE to crtbegin.c if MKPIC is yes.matt
2013-07-17Use -fPIE for crtbegin.o (instead of -fpie).martin
Fixes linking the firefox js shell. Ok: joerg@
2013-07-05Only install crtbeginS.o, crtbeginT.o and crtendS.o when MKPIC=yes.joerg