[llvm] [llvm-objcopy] Support SREC output format (PR #75874)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 8 12:04:11 PST 2024
================
@@ -324,6 +324,14 @@ Expected<IHexRecord> IHexRecord::parse(StringRef Line) {
return Rec;
}
+static uint64_t sectionLMA(const SectionBase *Sec) {
----------------
quic-areg wrote:
I see different results from gnu objcopy when using sectionPhysicalAddr.
example using `ihex-elf-segments.yaml`:
GNU:
```
S00400007883
S214000000000102030405060708090A0B0C0D0E0F73
S20900001010111213148C
S20F00FFF83031323334353637383940AC
S20801010040414243EF
S20F10FFF850515253545556575859603C
S20720FFF8000000E1
S804100000EB
address data
000000 000102030405060708090A0B0C0D0E0F
000010 1011121314
00FFF8 3031323334353637383940
010100 40414243
10FFF8 5051525354555657585960
20FFF8 000000
```
LLVM(sectionPhysicalAddr):
```
S00400007883
S214100000000102030405060708090A0B0C0D0E0F63
S20910001010111213147C
S20F10001830313233343536373839407B
S20810002840414243B9
S20F100030505152535455565758596003
S20720FFF8000000E1
S804100000EB
address data
100000 000102030405060708090A0B0C0D0E0F
100010 1011121314
100018 3031323334353637383940
100028 40414243
100030 5051525354555657585960
20FFF8 000000
```
looking at the LMA values in objdump -h output, I think that the former is correct
```
objdump -h 1.o
1.o: file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000015 0000000000000000 0000000000000000 00000078 2**3
1 .data1 0000000b 000000000000fff8 000000000000fff8 00000090 2**3
2 .data2 00000004 0000000000010100 0000000000010100 000000a0 2**3
3 .data3 0000000b 000000000010fff8 000000000010fff8 000000a8 2**3
```
https://github.com/llvm/llvm-project/pull/75874
More information about the llvm-commits
mailing list