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
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
6ccf4859e4
Add GENASSYM_CPPFLAGS in two more places.
2014-03-04 17:57:56 +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
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
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
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
988e1b8be5
MARCH note is conditional
2013-09-10 17:23:55 +00:00
matt
b4939ef9a5
Add support for a NetBSD MARCH elf note to record the MACHINE_ARCH for
...
which a program was compiled.
2013-09-10 16:45:33 +00:00
matt
704e1f2829
MIPS wants a read/write eh_frame.
2013-08-26 14:20:53 +00:00
matt
c1007461a4
Put the ctors code in .text.startup and dtors code in .text.exit
2013-08-19 22:15:13 +00:00
matt
64e75f2480
Alpha needs crtfm.o for USE_COMPILERCRTSTUFF=no
2013-08-05 13:38:35 +00:00
matt
75eb6b3ee8
Only supplie -fPIE to crtbegin.c if MKPIC is yes.
2013-07-18 18:43:56 +00:00
martin
3f349243f2
Use -fPIE for crtbegin.o (instead of -fpie).
...
Fixes linking the firefox js shell. Ok: joerg@
2013-07-17 14:23:45 +00:00
joerg
c4d240b19a
Only install crtbeginS.o, crtbeginT.o and crtendS.o when MKPIC=yes.
2013-07-05 02:06:49 +00:00
matt
350cb9bc6c
Switch arm, earm, powerpc to use crtbegin.c
...
Use -fpie for crtbegin.
2013-06-27 21:24:39 +00:00
matt
2943b5ff66
Add -fPIC to compile of crtbeginS.o
2013-06-27 03:37:21 +00:00
matt
a4bddaaec2
Reorder to avoid !exists
...
Add a crtbegin.h dependency
2013-06-25 07:18:02 +00:00
matt
21ba1833d3
Make dwarf_eh_object is 8 words long
2013-06-24 14:49:13 +00:00
matt
2ad451b6ca
Add a common crtbegin.c file and use a machine dependent crtbegin.h to
...
fill in .init/.fini.
Add mips support for USE_COMPILERCRTSTUFF=no (compiled only)
2013-06-22 02:37:09 +00:00
matt
6a4f94a035
Allow crtbegin to be a C file.
2013-06-22 02:21:58 +00:00
matt
a9585fd0b1
Add support for PREINIT_ARRAY
2013-01-31 22:24:25 +00:00
matt
b6b60ee9f3
Use __weakref_visible (from joerg@)
2013-01-28 16:56:39 +00:00
matt
710d6a63da
Make with work with gcc 4.5 or clang.
2013-01-28 06:17:57 +00:00
matt
fd98dc9555
Fix static weak (to extern weak)
2013-01-22 22:57:37 +00:00
matt
6de169804e
Add support for init_array/fini_array (conditionalized on HAVE_INITFINI_ARRAY).
...
[This is needed for ARM EABI.]
2012-08-13 02:15:35 +00:00
joerg
0e8643658c
Don't pass assembler flags to genassym, it doesn't compile.
2012-03-25 06:55:19 +00:00
joerg
4cd46b4ac8
Add some more __dead as exposed by the recent WARN bumps.
2012-03-22 22:59:43 +00:00
uwe
5ade3e48ae
Move crt0.S in front of crt0-common.c when building crt0.o and gcrt0.o.
...
Reading disassembly is easier when the asm crt0.S trampoline is at the
start, not hidden behind the C code in crt0-common.c.
2012-01-31 20:08:28 +00:00
uwe
1ecbaba27e
Hmm, funny. I wonder why and how did emacs VC managed to add
...
Warning: Permanently added the RSA host key for IP address '...' to the list of known hosts.
to the committed file. (hi, new cvs!)
2012-01-31 20:03:50 +00:00
uwe
cfdbe19d5f
Use -DPIC to compile crtbeginS.o since that's what <machine/asm.h>
...
headers check.
2012-01-31 19:58:22 +00:00