[PATCH] D22516: [ELF] - Fix an issue when 2 output sections were created from single declaration in script

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 08:40:15 PDT 2016


Interesting.

Honestly I still think it is a issue to have more than one section for one declaration.
I think that if somebody uses a script he probably expects to see exactly what he write,
and probably does not wait to see multiple sections.

For orphan sections we refused from heuristics that gold/bfd do and just put them at the end,
to keep output simple for understanding. That probably the same situation,
difference that for orphans we did nothing, but here some code is required, so it is not so natural.

So I would probably keep this as is for now, while there is no nice little "fix", but would keep that in mind.

Best regards,
George.
________________________________________
От: Rafael Espíndola <rafael.espindola at gmail.com>
Отправлено: 22 июля 2016 г. 18:29
Кому: reviews+D22516+public+c60a022b5c5f7979 at reviews.llvm.org
Копия: George Rimar; Rui Ueyama; evgeny777; llvm-commits
Тема: Re: [PATCH] D22516: [ELF] - Fix an issue when 2 output sections were created from single declaration in script

So, I think my example was broken

The script was matching sections named .foo.*, but the sections in the
.s file were missing the second dot.

If I expand the example to

SECTIONS {
 .bar1 : { *(.foo1) *(.foo2) }
 .bar2 : { *(.foo) }
}

and input files

.section .foo1, "aw"
.long 1
.section .foo2, "aT"
.long 2
.section .foo, "aw"
.long 3
.section .zed, "aw"
.long 4


and

 .section .foo, "aT"
.long 5
.section .zed, "aT"
.long 5


What I get is

bfd concatenates the sections by name only and we end with 3 sections
(.bar1, .bar2 and .zed).

gold produces two .zed section (which I think is a good thing) but
only one .bar1 and one .bar2. It also eats the T flag from the bar
sections.

Given the inconsistency we can probably keep the current behaviour,
but I just want to rectify the experiment.

Cheers,
Rafael


More information about the llvm-commits mailing list