if (size >= (1ULL << 56))
return (bfd_vma) -1;
- size <<= 8;
- if (sec->flags & SEC_READONLY
- || sec->flags & SEC_ROM)
- return size | 1;
+ /* N.b. We are only ever using this function for Morello.
+ Morello is little-endian.
+ We are returning a 64bit sized integer.
+ The format this metadata is supposed to fit is
+ | 56 bit length | 8 bit permissions |
+ This means that (in little endian layout) we need to put the 56 bit size
+ in the *lower* bits of the uint64_t. */
+ uint64_t flags = 0;
if (sec->flags & SEC_CODE)
- return size | 4;
- if (sec->flags & SEC_ALLOC)
- return size | 2;
+ flags = 4;
+ else if (sec->flags & SEC_READONLY
+ || sec->flags & SEC_ROM)
+ flags = 1;
+ else if (sec->flags & SEC_ALLOC)
+ flags = 2;
/* We should always be able to derive a valid set of permissions
from the section flags. */
- abort ();
+ if (flags == 0)
+ abort ();
+ return size | (flags << 56);
}
enum c64_section_perm_type {
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
- .*: 00000302 .*
- .*: 00000000 .*
+ .*: 00000003 .*
+ .*: 02000000 .*
Disassembly of section .data:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
- .*: 00000302 .*
- .*: 00000000 .*
+ .*: 00000003 .*
+ .*: 02000000 .*
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00001b02 .*
-.*: 00000000 .*
+.*: 0000001b .*
+.*: 02000000 .*
.*: 00010350 .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00001b02 .*
-.*: 00000000 .*
+.*: 0000001b .*
+.*: 02000000 .*
.*: [0-9a-f]+ .*
.*: R_MORELLO_CAPINIT str
.*: 00000000 .*
-.*: 00001b02 .*
-.*: 00000000 .*
+.*: 0000001b .*
+.*: 02000000 .*
.* <cap2>:
...
.*: [0-9a-f]+ .*
.*: R_MORELLO_CAPINIT str
.*: 00000000 .*
-.*: 00001b02 .*
-.*: 00000000 .*
+.*: 0000001b .*
+.*: 02000000 .*
.* <cap2>:
...
101010: 001001ed .*
101010: R_MORELLO_RELATIVE \*ABS\*
101014: 00000000 .*
- 101018: 00000402 .*
- 10101c: 00000000 .*
+ 101018: 00000004 .*
+ 10101c: 02000000 .*
101020: 00100100 .*
101020: R_MORELLO_RELATIVE \*ABS\*
101024: 00000000 .*
- 101028: 000f5001 .*
- 10102c: 00000000 .*
+ 101028: 00000f50 .*
+ 10102c: 04000000 .*
101030: 00100100 .*
101030: R_MORELLO_RELATIVE \*ABS\*\+0x1
101034: 00000000 .*
- 101038: 000f5001 .*
- 10103c: 00000000 .*
+ 101038: 00000f50 .*
+ 10103c: 04000000 .*
101040: 001001e8 .*
101040: R_MORELLO_RELATIVE \*ABS\*
101044: 00000000 .*
- 101048: 00000402 .*
- 10104c: 00000000 .*
+ 101048: 00000004 .*
+ 10104c: 02000000 .*
\.\.\.
101010: 00100075 .*
101014: 00000000 .*
- 101018: 00000402 .*
- 10101c: 00000000 .*
+ 101018: 00000004 .*
+ 10101c: 02000000 .*
101020: 00100000 .*
101024: 00000000 .*
- 101028: 00105001 .*
- 10102c: 00000000 .*
+ 101028: 00001050 .*
+ 10102c: 04000000 .*
101030: 00100000 .*
101034: 00000000 .*
- 101038: 00105001 .*
- 10103c: 00000000 .*
+ 101038: 00001050 .*
+ 10103c: 04000000 .*
101040: 00100070 .*
101044: 00000000 .*
- 101048: 00000402 .*
- 10104c: 00000000 .*
+ 101048: 00000004 .*
+ 10104c: 02000000 .*
1010: 000001e8 .*
1010: R_MORELLO_RELATIVE \*ABS\*\+0x38
1014: 00000000 .*
- 1018: 000e6801 .*
- 101c: 00000000 .*
+ 1018: 00000e68 .*
+ 101c: 04000000 .*
1020: 000001e8 .*
1020: R_MORELLO_RELATIVE \*ABS\*\+0x48
1024: 00000000 .*
- 1028: 000e6801 .*
- 102c: 00000000 .*
+ 1028: 00000e68 .*
+ 102c: 04000000 .*
1030: 00000230 .*
1030: R_MORELLO_RELATIVE \*ABS\*
1034: 00000000 .*
- 1038: 00000d01 .*
- 103c: 00000000 .*
+ 1038: 0000000d .*
+ 103c: 01000000 .*
1040: 00000220 .*
1040: R_MORELLO_RELATIVE \*ABS\*
- 1044: 00000000 .*
- 1048: 00000002 .*
- 104c: 00000000 .*
+ \.\.\.
+ 104c: 02000000 .*
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00000402 .*
-.*: 00000000 .*
+.*: 00000004 .*
+.*: 02000000 .*
.* <globcap>:
...
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00000402 .*
-.*: 00000000 .*
+.*: 00000004 .*
+.*: 02000000 .*
.* <globcap>:
...
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*\+0x[0-9a-f]+
.*: 00000000 .*
-.*: 00027001 .*
-.*: 00000000 .*
+.*: 00000270 .*
+.*: 04000000 .*
[0-9a-f]+ <ct_start>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*\+0x[0-9a-f]+
.*: 00000000 .*
-.*: 00027001 .*
-.*: 00000000 .*
+.*: 00000270 .*
+.*: 04000000 .*
[0-9a-f]+ <ct1_start>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*\+0x[0-9a-f]+
.*: 00000000 .*
-.*: 00027001 .*
-.*: 00000000 .*
+.*: 00000270 .*
+.*: 04000000 .*
[0-9a-f]+ <ct1_end>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*\+0x[0-9a-f]+
.*: 00000000 .*
-.*: 00027001 .*
-.*: 00000000 .*
+.*: 00000270 .*
+.*: 04000000 .*
[0-9a-f]+ <ct_end>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*\+0x[0-9a-f]+
.*: 00000000 .*
-.*: 00027001 .*
-.*: 00000000 .*
+.*: 00000270 .*
+.*: 04000000 .*
[0-9a-f]+ <cd_outer_start>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00000c02 .*
-.*: 00000000 .*
+.*: 0000000c .*
+.*: 02000000 .*
[0-9a-f]+ <cd_start>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00000c02 .*
-.*: 00000000 .*
+.*: 0000000c .*
+.*: 02000000 .*
[0-9a-f]+ <cd1_start>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00000802 .*
-.*: 00000000 .*
+.*: 00000008 .*
+.*: 02000000 .*
[0-9a-f]+ <cd1_end>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 00000402 .*
-.*: 00000000 .*
+.*: 00000004 .*
+.*: 02000000 .*
[0-9a-f]+ <cd_end>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
-.*: 00000000 .*
-.*: 00000002 .*
-.*: 00000000 .*
+ \.\.\.
+.*: 02000000 .*
[0-9a-f]+ <cdynamic>:
.*: [0-9a-f]+ .*
.*: R_MORELLO_RELATIVE \*ABS\*
.*: 00000000 .*
-.*: 0*[1-9a-f]+[0-9]*02 .*
-.*: 00000000 .*
+.*: 000*[1-9a-f]+[0-9]* .*
+.*: 02000000 .*
[0-9a-f]+: 00010440.*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000.*
- [0-9a-f]+: 00000002.*
[0-9a-f]+: 00000000.*
+ [0-9a-f]+: 02000000.*
[0-9a-f]+ <ptr2>:
[0-9a-f]+: 00010444.*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000.*
- [0-9a-f]+: 00000002.*
[0-9a-f]+: 00000000.*
+ [0-9a-f]+: 02000000.*
[0-9a-f]+ <ptr1>:
[0-9a-f]+: 00010448.*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000.*
- [0-9a-f]+: 00000002.*
[0-9a-f]+: 00000000.*
+ [0-9a-f]+: 02000000.*
Disassembly of section .bss:
[0-9a-f]+: 000103b0 .*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000 .*
- [0-9a-f]+: 00000002 .*
[0-9a-f]+: 00000000 .*
+ [0-9a-f]+: 02000000 .*
[0-9a-f]+: 000103b8 .*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000 .*
- [0-9a-f]+: 00000002 .*
[0-9a-f]+: 00000000 .*
+ [0-9a-f]+: 02000000 .*
[0-9a-f]+: 000103b4 .*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000 .*
- [0-9a-f]+: 00000002 .*
[0-9a-f]+: 00000000 .*
+ [0-9a-f]+: 02000000 .*
Disassembly of section .bss:
[0-9a-f]+: 00010440.*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000.*
- [0-9a-f]+: 00000002.*
[0-9a-f]+: 00000000.*
+ [0-9a-f]+: 02000000.*
[0-9a-f]+ <ptr2>:
[0-9a-f]+: 00010444.*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000.*
- [0-9a-f]+: 00000002.*
[0-9a-f]+: 00000000.*
+ [0-9a-f]+: 02000000.*
[0-9a-f]+ <ptr1>:
[0-9a-f]+: 00010448.*
[0-9a-f]+: R_MORELLO_RELATIVE \*ABS\*
[0-9a-f]+: 00000000.*
- [0-9a-f]+: 00000002.*
[0-9a-f]+: 00000000.*
+ [0-9a-f]+: 02000000.*
Disassembly of section .bss: