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]

[PATCH, gas] PC-relative fx_offset calculation

Hi, this patch corrects the PC-relative case in write.c:fixup_segment()
where the location of the fix seems to incorrectly use fx_dot_value +
fx_frag->fr_address, rather than fx_where + fx_frag->fr_address.

fx_dot_value actually seems to work most of the time, however in cases
I'm encountering under the nios2 port, the calling of frag_more() before
creating a new fix during assembly sometimes creates a new frag, thus
causing mismatch of fx_dot_value vs. the intra-frag position.

The behavior seems to depend on the point of frag obstack exhaustion, so
I'm afraid I don't have a way to reproduce the error consistently. My
current failing case is pthread_create.c from NPTL, which triggers in
our internal binutils branch, but doesn't happen on a clean binutils
trunk checkout...

So how does this (one liner) patch look, does the change look sensible?


2013-03-01  Chung-Lin Tang  <>

	* write.c (fixup_segment): Use fx_where instead of fx_dot_value
	in computing fx_offset for the pc-relative case.

Attachment: gas.diff
Description: Text document

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