|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 10/11] x86/efi: do not merge all .init sections
As a result of having no relocations against text sections, there's no need
for a single .init section that's read-write-execute, as .init.text is no
longer modified.
Remove the bodge and fallback to the layout used by ELF images with an
.init.text and .init.data section.
The resulting PE sections are:
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00193f6b ffff82d040200000 ffff82d040200000 00000480 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 0008a010 ffff82d040400000 ffff82d040400000 00194400 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .buildid 00000035 ffff82d04048a010 ffff82d04048a010 0021e420 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .init.text 00049e70 ffff82d040600000 ffff82d040600000 0021e460 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
4 .init.data 000560a8 ffff82d040800000 ffff82d040800000 002682e0 2**2
CONTENTS, ALLOC, LOAD, DATA
[...]
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Changes since v1:
- Align .init.text.
- Clarify commit message.
---
xen/arch/x86/xen.lds.S | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 1191bf4e2ddd..852aa135a76c 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -201,11 +201,7 @@ SECTIONS
__2M_init_start = .; /* Start of 2M superpages, mapped RWX (boot
only). */
. = ALIGN(PAGE_SIZE); /* Init code and data */
__init_begin = .;
-#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */
- DECL_SECTION(.init) {
-#else
DECL_SECTION(.init.text) {
-#endif
_sinittext = .;
*(.init.text)
*(.text.startup)
@@ -218,12 +214,15 @@ SECTIONS
*/
*(.altinstr_replacement)
-#ifdef EFI /* EFI wants to merge all of .init.* ELF doesn't. */
- . = ALIGN(SMP_CACHE_BYTES);
-#else
} PHDR(text)
- DECL_SECTION(.init.data) {
+#ifdef EFI
+ /*
+ * Align to prevent the data section from re-using the tail of an RX mapping
+ * from the previous text section.
+ */
+ . = ALIGN(SECTION_ALIGN);
#endif
+ DECL_SECTION(.init.data) {
*(.init.bss.stack_aligned)
. = ALIGN(POINTER_ALIGN);
--
2.48.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |