* In the absence of the env vars TMPDIR, TMP, TEMP (which override this
ordering), attempt to create temperary files in /tmp, P_tmpdir (/var/tmp),
/usr/tmp, and . until successful.
* Support for our dual ELF/a.out building ability
* Our custom ASM_* definitions
* Our custom debugger and profiling related definitions
* Our custom STARTFILE/ENDFILE specs
* The stock EGCS 1.1.2 freebsd-elf.h file depended on
egcs-1.1.2/gcc/config/linux.h, which included "svr4.h". We will
include "svr4.h" via our "tm.h" definition. So add the few bits
from "linux.h" we actually needed.
* Using our current crtbegin.o/crtend.o we cannot support the DWARF2
unwinding mechanisms. In the future we will switch to the
non-sjlj-exceptions type exception machanism. However the `make world'
bootstrap problems with the EGCS crtstuff.c must be overcome first.
* Our a.out gas doesn't "know" to use NOP's for aligns while in the text
section. Thus the a.out alignment generation needed tweaking from
what we did with GCC 2.7.2. [from BDE]
* The definition of SUPPORTS_ONE_ONLY prevents the compiler from trying
to use "linkonce" sections for a.out. The definition of
NO_DBX_FUNCTION_END we had causes it to avoid .stabs symbols that the
assembler cannot handle for a.out. [from JDP]
* The previous "EXCEPTION_SECTION_FUNCTION" is the wrong name for EGCS.
It also needed tweaking for EGCS. [from JDP]
Also bump __FreeBSD_cc_version to 400002 in case we need to know we are
using EGCS at some point.
Don't exclude directories that the linker is "known" to search (/lib
and /usr/lib) when deciding whether to pass certain paths to the
linker. Under FreeBSD, the linker is actually known to never search
/lib and to only search /usr/lib in the elf case. Not passing the
paths causes at best causes confusing differences for cross compiling.
This change is conditional on FREEBSD_NATIVE but should be absolute.
Also return "1" rather than "-1". According to bde: -1 is unrepresentable.
Exit statuses must be >= 0 and <= 255, at least if chars are 8 bits and
shorts are 16 bits. This seems to only be documented indirectly in exit.2
by referring to wait.2. WEXITSTATUS() throws away all except the low 8 bits
of the status returned by _exit(), and the kernel actually only stores 8
bits of it (if chars are 8 bits, etc.), so wait() can't return any more bits.
Obtained from: rev 1.4 of contrib/gcc/gcc.c
if compiling with -fformat-extensions). Gcc's format checker never
actually supported %q length specifiers. It treats %q as an alias
for %ll, which is correct if quad_t is long long (e.g., on i386's)
and broken otherwise (e.g., on alphas).
quad_t's currently should be printed in the same way that they
already need to be printed to avoid compiler warnings on all
supported systems: cast them to a standard type that is at least
as large (long or long long) and use the length specifier for that
(%l or %ll). This is problematic since long long isn't standard
yet. C9x's intmax_t should be implemented soon.
Don't accept %L length specifiers in the kernel either. The only
legitimate ones are for long doubles, but the kernel doesn't even
support plain doubles. (gcc bogusly accepts %Ld as an alias for
%lld, and it sometimes prints "q" in error messages about "ll" and
"L" length specifiers, becauses it represents all these specifiers
as 'q'.)
Submitted by: bde
- plain %r and %z were disallowed. The hard NULs in the warnings were
hopefully caused by disallowing of plain formats being nonsense.
- new formats for shortening to a byte were allowed, but even the libc
printf doesn't support them.
- old %hr and %hz formats were allowed, but the kernel printf doesn't
support them. The kernel doesn't support %hd either, but this is
harder to fix.
Submitted by: bde
* Consistantly put spaces after "," in macro param lists
* Consistantly align continuation characters.
* Don't need to supply all variations of __FOO__ in CPP_PREDEFINES,
gcc will do that for us.
Our malloc can allocte pagesized blocks efficiently and the EGCS default size
of 4072 bytes is not optimal.
Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
in libstdc++.
Until I have a chance to look at what that problem is and to carefully consider
the upgrade issues of turning it back on at a later date if we leave it turned
off for any extended peroid of time.
While I have yet to hear of any problems with us using thunks. The EGCS
mailing list notes some have problems with it and not using them are a
safer default. People wanting to use them, can set the appropiate
compiler flag.
* Turn on DEFAULT_VTABLE_THUNKS. (it is the default anyway, I'm just being
explicit about it, in case it causes us trouble it might be easier for
someone to notice it this way)
with a numeric value that describes the feature level of the
compiler. This can be used to check for the presence/absence of
FreeBSD-specific compiler features. The value is a decimal number
whose digits have the form VRRRRFF, where:
V = Compiler vendor. 0 (elided) means gcc.
RRRR = Vendor's version number, e.g., 2721 for the current
gcc version (2.7.2.1).
FF = FreeBSD-specific revision level. 00 means the stock
compiler from the vendor.
The value of "__FreeBSD_cc_version" is hard-coded in
"src/contrib/gcc/config/i386/freebsd.h" and must be incremented
when new FreeBSD-specific compiler features are added. I considered
simply picking up the value of FreeBSD_version from <osreldate.h>.
But that would break cross compiles of gcc.
PR: Part of the fix for gnu/8452
Suggested by: bde
the executable file, so it will work for both a.out and ELF format
files. I have split the object format specific code into separate
source files. It's cleaner than it was before, but it's still
pretty crufty.
Don't cheat on your make world for this update. A lot of things
have to be rebuilt for it to work, including the compiler and all
of the profiled libraries.
This is enabled by the undocumented option -fformat-extensions.
This option should be named better and/or give more control over
the extensions.
Fixed a message - don't warn about the field width when it's the
precision that has the wrong type. Didn't fix excessive checking
for the precision relative to the type - ANSI requires both to be
ints, but gcc permits the field width to be either int or unsigned
int.
attribute. It is like the existing "printf" archetype, except that
it doesn't complain if the format string is a null pointer. See
the node "Function Attributes" in the GCC info pages if you don't
know what this is all about.
This change will allow us to add format string checking for the
err(3) family of functions.
aout and elf support. freebsd-elf.h died as a result, so the BINFORMAT
test for elf in src/gnu/usr.bin/cc/cc_tool/Makefile will need to
use freebsd.h, not freebsd-elf.h. That means that alpha will have to
go the same way. The new alpha/freebsd.h has the alpha/freebsd-elf.h
definitions merged in.
i386-elf because that is what will be used for FreeBSD/Alpha.
Change the STARTFILE_SPEC to match the non-aout version of i386 so
that the csu files can be built in exactly the same way as i386-elf.
This means that FreeBSD/Alpha departs from NetBSD/Alpha which uses
crt0 and crtbegin/crtend. Since i386-aout uses crt0, I guess it was
decided that i386-elf should use crt1. i386-elf also references
crti and with this change, so does FreeBAS/Alpha.
I think it is important for FreeBSD to have a consistent implementation
across architectures and since ELF is quite compatible (ignoring
differences in 32 and 64 bits), gcc might as well be configured the
same.
Another change is that the entry symbol is _start, not __start as
in NetBSD.
a.out gas and the binutils gas (elf or a.out) with a single compiler.
This uses other infrastructure not yet committed, in order to support
both a.out and elf it needs to be able to get to both a.out and elf
gas, ld, libs, crt* etc. So for now, the support is pretty much dormant.
The new freebsd.h file is based on the old freebsd-elf.h file (which has a
long lineage, right back through linux and svr4 files). The change is
pretty dramatic from a gcc internals standpoint as it overrides a lot of
definitions in order to generate different output based on target mode.
There is potential for screw-ups, so please be on the lookout - gcc's
configuration mechanism wasn't really meant for this kind of thing.
It's believed to compile world etc just fine under both a.out and elf, can
handle global constructors and destructors, handles the differences in
a.out and elf stabs, and what sections things like exceptions go in.
The initial idea came from i386/osfrose.h which is a dual rose/elf format
target. These two are not as diverse as a.out and elf it would seem.
The cc front-end uses external configuration to determine default object
format (still being thrashed out, so read the source if you want to see
it so far), and has a '-aout' and '-elf' override command line switch.
There are some other internal switches that can be accessed, namely -maout,
-mno-aout, -munderscores and -mnounderscores. The underscore and local
symbol prefixing rules are controllable seperately to the output format.
(ie: it's possible to generate a.out without the _ prefixes on symbols and
also to generate elf with the _ prefixes. This isn't quite optimal, but
does seem to work pretty well, except the linkers don't always recognise
the local symbols without their normal names)
The default format is a.out (still), nobody should see any major changes.
With both elf and a.out tools and libraries installed:
[1:26pm]/tmp-223> cc -elf -o hello hello.c
peter@beast[1:27pm]/tmp-224> file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, not stripped
[1:27pm]/tmp-225> ./hello
hello world!
[1:27pm]/tmp-226> cc -aout -o hello hello.c
[1:27pm]/tmp-227> file hello
hello: FreeBSD/i386 compact demand paged dynamically linked executable not stripped
1:27pm]/tmp-228> ./hello
hello world!
Since my co-conspirators put a lot of effort into this too, I'll add them
so they can share the blame^H^H^H^H^Hglory. :-)
Reviewed by: sos, jdp
See freebsd.h and freebsd-elf.h for the silly comment that cgd@netbsd.org
wanted me to add about his claim that uncommented source files that
have been publicly available for ftp for nearly a year; that are
configuration patches to a GPL'ed program; are owned by his previous
employer who refuses to release them. Well... I did as he said. As if
that makes a difference!
At this point we've got cpp, gcc, g++ ported to FreeBSD/Alpha so all
the code that uses __FreeBSD__ is correctly pre-processed. Yay.
I'll commit the bootstrap makefile next to let others play, then on
to libc.
it can be built via BINFORMAT=elf in the environment. Most likely
some of the directory defines such as STANDARD_EXEC_PREFIX will
change again soon, as we settle on the proper locations for the
various components.
Note, the build still fails when it tries to compile libgcc2.c
using the ELF compiler, unless arrangements have been made for the
compiler to find the ELF assembler instead of the a.out assembler.
"-pg" and gprof(1) instead. FreeBSD does not support plain "-p" or
prof(1).
Plain "-p" is still allowed when just compiling. In the compile
phase, "-p" is identical "-pg". It is used by <bsd.lib.mk> for
building profiled object files.
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
Without this, compiled programs die with FP errors.
This is originally credited to: jlemon@netcom.com (Jonathan Lemon), and
has been forwarded to me by quite a few of people.
The symptom was an assembler warning
"GOT relocation burb: `___EXCEPTION_TABLE__' should be global"
followed (sometimes) by a core dump. The fix makes the compiler
generate the correct GOTOFF addressing for that symbol, rather than the
GOT addressing it was emitting before.
Warning: There is still at least one serious bug in the i386 exception
code for PIC. The exception code that is generated clobbers the GOT
register (%ebx) and then tries to use it later. That leads to core
dumps at program execution time. I know where the problem is, but I do
not have a fix for it at this time. Until it is fixed, exceptions will
not work in PIC code. This is a general problem for all i386 platforms;
it is not specific to FreeBSD.
since we don't have it yet and I've taken too long on the libg++-2.7.2
stuff (it causes problems due to to the lack of .weak support which I've
nearly finished)
Submitted by: "Ph. Charnier" <charnier@xp11.frmug.org>
non-i386, non-unix, and generatable files have been trimmed, but can easily
be added in later if needed.
gcc-2.7.2.1 will follow shortly, it's a very small delta to this and it's
handy to have both available for reference for such little cost.
The freebsd-specific changes will then be committed, and once the dust has
settled, the bmakefiles will be committed to use this code.