Commit Graph

652 Commits

Author SHA1 Message Date
scole 5b44457805 add stop (;;) to elimate WAW dependency compiler warning 2019-05-04 22:55:32 +00:00
maya 634157f9e8 Update comment (copied from or1k) 2019-02-10 07:28:06 +00:00
dholland ad8aa774f5 fix duplicated chunk from merge 2019-01-27 04:33:29 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
christos 7a3b8449d8 Re-do previous (always make available preinit/initarray/finiarray), with
less disruption.
2018-12-28 20:12:35 +00:00
christos 12faa81882 Undo previous; breaks macppc/m68k (at least) 2018-12-28 18:17:10 +00:00
christos 96e2e1e315 Avoid duplicate definitions on arm (reported by kre@) 2018-12-28 13:53:17 +00:00
christos 7848d457d8 Allow both array and non-array constructors for transition. 2018-12-27 19:32:32 +00:00
christos 312d62b9b5 Enable initfini array support for everyone. 2018-12-27 18:57:14 +00:00
joerg 463db15fc5 Do not pass the main object handle from the assembler startup stub to
the common ___start routine. It's only used for a pointless magic
version check. Thanks to martin@ for testing various architectures.
2018-11-26 17:37:44 +00:00
kamil 1ec5b47878 Specify NOLIBCSANITIZER in lib/csu
The low-level libraries in csu are used in non-sanitized code.
2018-07-26 01:25:23 +00:00
kre 96ef5eaedd i386/amd64 build fix. Fix "possibly used uninitialized" from gcc.
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-13 01:00:17 +00:00
joerg 26c47810f2 Add static PIE support for i386 and AMD64.
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 21:36:45 +00:00
joerg c0d91a1260 _DYNAMIC is present for static PIE as well, so loosen rtld check. 2018-07-12 21:35:12 +00:00
kamil bef3ed2e02 Disable MKSANITIZER in lib/csu
These low-level libraries are expected to be not touched by a sanitizer.
Every libc program not using sanitizers cannot work with sanitized csu.
2018-06-16 18:58:00 +00:00
joerg 2d65afd272 Move the complex logic for dynamically writing branches from ld.elf_so
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-29 13:23:39 +00:00
joerg a64ef2fb9e Add ifunc support for statically linked applications on x86, ppc, sparc
and ARM.
2018-03-09 20:20:47 +00:00
joerg b373b9e517 .eh_frame should be read-only on MIPS too. 2017-07-18 14:34:19 +00:00
christos 9d493e3dc8 remove useless include; asm.h is not useful for c files. our current assumption
is that stuff in cdefs.h is duplicated in asm.h.
2017-01-14 15:50:24 +00:00
uwe 2bd409d71f ___start is __dso_hidden, so use CALL_DATUM_LOCAL and drop the PIC
prologue from __start.
2016-08-29 21:27:03 +00:00
christos a0c7fda095 fix pic code; otherwise we generate text relocations. 2016-08-28 13:50:25 +00:00
joerg b16a977791 For some mind-boogling reasons, GCC 5.4 believes that a weak reference
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-29 11:16:47 +00:00
joerg 6da05bfa8e Fun fact of the weak: a weak reference doesn't have visibility attached.
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-07 12:07:35 +00:00
joerg 70b825c3b6 Make older GCC and Clang happy and use weak references to the elements,
not declared as arrays.
2016-06-05 00:43:39 +00:00
joerg b940261f81 Revert -O1 hack for GCC 5.3, replaced by workaround in the code. 2016-06-01 21:24:55 +00:00
joerg ad68895fdb PR toolchain/51121:
__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-06-01 21:21:55 +00:00
martin f5d70023d1 We need the -O1 hack (for gcc 5.3) for crtbegin.c as well.
Works around PR toolchain/51121.
2016-05-10 10:23:09 +00:00
martin 8e6585046e Change section flags to "MG" and put it into comdat.
Makes new binutils happy.
2016-05-01 08:33:14 +00:00
martin 92f3e401cd Revert previous (fallout is more subtle but there).
Rework the conditionon so it depends on .S existence instead of an arch
list.
2016-05-01 07:25:46 +00:00
martin 318ac55504 Gcc 5.3 seems to do fine compiling this for sparc64, so exclude it
from the -O1 hack
2016-04-30 13:12:13 +00:00
martin 53a4b022d2 For the benefit of compilers not using our native C runtime environment,
install a "sysident.o" file providing the note identifying NetBSD
executables (and marking the currently installed version).
2016-04-04 18:29:07 +00:00
skrll e4a98f388f crt0-common.c is miscompiled by gcc 5.3 on evbarm with -O2 so use -O1. Do
this for all non-x86 arches.
2016-03-29 21:23:05 +00:00
mrg 09a7b9833f add a hack for GCC 5 and non-x86 platforms:
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.
2016-03-27 00:03:06 +00:00
christos e2d23afe0f Undo previous; the lossage is more basic. 2016-01-24 16:47:32 +00:00
christos 470f85c6c7 Alpha needs _KERNTYPES 2016-01-24 16:27:38 +00:00
matt 44371503dd Make sure .init and .fini are word (4byte) aligned. 2015-05-01 21:35:56 +00:00
matt 6cf6fe02a9 New files for Userland support of UCB RISC-V (both 32-bit and 64-bit) 2014-09-19 17:36:24 +00:00
matt 27620987b8 New files for OR1K support 2014-09-03 19:34:25 +00:00
matt 11614bb2b2 MKCOMPAT fixes for when compat MACHINE_CPU != normal MACHINE_CPU 2014-08-10 23:25:49 +00:00
matt beb9c6d1b5 Preliminary files for AARCH64 (64-bit ARM) support.
Enough for a distribution build.
2014-08-10 05:47:35 +00:00
joerg 88fc449bba Ensure notes are properly padded to 32bit length. 2014-05-14 14:59:14 +00:00
joerg 353aedd819 Make EHABI optional. 2014-05-06 16:02:10 +00:00
joerg 61731496eb Retire USE_COMPILERCRTSTUFF=yes. 2014-04-22 13:20:58 +00:00
joerg 39f1409e2e __do_global_ctors_aux and __do_global_ctors_aux must be used locally, so
mark them as hidden.
2014-03-16 11:41:30 +00:00
cherry 27f396ba32 Add crtstuff for ia64. Compile tested only 2014-03-14 18:15:02 +00:00
matt 2a0cd0801f these are obsolete. Now using the common powerpc files in csu/arch/powerpc. 2014-03-07 07:23:49 +00:00
matt f99069ca40 Use _XENTRY 2014-03-06 19:05:59 +00:00
joerg 6ccf4859e4 Add GENASSYM_CPPFLAGS in two more places. 2014-03-04 17:57:56 +00:00
matt 22332fd4bf Use _ENTRY 2014-02-27 18:11:08 +00:00
matt 96ed0d69f5 Use the CALL() macro. 2014-02-27 18:01:51 +00:00