Hi all:

In arm-*-elf target some variable will missing size directive,

for example:

foo.c:

void foo (void) {
  static char bufbuf[8];
}

$ arm-none-eabi-gcc ./foo.c  -S -o -

...
.align 2
bufbuf.4078:
.space 8
...
.ident "GCC: (GNU) 5.0.0 20140828 (experimental)"


And then the size info will missing:

$ arm-none-eabi-objdump ./foo.o  -t

./foo.o:     file format elf32-littlearm

SYMBOL TABLE:
00000000 l    df *ABS* 00000000 zoo.c
00000000 l    d  .text 00000000 .text
00000000 l    d  .data 00000000 .data
00000000 l    d  .bss 00000000 .bss
00000000 l       .bss 00000008 bufbuf.4078
00000000 l    d  .comment 00000000 .comment
00000000 l    d  .ARM.attributes 00000000 .ARM.attributes
00000000 g     F .text 00000018 foo


ChangeLog

2014-09-01  Kito Cheng  <k...@0xlab.org>

        * config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL):
Add size directive.
From e0034653a4d457708fc4d858ea20fab70a42d798 Mon Sep 17 00:00:00 2001
From: Kito Cheng <kito.ch...@gmail.com>
Date: Mon, 1 Sep 2014 11:19:13 +0800
Subject: [PATCH] Add missing size directive for arm-elf

ChangeLog

2014-09-01  Kito Cheng  <k...@0xlab.org>

	* config/arm/unknown-elf.h (ASM_OUTPUT_ALIGNED_DECL_LOCAL): Add size directive.
---
 gcc/config/arm/unknown-elf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h
index 56aa166..b4d1757 100644
--- a/gcc/config/arm/unknown-elf.h
+++ b/gcc/config/arm/unknown-elf.h
@@ -81,6 +81,7 @@
       ASM_OUTPUT_ALIGN (FILE, floor_log2 (ALIGN / BITS_PER_UNIT));	\
       ASM_OUTPUT_LABEL (FILE, NAME);					\
       fprintf (FILE, "\t.space\t%d\n", SIZE ? (int)(SIZE) : 1);		\
+      ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE);			\
     }									\
   while (0)
 
-- 
1.9.3

Reply via email to