This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: m68k section alignment


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[] =
   {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]