Mysterious relocation

NetStranger shtras@gmail.com
Tue Aug 17 10:54:00 GMT 2010


Hi, I have a problem understanding the purpose of the following relocation:
8359178:       b8 50 0b 36 08          mov    $0x8360b50,%eax
                        8359179: R_386_32      
_ZNK13LaplaceSolver6SolverILi3EE15assemble_matrixERNS1_12LinearSystemERK18TriaActiveIteratorILi3E15
DoFCellAccessorILi3EEES9_RN7Threads16DummyThreadMutexE
835917d:       a8 01                   test   $0x1,%al
835917f:       0f 84 c2 02 00 00       je     8359447
<_ZN13LaplaceSolver6SolverILi3EE22assemble_linear_systemERNS1_12LinearSystemE+0x377>

It appears to me that whether or not to jump depends on the address
0x8360b50 (and not the value in it).
And there's a relocation which means, if for some reason relocation target
will move, the address will change and the test instruction results will be
different.

Now, I need to do a code reordering, which causes what I described above.
Normally linker relocations help resolve such problems, but here it seems
that this relocation causes unpredicted program behaviour as a result of a
code reordering.

The binary is compiled with
g++ -O3 --fomit-frame-pointer -Wl,-q
g++ version 4.2.0

Thanks in advance
-- 
View this message in context: http://old.nabble.com/Mysterious-relocation-tp29449244p29449244.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list