File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,4 +56,7 @@ bool kernel_page_present(struct page *page);
5656#define SECTION_ALIGN L1_CACHE_BYTES
5757#endif /* CONFIG_STRICT_KERNEL_RWX */
5858
59+ #define PECOFF_SECTION_ALIGNMENT 0x1000
60+ #define PECOFF_FILE_ALIGNMENT 0x200
61+
5962#endif /* _ASM_RISCV_SET_MEMORY_H */
Original file line number Diff line number Diff line change 66
77#include <linux/pe.h>
88#include <linux/sizes.h>
9+ #include <asm/set_memory.h>
910
1011 .macro __EFI_PE_HEADER
1112 .long PE_MAGIC
@@ -33,7 +34,11 @@ optional_header:
3334 .byte 0x02 // MajorLinkerVersion
3435 .byte 0x14 // MinorLinkerVersion
3536 .long __pecoff_text_end - efi_header_end // SizeOfCode
36- .long __pecoff_data_virt_size // SizeOfInitializedData
37+ #ifdef __clang__
38+ .long __pecoff_data_virt_size // SizeOfInitializedData
39+ #else
40+ .long __pecoff_data_virt_end - __pecoff_text_end // SizeOfInitializedData
41+ #endif
3742 .long 0 // SizeOfUninitializedData
3843 .long __efistub_efi_pe_entry - _start // AddressOfEntryPoint
3944 .long efi_header_end - _start // BaseOfCode
@@ -91,9 +96,17 @@ section_table:
9196 IMAGE_SCN_MEM_EXECUTE // Characteristics
9297
9398 .ascii ".data\0\0\0"
94- .long __pecoff_data_virt_size // VirtualSize
99+ #ifdef __clang__
100+ .long __pecoff_data_virt_size // VirtualSize
101+ #else
102+ .long __pecoff_data_virt_end - __pecoff_text_end // VirtualSize
103+ #endif
95104 .long __pecoff_text_end - _start // VirtualAddress
96- .long __pecoff_data_raw_size // SizeOfRawData
105+ #ifdef __clang__
106+ .long __pecoff_data_raw_size // SizeOfRawData
107+ #else
108+ .long __pecoff_data_raw_end - __pecoff_text_end // SizeOfRawData
109+ #endif
97110 .long __pecoff_text_end - _start // PointerToRawData
98111
99112 .long 0 // PointerToRelocations
Original file line number Diff line number Diff line change @@ -27,9 +27,6 @@ ENTRY(_start)
2727
2828jiffies = jiffies_64;
2929
30- PECOFF_SECTION_ALIGNMENT = 0x1000 ;
31- PECOFF_FILE_ALIGNMENT = 0x200 ;
32-
3330SECTIONS
3431{
3532 /* Beginning of code and text segment */
@@ -132,6 +129,7 @@ SECTIONS
132129#ifdef CONFIG_EFI
133130 .pecoff_edata_padding : { BYTE(0 ); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
134131 __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
132+ __pecoff_data_raw_end = ABSOLUTE(.);
135133#endif
136134
137135 /* End of data section */
@@ -142,6 +140,7 @@ SECTIONS
142140#ifdef CONFIG_EFI
143141 . = ALIGN(PECOFF_SECTION_ALIGNMENT);
144142 __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
143+ __pecoff_data_virt_end = ABSOLUTE(.);
145144#endif
146145 _end = .;
147146
You can’t perform that action at this time.
0 commit comments