Commit Graph

634 Commits

Author SHA1 Message Date
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
matt a877c70108 Add powerpc64 support 2014-02-27 16:47:48 +00:00
uwe c83f85c76a G/c old unused sh3 csu. Requested by joerg@ 2014-02-27 02:14:27 +00:00
martin fb526759de Make the .note section mergable and set proper "item" length.
XXX seems to be impossible to do that with gas w/o causing a (bogus)
warning - but the resulting object file is fine.
2014-02-26 14:54:50 +00:00
martin 0493f8e382 sparc and sparc64 have moved to new world order, remove legacy files. 2014-02-01 11:59:00 +00:00
matt 9b9fc687ef Remove old compiler based crt stuff for alpha mips powerpc and vax 2014-01-31 11:58:33 +00:00
bouyer 0a181232be Also make sure the __CTOR_LIST__ is just aligned to a pointer boundary.
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-29 20:57:49 +00:00
matt 383316f200 Using ${LD} -x screws up BE arm. Use ${OBJCOPY} ${OBJCOPYLIBFLAGS} instead
so the $a/$t/$d symbols are preserved.
2014-01-11 00:18:15 +00:00
joerg d26da565f7 Drop .fpu. Discussed with Matt. 2013-12-20 15:35:48 +00:00
matt 7118e2b334 Make sure the __CTOR_LIST__ is just aligned to a pointer boundary.
By default, mips N32 will aligned to a 64-bit boundary not 32-bit
which causes an extra NULL entry to be added.
2013-12-11 06:55:24 +00:00
matt 36a2626fcd Make sure t9 ($25) is properly set before calling ___start 2013-12-08 06:32:36 +00:00
joerg cd32ef253c Include crtbegin.h first to make it possible to build with the stricter
attribute consistency checks in clang.
2013-11-29 23:00:48 +00:00
martin 44525f39e0 Simplify previous by using CSU_MACHINE_ARCH. Hint from Takeshi Nakayama. 2013-11-17 11:16:09 +00:00
martin 3fb362f863 We do not want to build the code model markes when creating the 32bit
compat libs for sparc64
2013-11-16 10:50:43 +00:00
martin 591a8c0745 On sparc64: create additional "marker" object files, that can be used by the
compiler to encode the used code model in binaries.
2013-11-14 12:19:34 +00:00
joerg f0495d06b6 Explicitly depend on sys/param.h to pick up __NetBSD_Version changes. 2013-11-11 10:24:27 +00:00
uwe f09e72233a Fix previous: use PICFLAGS for crtbeginS.o
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-18 22:53:39 +00:00
joerg 4d12bfcd15 Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
2013-09-12 15:36:14 +00:00
matt 26dbb44c7a Define ELF_NOTE_MARCH_DESC for when running non-eabi in compat_netbsd32 2013-09-10 22:00:01 +00:00