From ee1923668e008fbe81cd81b3213f81eb097cfccf Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Tue, 10 May 2005 15:10:08 +0000 Subject: [PATCH] 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. --- gas/ChangeLog | 10 ++++++++-- gas/config/tc-hppa.c | 6 ++++++ gas/frags.c | 9 ++++++++- gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/hppa/parse/block1.s | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 41335983f4..86228db6f0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2005-05-10 Michael Matz + + * frags.c (frag_grow): Don't be too greedy in allocating memory. + + * config/tc-hppa.c (pa_block): Check arguments to .block[z]. + 2005-05-10 Hans-Peter Nilsson PR binutils/886 @@ -23,8 +29,8 @@ 2005-05-09 Jan Beulich - * config/tc-i386.c (optimize_disp): Discard displacement entirely when zero and - not required by encoding constraints. + * config/tc-i386.c (optimize_disp): Discard displacement entirely + when zero and not required by encoding constraints. 2005-05-09 H.J. Lu diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 7bac1eac3c..57cc427ccb 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -5951,6 +5951,12 @@ pa_block (z) temp_size = get_absolute_expression (); + if (temp_size > 0x3FFFFFFF) + { + as_bad (_("Argument to .BLOCK/.BLOCKZ must be between 0 and 0x3fffffff")); + temp_size = 0; + } + /* Always fill with zeros, that's what the HP assembler does. */ temp_fill = 0; diff --git a/gas/frags.c b/gas/frags.c index 21fe26287d..6dae8bc9c2 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) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 1a162c61c6..d2210458f0 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-05-10 Michael Matz + + * gas/hppa/parse/block1.s: Use official limit (0x3fffffff) for + .block. + 2005-05-10 Hans-Peter Nilsson * gas/mmix/relax2.s: Drop ":" off label definitions. diff --git a/gas/testsuite/gas/hppa/parse/block1.s b/gas/testsuite/gas/hppa/parse/block1.s index 4f12ab5895..a3ddafe3c5 100644 --- a/gas/testsuite/gas/hppa/parse/block1.s +++ b/gas/testsuite/gas/hppa/parse/block1.s @@ -4,7 +4,7 @@ foo: .block bar: - .block 0x7fffffff + .block 0x3fffffff com: -- 2.34.1