public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: Kai Tuschner <tuschner@mathworks.com>
To: Christopher Bahns <chris@bahns.com>
Cc: crossgcc@sourceware.cygnus.com
Subject: Re: Why is my GNU-based m68k program too big?
Date: Fri, 07 Jul 2000 05:50:00 -0000	[thread overview]
Message-ID: <3965D220.C9A20C0D@mathworks.com> (raw)
In-Reply-To: <39659138.CB6F73EF@bahns.com>

Christopher Bahns wrote:

> Hello,
>
> I am converting a program (based on the MC68306) from the Microtec
> Research (MRI) compiler to the GNU compiler. Things in general are going
> pretty well, but I'm having a problem: The size of the code generated by
> GNU is too big to fit in my flash memory, whereas the code generated by
> MRI does fit.
>
> I have 96k of flash available. The MRI-built program uses all but the
> last 2572 bytes, so it is rather close to reaching the limit. However,
> the GNU-built program is 11080 bytes over limit, causing my link to
> fail. The total difference in sizes between the two compilers is 13652
> bytes, or an increase of 14.3% when going from MRI to GNU. These numbers
> just apply to the executable code, which is the ".text" section with
> GNU, and with MRI it is the combination of the "code", "const",
> "literals", "strings", "??INITDATA", and "ioports" sections. The others
> sections are ok, but the general trend seems to be that if two
> corresponding sections are not the same size, the GNU version is always
> bigger. In this particular case it is too big for my program to work.
>
> My configuration: Windows 98SE, Cygnus Cygwin 1.0, binutils-2.9.1
> (patched), gcc-2.95.2, newlib-1.8.2, target=m68k-coff.
>
> I built the compiler myself without modifying the default configuration
> for this target. When building my program I use the "-O2" option, which
> makes the program quite small in comparison to other optimization
> settings ("-O3" is larger, and "-Os" is only slightly smaller). I'm not
> sure whether it's the difference in the sizes of the project's
> functions, or those of the MRI and GNU run-time libraries that are
> linked in. But, I suspect that it's the run-time libraries since the
> project's functions are built from essentially the same source. The
> differences in the compilers may account for a small difference here,
> but I assume that if the source code is identical, that the size of code
> generated by GNU (with level 2 optimizations) should be very near the
> size of code generated by MRI.
>
> So, I'll assume that it's the difference in the implementation of the
> run-time libraries. But, how do I proceed?

You might use the size command to figure out if the gcc is larger than the MRI
compiled version of your function (e.g. >>size my_func.o). This might answer the
question if the standard libraries or your object file is the cause of the over
size.

> Has anyone else had this
> problem, or been at all concerned about the sizes of the executables
> generated by the GNU compiler (particularly for m68k targets)? I think
> I'll try to rebuild the compiler with the "-O2" option and see if that
> makes a difference. Has anyone done this, or have any insight into
> whether the resulting libraries will work, or whether the optimizations
> will make a significant difference?
>
> Thanks a lot for any help. The help that I've gotten here so far has
> been very helpful.
> Chris
>
>   ------------------------------------------------------------------------
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com

      reply	other threads:[~2000-07-07  5:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-07  1:20 Christopher Bahns
2000-07-07  5:50 ` Kai Tuschner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3965D220.C9A20C0D@mathworks.com \
    --to=tuschner@mathworks.com \
    --cc=chris@bahns.com \
    --cc=crossgcc@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).