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: .section directive documentation out of date?


Hi Senthil,

>     https://sourceware.org/binutils/docs/as/Section.html says that for
>     unrecognized section names, the assembler's default behavior is to
>     make the section loaded and writable. However, that doesn't seem to
>     be the case - for e.g.
> 
>     $ cat test.s
> .section	.fill,"",@progbits
> .byte 0xFF
> 
>     $ as test.s -o test.o
>     $ objdump -h test.o
> 
> test.o:     file format elf64-x86-64

That part of the description of the .section pseudo-op is for *COFF* based targets
not ELF based ones.  The elf64-x86-64 target is ELF based, and so this part of the
description does not apply.

If you run a similar test using a COFF target, you do get the expected results:

  $ cd i686-pc-cygwin
  $ cat test.s
  .section .fill
  .byte 0xFF

  $ as test.s -o test.o
  $ objdump -h test.o

  test.o:     file format pe-i386

  Sections:
  Idx Name          Size      VMA       LMA       File off  Algn
  [...]
  3 .fill         00000004  00000000  00000000  000000b4  2**2
                  CONTENTS, ALLOC, LOAD, DATA

Cheers
  Nick


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