This is an archive of the discontinued LLVM Phabricator instance.

Convert MIPS .reginfo section to synthetic input section.
AbandonedPublic

Authored by ruiu on Nov 5 2016, 5:38 PM.

Details

Reviewers
atanasyan
Summary

Previously, we have an input section and an output section
for MIPS .reginfo. This patch reorganizes the code structure.
Now we have only one class for .reginfo, which is MipsReginfoSection.
MipsReginfoSection is a synthetic input section.

.reginfo sections are handled as regular sections until the
control reaches Writer. Writer then aggregates all sections whose
type is SHT_MIPS_REGINFO to create a single synthesized input section.
The synthesized section is then processed normally as if it came
from an input file.

Event Timeline

ruiu updated this revision to Diff 76974.Nov 5 2016, 5:38 PM
ruiu retitled this revision from to Convert MIPS .reginfo section to synthetic input section..
ruiu updated this object.
ruiu added a reviewer: atanasyan.
ruiu added a subscriber: llvm-commits.
atanasyan added inline comments.Nov 6 2016, 1:40 PM
ELF/InputFiles.cpp
166

When we calculate R_MIPS_GPREL16/32 relocations we need to know GP0 value stored in the .MIPS.options or .reginfo sections (take a look at the computeAddend routine). Each file might have it's own value. Usually GP0 is equal to zero but it is not always true. After this change getMipsGp0() does not take in account GP0 value stored in the .reginfo section and the mips-gprel32-relocs-gp0.s test case starts to fail.

To solve the problem we can add MipsGp0 field to the ObjectFile class and retrieve and save GP0 value to this field in the say ObjectFile::initializeSections function.

If you want I can work on that and convert MipsOptionsInputSection to synthetic input section too. It looks like it is better to convert .reginfo and .MIPS.options sections in a single patch.

ELF/SyntheticSections.cpp
110
  • s/supported/unsupported/
  • it is not very important, but it would be nice to continue to show a file's name in this error message. maybe add an argument to the getSectionContents routine to be able to pass a validate function.
atanasyan edited edge metadata.Nov 15 2016, 10:16 PM

Rui, could you abandon/close this revision because it's superseded by the D26444?

ruiu abandoned this revision.Jan 31 2017, 3:10 PM
test/ELF/basic-mips.s