[PATCH] [lld][ARM] Add relocations to perform function calls
ruiu at google.com
Mon Feb 2 23:24:49 PST 2015
Comment at: lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp:35
@@ +34,3 @@
+ return result;
> denis-protivensky wrote:
> > ruiu wrote:
> > > Is this intentional that you used signed integers instead of unsigned integers in this function? I'd use uint16_t when I do bit manipulation.
> > Agreed, will update all of these places while merging.
> I just looked carefully into the code and realized that using signed integers is a proper way of handling addends, because they may be negative numbers as well.
> As for MOV addend of Thumb instruction you mentioned, it's formed from exactly 16 bits, and the value is a signed integer, which may be negative (as the reference says). So using signed integers is perfectly fine for all relocation types.
I'd think the final result type, which is a signed integer type, can be different from types used for intermediate computation. We shuffle bits by shifts and bitmasks to form a 16 bit pattern here. All intermediate types except the result can be unsigned, no? Looks like all right bit shifts in this function aren't used to extend sign bit.
More information about the llvm-commits