This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: .section directive documentation out of date?
- From: Nick Clifton <nickc at redhat dot com>
- To: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>, Binutils <binutils at sourceware dot org>
- Date: Thu, 24 Mar 2016 10:38:26 +0000
- Subject: Re: .section directive documentation out of date?
- Authentication-results: sourceware.org; auth=none
- References: <87lh59y8vi dot fsf at atmel dot com>
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