This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: m68k section alignment
- From: Vincent Rivière <vincent dot riviere at freesbee dot fr>
- To: binutils at sourceware dot org
- Date: Thu, 17 May 2007 18:34:49 +0200
- Subject: Re: m68k section alignment
- References: <463F3E9E.3010100@freesbee.fr>
Hi.
Currently, gas produces object files for m68k which are aligned to 4
bytes. I think this is too much, because the highest aligment required
for the cpu is 2 bytes.
The attached patch sets the default alignment to 2 bytes for all the
m68k targets.
Thus, the size of the sections in the generated object files are minimal.
$ cat nop.s
nop
$ as-new nop.s -o nop.o
$ objdump -h nop.o
nop.o: file format a.out-m68k-netbsd
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000002 00000000 00000000 00000020 2**1
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000000 00000002 00000002 00000022 2**1
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00000002 00000002 00000000 2**1
ALLOC
Note that before this patch, the .text section size was 4-byte long : 2
bytes for the nop, plus 2 filler bytes.
If everyone think it's OK, this patch may be committed.
Regards,
Vincent Rivière
diff -aurN src.original/bfd/cpu-m68k.c src/bfd/cpu-m68k.c
--- src.original/bfd/cpu-m68k.c 2007-05-17 12:02:42.000000000 +0200
+++ src/bfd/cpu-m68k.c 2007-05-17 17:55:59.000000000 +0200
@@ -29,7 +29,7 @@
const bfd_arch_info_type *b);
#define N(name, print,d,next) \
-{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,2,d,bfd_m68k_compatible,bfd_default_scan, next, }
+{ 32, 32, 8, bfd_arch_m68k, name, "m68k",print,1,d,bfd_m68k_compatible,bfd_default_scan, next, }
static const bfd_arch_info_type arch_info_struct[] =
{