This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
.section directive documentation out of date?
- From: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 23 Mar 2016 12:32:41 +0530
- Subject: .section directive documentation out of date?
- Authentication-results: sourceware.org; auth=none
Hi,
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
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 0000000000000000 0000000000000000 00000040 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 0000000000000000 0000000000000000 00000040 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 0000000000000000 0000000000000000 00000040 2**0
ALLOC
3 .fill 00000001 0000000000000000 0000000000000000 00000040 2**0
CONTENTS, READONLY
The section is READONLY - only explicitly adding the "w" flag makes it
writable.I observed the same behavior with avr-as as well. Is
the documentation wrong?
It also goes ahead and says " the n and w flags remove attributes from
the section, rather than adding them, so if they are used on their own
it will be as if no flags had been specified at all" - which is
true for "n", but not for "w", going by the above results.
Regards
Senthil