[llvm-commits] [PATCH] ARM/MC/ELF Relocation Stubs/Refactoring

Jason Kim jasonwkim at google.com
Mon Nov 1 21:04:26 PDT 2010


Hi everyone, please find enclosed two patches in sequence
They need to be applied together, but I broke them into two pieces for
(hopefully) easier comprehension.
They both are hg mq patches, but they should apply cleanly (in
sequence) to trunk with patch -p1

The patches are for adding relocation support to ARM/MC.
They required slight changes to the TargetELFWriterInfo hierarchy as
well as modifications to the ELFWriter class.

The first patch arm-mc-elf-s07 changes the getRelocationType() to take
the MachineRelocation and ELFSection instances directly.
This allows for the second patch arm-mc-elf-s07-tew - RelocateField()
now dispatches to a new class/method
TargetELFRelocHelper::RelocateField() to handle the non-simple
relocations used (if any).

The rationale for these is to support the various non-simple (i.e. not
just a 32/64bit sequential blob) - relocation types mandated by the
ARM architecture manual. There are over 100 of these relocation types,
and selecting the actual ELF32_R_TYPE() field depends on the actual
instruction sequence - and the most obvious way to do this is to
examine the ELFSection& object directly.

There are several alternate ways to do this, but for the sake of a
discussion starter, I chose the most straight forward way which was to
make the ELFSecton object visible to the getRelocationType() routine.
There might be additional refactoring to make the code "neater"
(perhaps moving isolating the arch-specific stuff completely to the
new helper class?),  but hopefully this will be a good enough as a
starting point for discussion.

The two diffviews are at

http://codereview.chromium.org/4294001
http://codereview.chromium.org/4295001

The patches do not change any code behavior.

Feedback is greatly appreciated.
Thanks!
-jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-mc-elf-s07
Type: application/octet-stream
Size: 7105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101101/b920b321/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-mc-elf-s07-tew
Type: application/octet-stream
Size: 8512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101101/b920b321/attachment-0001.obj>


More information about the llvm-commits mailing list