diff options
author | Mathias Krause <mathias.krause@secunet.com> | 2011-01-17 07:50:42 +0000 |
---|---|---|
committer | Mathias Krause <mathias.krause@secunet.com> | 2011-01-17 07:50:42 +0000 |
commit | a60faab83ef86bcf2884311db07cf13f445d7f47 (patch) | |
tree | 9de9787987eb6a3374e18835b196b7ac6cb9ad19 /cli_classic.c | |
parent | 2c3afa34fcfc72abe6b3e0fd034632226fa75522 (diff) | |
download | ast2050-flashrom-a60faab83ef86bcf2884311db07cf13f445d7f47.zip ast2050-flashrom-a60faab83ef86bcf2884311db07cf13f445d7f47.tar.gz |
Convince compilers to put constant data into the .rodata section
This patch reduces the stack usage by declaring 'const' stack variables
as 'static const' so they end up in the .rodata section instead of being
copied from there to the stack for every invocation of the corresponding
function.
As a plus we end up in having a smaller binary as the "copy from .rodata
to stack" code isn't emitted by the compiler any more (roughly -100
bytes).
Corresponding to flashrom svn r1252.
Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Acked-by: Stefan Reinauer <stepan@coreboot.org>
Diffstat (limited to 'cli_classic.c')
-rw-r--r-- | cli_classic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cli_classic.c b/cli_classic.c index 9b9b451..1211989 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -114,8 +114,8 @@ int cli_classic(int argc, char *argv[]) int operation_specified = 0; int i; - const char *optstring = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; - static struct option long_options[] = { + static const char optstring[] = "r:Rw:v:nVEfc:m:l:i:p:Lzh"; + static const struct option long_options[] = { {"read", 1, 0, 'r'}, {"write", 1, 0, 'w'}, {"erase", 0, 0, 'E'}, |