Commit Graph

32 Commits

Author SHA1 Message Date
Dimitry Andric
9ef4e3afcb Apply a workaround for a binutils issue with the .note.ABI-tag section
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
2011-01-13 20:44:31 +00:00
Tijl Coosemans
b0032ab5f8 Add a .note.ABI-tag section to ia64 startup files by linking crtbrand.c
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)
2010-12-10 08:53:06 +00:00
Dimitry Andric
cbbcfbf8b7 Let all .c and .S files under lib/csu consistently use the __FBSDID()
macro for identification, instead of several different hand-rolled
variants (plain .ident, .ascii, etc).
2010-12-09 21:31:21 +00:00
Dimitry Andric
73438aeedc Remove two .endp's without matching .proc in lib/csu/ia64/crtn.S.
This allows it to assemble with newer binutils.

Reviewed by:	marcel
2010-10-15 21:40:20 +00:00
Ulrich Spörlein
03dab16e1d Use default WARNS setting (of 6) for lib/csu.
PR:		bin/140089
Reviewed by:	jmallett
Approved by:	ed (co-mentor)
2010-03-05 13:29:05 +00:00
Konstantin Belousov
c09ba32715 Properly support -fPIE by linking PIE binaries with specially-built
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
2009-12-02 16:34:20 +00:00
Marcel Moolenaar
e8e41d4cf8 Bring ia64 back from the dead. After a call one needs to restore the
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@
2004-08-18 23:06:47 +00:00
Doug Rabson
ccd13c49b5 Add support for TLS in statically linked programs. 2004-08-15 16:18:52 +00:00
Marcel Moolenaar
29cc06cf27 Fix typo: Passing the first argument to exit() in out2 does not work.
Trust me.
2003-07-15 03:50:38 +00:00
Marcel Moolenaar
68d0d87b81 _start() needed to be written in assembly. See crt1.S. 2003-07-14 03:05:42 +00:00
Marcel Moolenaar
db7ffe67c6 Rewite _start(). We cannot use a C function due to the fact that we
don't call it according to the runtime specification and especially
WRT to gp this can cause trouble. The gcc 3.3.1 import broke the
ia64 runtime because the compiler saved gp prior to us being able
to set it properly. Restoring gp after the calls would then invalidate
gp and cause segmentation faults later on.
By rewriting _start() as an assembly function, we also avoided even
more gcc dependences, by trying to use gcc specific features to work
around the problem.
This version of _start() does not reference _DYNAMIC. We register the
cleanup function when it's a non-NULL pointer. The kernel will always
pass a NULL pointer and dynamic linkers may pass a non-NULL pointer.

The machine independent code to set __progname now unfortunately is
written in assembly. So be it.
2003-07-13 23:11:37 +00:00
Mark Murray
818c8b696b make these more useful for lint(1). Minor diff-reductions while I'm
about it.
2003-01-26 23:14:47 +00:00
Ruslan Ermilov
d2893b161b Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by:	bde
2002-07-29 09:40:17 +00:00
Mark Murray
828191256b The main reason for this is to reduce diffs between all the crt1.c's.
Assembler macros are tidied up and made as similar as sanely possible.
The macros are translated into C (__inline static) functions for lint.

Declaration orders are made the same.
Declarations are all ISOfied and tidied up.

Comment contents have gratuitous diffs removed.

The net result is a bunch of crt1.c's that are 90% the same.
It may be possible to now encapsulate the differences in one
MD header, and have only one MI crt1.c file (although the macros
to do this may be ugly).

Helpful comments by:	obrien, bde
Alpha tested by:	des
i386-elf tested by:	markm
2002-07-16 12:28:50 +00:00
Ruslan Ermilov
2020063860 Fixed CLEANFILES after bsd.lib.mk sweep. 2002-05-13 15:28:00 +00:00
Ruslan Ermilov
7893b524b9 SOBJS are not used here for a long time, and were just
pessimising the `install'.
2002-05-13 11:51:11 +00:00
Ruslan Ermilov
2a53f3fb35 Major cleanup of bsd.lib.mk.
Get rid of the INTERNALSTATICLIB knob and just use plain INTERNALLIB.
INTERNALLIB now means to build static library only and don't install
anything.  Added a NOINSTALLLIB knob for libpam/modules.  To not
build any library at all, just do not set LIB.
2002-05-13 10:53:24 +00:00
Ruslan Ermilov
5b8f41af39 Revert the last change. The corresponding bsd.lib.mk changes were
already backed out.
2002-05-12 16:21:23 +00:00
David E. O'Brien
785b36d40f Use the simpler NOMAN rather than NOMAN, NOPIC, NOPROFILE, INTERNALLIB. 2002-05-11 17:45:03 +00:00
Mark Murray
4cd0119367 Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
David E. O'Brien
327e1e773f Style nit. 2002-03-23 18:14:20 +00:00
Peter Wemm
4250f47ada Put in an attempt at stack trace/unwind records. 2001-11-03 06:31:27 +00:00
Peter Wemm
b3cd898e58 Mostly cosmetic. Use indentation that is reasonably close to other
ia64 *.S files in our tree (eg: locore.s).  Put the rest of the args
in the .section lines.

Reviewed by:	dfr
2001-10-29 10:18:58 +00:00
Peter Wemm
16ef3f735a Update for the new toolchain. ld doesn't provide _GLOBAL_OFFSET_TABLE_
in 2.11.2, so use a relocatable method of calculating gp.

Reviewed by:	dfr
2001-10-29 10:14:51 +00:00
Peter Wemm
c91cd68318 Add missing crti.S and crtn.S files. I have tested these with -static
linking only.  They may require some gp relative tweaks for dynamic use.
2001-10-27 10:10:45 +00:00
David E. O'Brien
255cdd9376 Update for reality and syncing with other FreeBSD platforms. 2001-10-27 08:29:03 +00:00
Doug Rabson
3749c9e54d Change to track the new calling convention for execve. This version only
needs one line of assembler to initialise gp.
2001-10-11 12:33:05 +00:00
Doug Rabson
d2cb5f3137 Make sure stack is aligned to 16 bytes. 2001-08-21 16:53:23 +00:00
David E. O'Brien
ae7c8a2bb8 * Bring back the guts of crt{i,n}.S. This allows C++ exceptions to work
when using the egcs and gcc-devel ports, along with GCC built from stock
public FSF sources.  With out this change, FreeBSD will be removed from
the list of systems GCC 3.0 must be evaluated on before release.  With
the effort some of us put into getting FreeBSD on this list, we should
not turn this effort into a waste, else we might not be worth fighting
for in the future.  (note that Alpha and IA-64 versions of crt{i,n}.S
are needed)

* Switch from our own crt{begin,in} to those created from GCC's crtstuff.c.
This will allow us to switch to DWARF2 exceptions in the future, along with
staying in sync with any future GCC requirements.

* Break out our ELF branding bits into a seperate file.  Currently this
is now included by our crt1.c files (since this functionality was part of
our native crtbegin.c).  Later crtbrand.o will be merged in the creation
of crti.o.
2000-10-28 21:26:48 +00:00
Doug Rabson
ac5096139b CSU code for ia64. 2000-10-14 16:38:08 +00:00
David E. O'Brien
a62f273fbe Use the new machine-independent versions of crtbegin and crtend
from the "common" directory.
2000-05-24 02:17:12 +00:00
David E. O'Brien
d7ff52ec79 CSU source for IA-64. Current we use the ../Alpha sources. 2000-04-19 23:46:21 +00:00