From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Roger Pau Monne <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Shawn Anastasio <sanastasio@raptorengineering.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bob Eshleman <bobbyeshleman@gmail.com>,
Connor Davis <connojdavis@gmail.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH 3/7] xen: remove -N from the linker command line
Date: Fri, 21 Mar 2025 17:28:27 +0100 [thread overview]
Message-ID: <9558d87f-582f-4e0f-ad2b-bb78e6e53f1e@gmail.com> (raw)
In-Reply-To: <20250318173547.59475-4-roger.pau@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 7810 bytes --]
On 3/18/25 6:35 PM, Roger Pau Monne wrote:
> It's unclear why -N is being used in the first place. It was added by
> commit 40828c657dd0c back in 2004 without any justification.
>
> When building a PE image it's actually detrimental to forcefully set the
> .text section as writable. The GNU LD man page contains the following
> warning regarding the -N option:
>
>> Note: Although a writable text section is allowed for PE-COFF targets, it
>> does not conform to the format specification published by Microsoft.
> Remove the usage of -N uniformly on all architectures, assuming that the
> addition was simply done as a copy and paste of the original x86 linking
> rune.
>
> Signed-off-by: Roger Pau Monné<roger.pau@citrix.com>
> ---
> xen/arch/arm/Makefile | 6 +++---
> xen/arch/ppc/Makefile | 6 +++---
> xen/arch/riscv/Makefile | 6 +++---
I think it is enough Jan's Reviewed-by, but just in case:
Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
Thanks.
~ Oleksii
> xen/arch/x86/Makefile | 12 ++++++------
> 4 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
> index 4837ad467a06..129a109d6ec5 100644
> --- a/xen/arch/arm/Makefile
> +++ b/xen/arch/arm/Makefile
> @@ -97,19 +97,19 @@ ifeq ($(CONFIG_ARM_64),y)
> endif
>
> $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
> $(objtree)/common/symbols-dummy.o -o $(dot-target).0
> $(NM) -pa --format=sysv $(dot-target).0 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).0.S
> $(MAKE) $(build)=$(@D) $(dot-target).0.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
> $(dot-target).0.o -o $(dot-target).1
> $(NM) -pa --format=sysv $(dot-target).1 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).1.S
> $(MAKE) $(build)=$(@D) $(dot-target).1.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
> $(dot-target).1.o -o $@
> $(NM) -pa --format=sysv $@ \
> | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
> diff --git a/xen/arch/ppc/Makefile b/xen/arch/ppc/Makefile
> index 655d212f6687..cf27bcebb25a 100644
> --- a/xen/arch/ppc/Makefile
> +++ b/xen/arch/ppc/Makefile
> @@ -12,19 +12,19 @@ $(TARGET): $(TARGET)-syms
> cp -f $< $@
>
> $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
> $(objtree)/common/symbols-dummy.o -o $(dot-target).0
> $(NM) -pa --format=sysv $(dot-target).0 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).0.S
> $(MAKE) $(build)=$(@D) $(dot-target).0.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
> $(dot-target).0.o -o $(dot-target).1
> $(NM) -pa --format=sysv $(dot-target).1 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).1.S
> $(MAKE) $(build)=$(@D) $(dot-target).1.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
> $(dot-target).1.o -o $@
> $(NM) -pa --format=sysv $@ \
> | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
> diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
> index b0c8270a9947..516f5d505ca8 100644
> --- a/xen/arch/riscv/Makefile
> +++ b/xen/arch/riscv/Makefile
> @@ -16,19 +16,19 @@ $(TARGET): $(TARGET)-syms
> $(OBJCOPY) -O binary -S $< $@
>
> $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
> $(objtree)/common/symbols-dummy.o -o $(dot-target).0
> $(NM) -pa --format=sysv $(dot-target).0 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).0.S
> $(MAKE) $(build)=$(@D) $(dot-target).0.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< \
> $(dot-target).0.o -o $(dot-target).1
> $(NM) -pa --format=sysv $(dot-target).1 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).1.S
> $(MAKE) $(build)=$(@D) $(dot-target).1.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
> $(dot-target).1.o -o $@
> $(NM) -pa --format=sysv $@ \
> | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
> index f59c9665fdd0..c2f1dcf301d6 100644
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -139,19 +139,19 @@ $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
> CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
>
> $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
> $(objtree)/common/symbols-dummy.o -o $(dot-target).0
> $(NM) -pa --format=sysv $(dot-target).0 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).0.S
> $(MAKE) $(build)=$(@D) $(dot-target).0.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
> $(dot-target).0.o -o $(dot-target).1
> $(NM) -pa --format=sysv $(dot-target).1 \
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
> > $(dot-target).1.S
> $(MAKE) $(build)=$(@D) $(dot-target).1.o
> - $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
> + $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \
> $(orphan-handling-y) $(dot-target).1.o -o $@
> $(NM) -pa --format=sysv $@ \
> | $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
> @@ -212,7 +212,7 @@ ifeq ($(CONFIG_DEBUG_INFO),y)
> $(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
> endif
> $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
> - $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< $(relocs-dummy) \
> + $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds $< $(relocs-dummy) \
> $(objtree)/common/symbols-dummy.o $(note_file_option) \
> -o $(dot-target).$(base).0 &&) :
> $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(dot-target).$(base).0) \
> @@ -222,7 +222,7 @@ endif
> > $(dot-target).0s.S
> $(MAKE) $(build)=$(@D) .$(@F).0r.o .$(@F).0s.o
> $(foreach base, $(VIRT_BASE) $(ALT_BASE), \
> - $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< \
> + $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds $< \
> $(dot-target).0r.o $(dot-target).0s.o $(note_file_option) \
> -o $(dot-target).$(base).1 &&) :
> $(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(dot-target).$(base).1) \
> @@ -231,7 +231,7 @@ endif
> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
> > $(dot-target).1s.S
> $(MAKE) $(build)=$(@D) .$(@F).1r.o .$(@F).1s.o
> - $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
> + $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds $< \
> $(dot-target).1r.o $(dot-target).1s.o $(orphan-handling-y) \
> $(note_file_option) -o $@
> $(NM) -pa --format=sysv $@ \
[-- Attachment #2: Type: text/html, Size: 8410 bytes --]
next prev parent reply other threads:[~2025-03-21 16:28 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 17:35 [PATCH 0/7] x86: generate xen.efi image with no write-execute sections Roger Pau Monne
2025-03-18 17:35 ` [PATCH 1/7] x86/boot: clarify comment about trampoline_setup usage Roger Pau Monne
2025-03-18 17:45 ` Andrew Cooper
2025-03-19 8:46 ` Roger Pau Monné
2025-03-19 12:22 ` Andrew Cooper
2025-03-18 17:35 ` [PATCH 2/7] x86/mkelf32: account for offset when detecting note segment placement Roger Pau Monne
2025-03-18 17:45 ` Andrew Cooper
2025-03-19 10:07 ` Jan Beulich
2025-03-19 14:16 ` Roger Pau Monné
2025-03-19 14:33 ` Jan Beulich
2025-03-18 17:35 ` [PATCH 3/7] xen: remove -N from the linker command line Roger Pau Monne
2025-03-18 17:53 ` Andrew Cooper
2025-03-19 10:20 ` Jan Beulich
2025-03-21 16:28 ` Oleksii Kurochko [this message]
2025-03-18 17:35 ` [PATCH 4/7] x86/boot: apply trampoline relocations at destination position Roger Pau Monne
2025-03-18 19:05 ` Frediano Ziglio
2025-03-18 19:17 ` Andrew Cooper
2025-03-19 12:00 ` Frediano Ziglio
2025-03-18 20:10 ` [PATCH] x86/boot: Untangle the trampoline copying/entry logic Andrew Cooper
2025-03-19 9:05 ` Roger Pau Monné
2025-03-20 13:59 ` Andrew Cooper
2025-03-18 20:14 ` [PATCH 4/7] x86/boot: apply trampoline relocations at destination position Andrew Cooper
2025-03-18 17:35 ` [PATCH 5/7] x86/mkreloc: remove warning about relocations to RO section Roger Pau Monne
2025-03-18 18:14 ` Andrew Cooper
2025-03-19 10:32 ` Jan Beulich
2025-03-19 10:46 ` Jan Beulich
2025-03-19 10:53 ` Jan Beulich
2025-03-20 8:14 ` Roger Pau Monné
2025-03-20 8:34 ` Jan Beulich
2025-03-20 9:53 ` Jan Beulich
2025-03-20 10:18 ` Jan Beulich
2025-03-20 11:00 ` Andrew Cooper
2025-03-20 11:11 ` Jan Beulich
2025-03-18 17:35 ` [PATCH 6/7] x86/efi: do not merge all .init sections Roger Pau Monne
2025-03-18 18:08 ` Andrew Cooper
2025-03-19 10:39 ` Jan Beulich
2025-03-18 17:35 ` [PATCH 7/7] xen/build: warn about RWX load segments Roger Pau Monne
2025-03-18 18:07 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9558d87f-582f-4e0f-ad2b-bb78e6e53f1e@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=bobbyeshleman@gmail.com \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sanastasio@raptorengineering.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.