This is the mail archive of the 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]

.section directives with the same name but different fields

## Different group signature

.section .foo,"aG",@progbits,foo
.section .foo,"aG",@progbits,bar

Both GNU as and llvm-mc (usage: llvm-mc -filetype=obj a.s -o a.o) create
two sections.

We don't want to change this rule.

## Different sh_link

.section .foo,"ao",@progbits,foo
.section .foo,"ao",@progbits,bar

With H.J. Lu's ,
GNU as emits two sections, even if foo and bar are defined in the same section.

This is something both GNU as and llvm-mc ( want to do.
Also see

Now, something that needs discussion.

## Different sh_entsize

.section .foo,"aM",@progbits,4
.section .foo,"aM",@progbits,8

GNU as emits a warning `Warning: ignoring changed section entity size for .foo`

The output sh_entsize is 4. If the second .section defines an object, the object may get corrupted after merging
( )
For this case, we have several choices:

1. (Status quo) Emit one section. Set sh_entsize to 4 and emit a warning.
2. Emit two sections, i.e. sh_entsize is a differentiator.
3. Emit one section. Set sh_entsize to 0. Should the assembler emit a warning?

## Different sh_flags

.section .foo,"aw"
.section .foo,"a" # Warning: ignoring changed section attributes for .foo

Shall we emit two sections?

## Different sh_type

.section .foo,"a",@progbits
.section .foo,"a",@nobits   # Warning: ignoring changed section type for .foo

Shall we emit two sections?

## Different sh_addr,sh_offset,sh_size,sh_info,sh_addralign

These fields are not specified by the .section directive, thus they
should not be a differentiator.

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