This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] PR gold/17640
- From: Cary Coutant <ccoutant at google dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Ilya Tocar <tocarip dot intel at gmail dot com>, Ian Lance Taylor <iant at google dot com>, Binutils <binutils at sourceware dot org>
- Date: Thu, 19 Feb 2015 14:27:02 -0800
- Subject: Re: [PATCH] PR gold/17640
- Authentication-results: sourceware.org; auth=none
- References: <20150202134701 dot GA91020 at msticlxl7 dot ims dot intel dot com> <CAMe9rOpzSBoiykoFG+YuAK8QYsguqzZNrvj2sE7EhafUzOjJJw at mail dot gmail dot com> <20150218150011 dot GA40373 at msticlxl7 dot ims dot intel dot com> <CAMe9rOqGecgvSMs937a2b57mGjp-ZF5XuULQoAx3Tr9NG75GcA at mail dot gmail dot com> <20150219142707 dot GA507 at msticlxl7 dot ims dot intel dot com> <CAMe9rOp+6-mKKqE4h1jUvt-wBWVU0YK62yJPgrN0LVuU4JhxRw at mail dot gmail dot com>
>> Scan::local is called from gold::scan_relocs, so passing view into it
>> will require changes in other targets, which I'd like to avoid.
>> Also I'm not sure how to get view into instruction that uses
>> corresponding relocation.
> Gold will fail some TLS testcases in ld, like the ones in
> Target_i386::optimize_tls_reloc should check TLS instruction sequence,
> similar to elf_i386_check_tls_transition. To do that, you need view. You
> can add it and update other targets.
We've tried very hard to avoid having to read the actual section data
while scanning relocations; ideally, everything we need to know should
be available from the relocation and the symbol it points to.
(Checking the instruction stream, as we've seen recently, can be
problematic, especially for x86.) In less-than-ideal situations like
this one, if you really must access the contents of the section being
relocated, you should be able to call
obj->section_contents(data_shndx) to get a view for the data. While
running a Scan_relocs task on an object file, the file is locked, and
the view will be released when the file is unlocked at the end of that
task. I'd prefer that you do this only when necessary in the
target-specific code, rather than refactor the world.
(By the way, when posting a patch, please edit out the diffs for
generated files like Makefile.in.)