g77's use of assert and x-compilation
Mumit Khan
khan@xraylith.wisc.edu
Tue Jul 21 22:18:00 GMT 1998
On Tue, 21 Jul 1998, Jeffrey A Law wrote:
>
> In message < 9807210409.AA01661@modi.xraylith.wisc.edu >you write:
> > g77 sources include assert.h, and hence requires __eprintf support in
> > libgcc.a. When cross compiling however, `inhibit_libc' is defined in
> > libgcc2.c which omits _eprintf, causing a problem building f771. Has
> > anyone else run into this, or am I missing something obvious?
> I would think this should only be a problem if you are using a cross
> compiler to build egcs. Is that what you are doing?
>
Yes, I am. Forgot to mention the "little detail" in my email. Sorry.
Basically this is what I do:
1. build a cross-compiler for ix86-*-win32 (various forms of it).
- Here we get a libgcc.a that lacks __eprintf.
2. build a native** compiler for ix86-*-win32 using that cross-compiler.
- Here we get hit due to the lack of __eprintf.
(*) Here native means native compiler built for the target, not for the
host.
The libgcc.a built in step 1, which is used by the cross-compiler in
building executables in step 2, lacks __eprintf due to the inhibit_libc
being defined within libgcc2.c; hence any code that uses GCC's assert.h,
as opposed to system supplied one, will get hit by this.
My solution currently is one of two:
a. use local patches that take out the forced-definition of inhibit_libc
in libgcc2.c. Since my targets come with full set of headers, it's
not an issue. This IMO should only be done for real embedded
targets. I remember way back when this macro was added by Cygnus
top-level configure if target was using newlib.
b. After building the cross-compiler, use that to build *only* the
native* C compiler so that libgcc.a is built; use that to replace
the one built for the cross-compiler in Step 1 and continue on with
the rest of the languages and target libraries.
Regards,
Mumit
More information about the Gcc
mailing list