This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR gold/16945: Executable with -fpie and -mcmodel=large gives segfault on start
- From: Cary Coutant <ccoutant at google dot com>
- To: Alexander Ivchenko <aivchenk at gmail dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, binutils <binutils at sourceware dot org>
- Date: Tue, 27 May 2014 10:16:18 -0700
- Subject: Re: PATCH: PR gold/16945: Executable with -fpie and -mcmodel=large gives segfault on start
- Authentication-results: sourceware.org; auth=none
- References: <20140515173129 dot GA19564 at intel dot com> <CACysShjg4vz0VB=3TtuPPW_RNCBQrD67puA9=KEauuOURy66vA at mail dot gmail dot com> <CAMe9rOoyqZUWo0Sgkfe6ec4dnKMyLFHmSQjbQ4FCOgrhkvf59A at mail dot gmail dot com> <CACysShifA0tDX+veDZTcuay0f14iLPQn0ZywoLiYHa6JDyN8rQ at mail dot gmail dot com>
> I just don't get why got_offset sometimes "unsigned int", sometimes
> "section_offset_type" and now "int". I guess it's just a little mess.
> I believe that the right way is having it as "ptrdiff", which is the
> same "section_offset_type".
Symbol::got_offset() returns an unsigned int, since it's always a
non-negative offset from the beginning of the section. In
Target_xxx::Relocate::relocate(), we change it to be a negative offset
from the end of the section, so it really should be signed at that
point. Whether we use int or section_offset_type or ptrdiff_t is, I
think, a minor point. Without modifying the type throughout, we can't
handle a GOT offset larger than an int anyway, so I think int is fine
here.
-cary