This came up with some very large object files. The solution (wrap around at
value size) doesn't feel good, but it appears to be the way binutils does it
too. Are there legitimate cases for this?
addend=reloc['r_addend'] if recipe.has_addend else 0)
# 3. Write the relocated value back into the stream
stream.seek(reloc['r_offset'])
+
+ # Make sure the relocated value fits back by wrapping it around. This
+ # looks like a problem, but it seems to be the way this is done in
+ # binutils too.
+ relocated_value = relocated_value % (2 ** (recipe.bytesize * 8))
value_struct.build_stream(relocated_value, stream)
# Relocations are represented by "recipes". Each recipe specifies: