compiler.
* Undo the diking out of cross compiler logic from gcc.c rev 1.16.
* Add the `CROSS_STARTFILE_PREFIX' knob.
* Add our own definition of `STANDARD_INCLUDE_DIR'. This should have been
included in freebsd-native.h rev 1.5.
The changes from GCC 2.95.3 to 3.1 are large and it is hard to figure
out how to apply our changes. Once BDE can properly test GCC 3.1 he'll
add back in our changes.
Until we can figure out how to reimpliment our custom format warnings
since the FSF developers totally revamped them, and took away the hooks
we were using to accomplish our desires.
Note that the "NO_PROFILE_DATA"/"NO_PROFILE_COUNTERS" bits were added
to the stock FSF GCC 2.97 (and thus 3.1) source as i386 Linux needed them
also. (amazing what can get committed to the FSF GCC when needed by Linux...)
Remove our definition for FUNCTION_PROFILER as it is wrong.
Note that "jsr $28,_mcount" is a macro for
ldq $27, _mcount($29) !literal!1
jsr $28, ($27), _mcount !lituse_jsr!1
1. The call to _mcount is added by alpha_expand_prologue after we load the gp.
Our _mcount uses $27 for the incoming address, unlike OSF/1 and Linux,
which use $28. This probably doesn't matter since we probably don't use $27
within _mcount itself.
2. You can't use this insn with _mcount because it uses the PLT, which clobbers
the return address in $28. Note that the prologue_mcount pattern carefully
avoids adding the lituse_jsr relocation so that we call through the GOT
directly.
Submitted by: Richard Henderson <rth@redhat.com>
When rtld runs the .fini section in a shared lib (C++), the code in
question from .../contrib/gdb/config/alpha/crtbegin.asm first calls
__do_globals_dtors_aux and then __do_frame_takedown. Unfortunately, the
value of gp after a jsr is undefined and in this case had changed from before
the call, probably as a result of calling code in some other shared library.
The normal calling convention for alpha is to re-initialize gp using
'ldgp gp,0(ra)' after a jsr instruction but in this case no such
re-initialization is done. This leads to a bogus value being read for the
address of __do_frame_takedown and a quick segfault.
Submitted by: dfr
Obtained from: GCC 3.0
value, it forces GCC to not optimize above this level. For intance, GCC
made with "WANT_FORCE_OPTIMIZATION_DOWNGRADE=1" is a good setting for the
Alpha platform when building ports.
default options for GCC. These options are interpreted first and can be
overwritten by explicit command line parameters. This provides one way of
adding [temporary] options to your world build w/o editing /etc/make.conf.
If "WANT_DWARF2_UNWIND" you get it. Note that this is a different C++ ABI
than the FreeBSD default. So you will need to recompile all your C++ apps
that uses exceptions if you turn this on. I am adding it here for Yahoo!'s
use and for those that want to be early adopters to what I will make as the
default with the GCC 3.0 import.
that were removed from GCC 2.95.3.test4 and the subsequent release due
to problems on HP-UX. However, they work just fine on all the BSD's.
W/o these patches the following program segmentation faults if compiled
with -O2 (but not -Os or -O or -O0):
#include <stdio.h>
class A {
public:
A() { printf("c'tor A\n"); }
~A(){ printf("d'tor A\n"); }
};
class foo : public A {
public:
foo() { printf("C'tor foo\n"); throw 8; }
~foo() { printf("D'tor foo\n"); }
};
int main(){
try { foo fii; }
catch (int){ printf("catch ...\n"); }
return 0;
}
header to reduce the difference of our sources to the stock GNU/FSF ones.
While the mix binary format support was nice to have in the FreeBSD MI
header as a frame work, it just clutters up too much and makes the FreeBSD
MI header more different from the FSF/GNU stock one than it needs to be.
into the i386 MD FreeBSD header. Also comment tweaking, continuation line
style changes, and other minor changes to make this closer to the latest
FSF/GNU 3.0 sources (to reduce my headache when 3.0 is imported).
linked in addition to libc rather than instead of libc.
Ideally, "-pthread" would now be equivalent to adding "-lc_r" to the
end of the link command. But it is slightly different in this
implementation. Adding "-lc_r" to the link command would produce a
"ld" command line containing this:
... -lc_r /usr/lib/libgcc.a -lc /usr/lib/libgcc.a ...
but this implementation of the "-pthread" option produces this:
... /usr/lib/libgcc.a -lc_r -lc /usr/lib/libgcc.a ...
It would be possible to make them identical, but that doesn't fit
as nicely into GCC's way of doing things. I don't think the ordering
change will make any difference in practice.
This option depended on bits not part of the base system and required
people to install the LinuxThreads port in a manner non-consistent with
the workings of our Ports Collection.
The directions for properly linking with LinuxThreads are given by that
port at install time.
Requested by: jasone
before importing new versions of GCC. This differs from FREEBSD-Xlist
in that this is for use only with anoncvs checkouts, not tarball'ed
releases [snapshots].
This delete list applies to the 3-June-2000 import.
to generate the special .type and .size directives which are used to set
the corresponding fields of the linker symbol table entries in the ELF
object file. As such they are not i386-specific and thus belong in our
MI header. Otherwise on the Alpha we don't properly give the type and
size of dynamic symbols. Bintuil versions past 2.9.1 warn of this and
w/o this change, `ld' generates a lot of warnings during a `make world'.
I did not catch this on the EGCS 1.1.x --> GCC 2.95 upgrade.
So propogate this change to our custom hacks.
PR: 15549
Submitted by: Naohiko Tsuji <yakisoba@osaka.interq.or.jp>
Patrick Bihan-Faou <patrick@mindstep.com>
"The problem is that egcs/gcc-2.95's reorganisation of the prologue and
epilogue code to use rtl instead of output_asm_insn() completely broke our
hooks. rtl is emitted in a different order, only after optimisation, while
output_asm_insn() is emitted immediately. rtl is presumably used so that
the prologue and epilogue can be optimised.
I couldn't find any good examples to copy. gcc's own
FUNCTION_BLOCK_PROFILER still uses output_asm_insn() and seems to be
completely broken. One of the XXX comments points to this.
IIRC, the hacks here basically arrange to emit magic label names; then when
the magic names are output, they are transformed into prologue and epilogue
code."
Submitted by: bde
If one wishes to anchor the compiler toolchain tree somewhere other than /,
all one needs to do is set "TOOLS_PREFIX" to a different rooting.
Submitted by: marcel (in a different format and reworked by me)
of changing the search dirs. This also removes an used search dir,
removes unneeded redundancy, and a bugus dir we enherited on the i386
by baseing off of svr4.h.
We went from:
install: /usr/libexec/(null)
programs: /usr/libexec/<OBJFORMAT>/:/usr/libexec/:/usr/bin/:/usr/libexec/
libraries: /usr/libdata/gcc/:/usr/libexec/:/usr/ccs/lib/:/usr/lib/
to:
install: /usr/libexec/(null)
programs: /usr/libexec/<OBJFORMAT>/:/usr/libexec/
libraries: /usr/libexec/:/usr/lib/
* Don't conditional based on i386, but generalize to all FreeBSD arch's.
* Don't be a.out-centric, but generalize to handle other possible future
formats.
Submitted by: marcel (partial)
* Commonalities with i386, moved to a FreeBSD wide config file.
* Major additions to this file were adapted from Hidetoshi Shimokawa
<simokawa@FreeBSD.ORG>'s Alpha suppliment to the Egcs 1.1.2 port.
As of GCC 2.95 these files from libiberty are absolutely required:
ansidecl.h libiberty.h splay-tree.h splay-tree.c
To keep from having to import all of libiberty, they are imported here
for now. Before all is said and done, libiberty might be imported, or
these files might move elsewhere.
As of GCC 2.95 these files:
choose-temp.c demangle.h getopt.h obstack.c pexecute.c
cplus-dem.c getopt.c getopt1.c obstack.h
were removed from the GCC compilers proper to libiberty. To continue our
revision history, and to keep from having to import all of libiberty,
they are imported here as if they were never moved.
* be consistant on protecting "#define FOO"s with "#undef FOO".
* be consistant that macro params are upper case, and commas are followed
by a space in the macro definition
* protect macro param expansion by ()'s
* break long lines
* line continuations chars to consistant column
* remove trailing spaces
FreeBSD wide config file.
This includes "WORD_SWITCH_TAKES_ARG" & "SWITCH_TAKES_ARG". Platforms
such as FreeBSD/MIPS will need to override these two defintions, but it
can #undef them and define them approapiately.
* 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.