aboutsummaryrefslogtreecommitdiff
path: root/gas/frags.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2005-05-10 15:10:08 +0000
committerMichael Matz <matz@suse.de>2005-05-10 15:10:08 +0000
commitee1923668e008fbe81cd81b3213f81eb097cfccf (patch)
treed3f196451c3374ac19e8ff3b0b1e578152c97558 /gas/frags.c
parentb0ded00b3ffade930e4617b01d5c8241e3f404da (diff)
downloadfsf-binutils-gdb-ee1923668e008fbe81cd81b3213f81eb097cfccf.zip
fsf-binutils-gdb-ee1923668e008fbe81cd81b3213f81eb097cfccf.tar.gz
fsf-binutils-gdb-ee1923668e008fbe81cd81b3213f81eb097cfccf.tar.bz2
gas/
* frags.c (frag_grow): Don't be too greedy in allocating memory. * config/tc-hppa.c (pa_block): Check arguments to .block[z]. gas/testsuite/ * gas/hppa/parse/block1.s: Use official limit (0x3fffffff) for .block.
Diffstat (limited to 'gas/frags.c')
-rw-r--r--gas/frags.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gas/frags.c b/gas/frags.c
index 21fe262..6dae8bc 100644
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -91,7 +91,14 @@ frag_grow (unsigned int nchars)
frag_wane (frag_now);
frag_new (0);
oldc = frchain_now->frch_obstack.chunk_size;
- frchain_now->frch_obstack.chunk_size = 2 * nchars + SIZEOF_STRUCT_FRAG;
+ /* Try to allocate a bit more than needed right now. But don't do
+ this if we would waste too much memory. Especially necessary
+ for extremely big (like 2GB initialized) frags. */
+ if (nchars < 0x10000)
+ frchain_now->frch_obstack.chunk_size = 2 * nchars;
+ else
+ frchain_now->frch_obstack.chunk_size = nchars + 0x10000;
+ frchain_now->frch_obstack.chunk_size += SIZEOF_STRUCT_FRAG;
if (frchain_now->frch_obstack.chunk_size > 0)
while ((n = obstack_room (&frchain_now->frch_obstack)) < nchars
&& (unsigned long) frchain_now->frch_obstack.chunk_size > nchars)