This change adds a basic support for linking static MSP430 ELF code.
Implemented relocation types are intended to correspond to the BFD.
Details
Diff Detail
- Repository
- rLLD LLVM Linker
- Build Status
Buildable 26622 Build 26621: arc lint + arc unit
Event Timeline
Overall looks good to me. Comments are inlined.
ELF/Arch/MSP430.cpp | ||
---|---|---|
8 | Please add a description of the platform. See AVR.cpp for a sample. | |
64 | I would remove this. How much is real to have this error? case R_MSP430_16: case R_MSP430_16_PCREL: case R_MSP430_16_BYTE: case R_MSP430_16_PCREL_BYTE: checkIntUInt(Loc, Val, 16, Type); write16le(Loc, Val); Note that this is an msp430 that AFAIK has many documentation issues. I would try to with the simple as simple code as possible for now. | |
80 | The same here. I would add a check that Val fits into int16_t ideally, but for now, I think you can omit this error check and skip any checks at all (We do not check other relocations we have for oddness I think anyway it seems). So I would simplify things as much as possible for initial msp400 support. | |
test/ELF/msp430.s | ||
8 | Please explain the purpose of the test here (just add a short description of what it do like "This tests the simple msp400 relocations like X, Y" etc). Also seems you can go with a single llvm-objdump invocation, please do in that way. |
ELF/Arch/MSP430.cpp | ||
---|---|---|
64 | :] *I would try to go with the simple code as possible for now. |
LGTM.
ELF/Arch/MSP430.cpp | ||
---|---|---|
19 | I would remove this sentence. It too easy to forget to update it. |
Seems something went wrong. It does not compile for me. Could you re-upload?
161>D:\Work\llvm\tools\lld\ELF\Arch\MSP430.cpp(81): error C2065: 'Offset': undeclared identifier 161>D:\Work\llvm\tools\lld\ELF\Arch\MSP430.cpp(82): error C2065: 'Offset': undeclared identifier 161>D:\Work\llvm\tools\lld\ELF\Arch\MSP430.cpp(82): error C2660: 'llvm::support::endian::write16le': function does not take 1 argument
Could you please wait for a while for me to review? Adding a new target is a big deal, and it should be done more carefully. Sending a patch and submitting in a few hours is unacceptable. George, when you give LGTM please note about that too.
This patch doesn't have any test -- the test file doesn't contain any RUN: line, so nothing is tested so far.
lld/trunk/ELF/Arch/MSP430.cpp | ||
---|---|---|
45 ↗ | (On Diff #181038) | TrapInstr must be 4 bytes long. Otherwise it would create a garbage on every two bytes. |
lld/trunk/ELF/CMakeLists.txt | ||
18 ↗ | (On Diff #181038) | Sort asciibetically. "MSP" should precede "Mips" in the dictionary order. |
After reading this patch, I decided to *not* roll back this patch as the patch seems acceptable with a few changes (I'm going to make the changes), but please keep in mind that that handling is exceptional; when someone added a new target in such a way like this, we'd normally have to revert it no matter what the patch is, as it is a violation of the usual review process. And I believe you didn't really have to rush to submit; this is a good patch, so just relax and wait for a little for others to review it as well.
lld/trunk/ELF/Arch/MSP430.cpp | ||
---|---|---|
45 ↗ | (On Diff #181038) | Does this instruction actually triggers a CPU interrupt? |
How mature is this implementation of MSP support? I'd like to add a note to the release notes for the next major release.
After reading this patch, I decided to *not* roll back this patch as the patch seems acceptable with a few changes (I'm going to make the changes), but please keep in mind that that handling is exceptional; when someone added a new target in such a way like this, we'd normally have to revert it no matter what the patch is, as it is a violation of the usual review process. And I believe you didn't really have to rush to submit; this is a good patch, so just relax and wait for a little for others to review it as well.
Yeah, sorry, probably I just shouldn't have asked to submit that soon.
lld/trunk/ELF/Arch/MSP430.cpp | ||
---|---|---|
45 ↗ | (On Diff #181038) | It does trigger an interrupt on a simulator and presumably it does not on a real hardware. |
I think the implementation could be characterized as "initial".
We have several tests compiled by LLVM and linked by LLD running on the gdb-sim simulator, including some tests shipped with newlib.
It is not mature at all and it is initial support for hello world AFAIK. So I would not add more than "initial implementation of MSP430 target" line. Michael might know much more than me here.
Please add a description of the platform. See AVR.cpp for a sample.
(Note: we do not have it for X86_64.cpp which is the most popular one I guess, but for less popular platforms I think this is a must)