[PATCH] D30724: Dont emit Mapping symbols for sections that contain only data.

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 08:43:05 PDT 2017


Hello Tim,

I agree that this is an area when we can be more helpful by doing more
than the ABI requires.
- armasm will output a $d mapping symbol if there is only data in an
executable section. It won't put the $d in if it isn't executable.
- fromelf from memory assumes data if there is no symbolic information
such as a mapping symbol or a STT_FUNC symbol that it can use bit 0 to
test for ARM/Thumb. This isn't ideal behaviour for a stripped image as
you've pointed out.

I think adding in the mapping symbol for an executable section when we
know it contains only data is the most reasonable thing to do. From
memory the ABI permitted the removal of mapping symbols from data
sections to simplify the output of tool generated sections like
.ARM.exidx.

Peter

On 29 March 2017 at 16:08, Tim Northover <t.p.northover at gmail.com> wrote:
> Hi Peter,
>
> On 29 March 2017 at 06:36, Peter Smith via Phabricator
> <reviews at reviews.llvm.org> wrote:
>> I don't see any problem with fixing the lld test to match the new llvm-objdump output.
>
> I agree in this particular case, but I'm starting to think there is a
> nasty edge-case here that would be best solved by emitting these extra
> symbols.
>
> According to the ABI, llvm-objdump should be printing .text as data in
> the absence of mapping symbols, but the strip command removes all
> mapping symbols and we can't distinguish between a stripped file and
> one where every section really contains only data.
>
> So it seems reasonable for llvm-objdump to continue to apply a
> heuristic based on section kind when symbols are absent. But then
> we're in a situation where we emit an object file that we know
> llvm-objdump will misrepresent, and it's not against the ABI to fix
> that (just an extra, redundant $d).
>
> Which leads us to the patch Shankar uploaded yesterday (though the
> name "UseCodeAlign" would have to change, it's no longer accurate).
>
> What do armasm and fromelf do, and what do you think is most reasonable?
>
> Tim.


More information about the llvm-commits mailing list