This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Get rid of Java .jcr section when not using Java
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Johannes Bauer <dfnsonfsduifb at gmx dot de>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Tue, 25 Apr 2017 20:22:42 +0100
- Subject: Re: Get rid of Java .jcr section when not using Java
- Authentication-results: sourceware.org; auth=none
- References: <1a6ea1ca-22cc-07aa-2f77-4ba742a08a02@gmx.de>
On 25 April 2017 at 20:04, Johannes Bauer wrote:
> Hi there,
>
> I'm using gcc-6.3.0 with the arm-non-eabi target and cross compile for
> ARM Cortex-M4. I've just traced an annoyingly elusive issue which
> ultimately turned out to be caused by a .jcr section that originates
> from gccs CRT. Note that I'm compiling bare metal Cortex-M, so I'm a
> million miles away from anything Javaish. There should not be a
> Java-related section consuming RAM on my microcontroller, in my opinion.
>
> When I turn on section garbage collection, it goes away (never
> referenced, obviously) but in this particular instance, I cannot turn on
> section GC. When I try to discard the section via my linker script, I
> get complaints:
>
> `.jcr' referenced in section `.text' of
> /home/joe/bin/gcc-cm4/lib/gcc/arm-none-eabi/6.3.0/crtbegin.o: defined in
> discarded section `.jcr' of
> /home/joe/bin/gcc-cm4/lib/gcc/arm-none-eabi/6.3.0/crtbegin.o
> collect2: error: ld returned 1 exit status
>
> I'm not the first to encounter this issue, but it doesn't seem to cause
> a problem for most people. E.g., I've found this here:
>
> https://gcc.gnu.org/ml/gcc-patches/2013-10/msg00654.html
>
> But it doesn't really apply to fixing this.
Why not?
> Since I do bake my own gcc flavor, I would also be happy with a solution
> that'd involve patching around gcc guts, but I'm just too clueless to
> know what to touch there.
Doesn't the patch show what to change? #undef JCR_SECTION_NAME in
libgcc/crtstuff.c (although it looks like the macro has been renamed
to __LIBGCC_JCR_SECTION_NAME__).