public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Pavlu <petr.pavlu@suse.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
	nicolas@fjasle.eu, masahiroy@kernel.org,
	kirill.shutemov@linux.intel.com, tony.luck@intel.com,
	michael.roth@amd.com, ndesaulniers@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Avoid relocation information in final vmlinux
Date: Tue, 20 Sep 2022 11:01:10 +0200	[thread overview]
Message-ID: <f69770c3-e108-7968-e866-c1e85959aec5@suse.com> (raw)
In-Reply-To: <YyEU70K1aY8b/EXZ@dev-arch.thelio-3990X>

On 9/14/22 01:40, Nathan Chancellor wrote:
> [...]
>> diff --git a/arch/x86/Makefile.postlink b/arch/x86/Makefile.postlink
>> new file mode 100644
>> index 000000000000..4650aaf6d8b3
>> --- /dev/null
>> +++ b/arch/x86/Makefile.postlink
>> @@ -0,0 +1,41 @@
>> +# SPDX-License-Identifier: GPL-2.0
>> +# ===========================================================================
>> +# Post-link x86 pass
>> +# ===========================================================================
>> +#
>> +# 1. Separate relocations from vmlinux into vmlinux.relocs.
>> +# 2. Strip relocations from vmlinux.
>> +
>> +PHONY := __archpost
>> +__archpost:
>> +
>> +-include include/config/auto.conf
>> +include scripts/Kbuild.include
>> +
>> +CMD_RELOCS = arch/x86/tools/relocs
>> +quiet_cmd_relocs = RELOCS  $@.relocs
>> +      cmd_relocs = $(CMD_RELOCS) $@ > $@.relocs;$(CMD_RELOCS) --abs-relocs $@
>> +
>> +quiet_cmd_strip_relocs = RSTRIP  $@
>> +      cmd_strip_relocs = objcopy --remove-relocations='*' $@
> 
> Just a small drive by comment, prefer $(OBJCOPY) over objcopy so that
> the user's choice of objcopy is respected (such as llvm-objcopy).

Ok.

> Unfortunately, llvm-objcopy does not appear to support
> '--remove-relocations'. We can certainly file a feature request for this
> upstream but is there a way to accomplish this in a different way? Or
> perhaps this could be something that is controlled via Kconfig so it
> is only selectable with GNU objcopy??

An alternative is to use use --remove-section='.rel*' which has the same
effect.. or to be more careful, something as:
--remove-section='.rel.*' --remove-section='.rel__*' --remove-section='.rela.*' --remove-section='.rela__*'

Thanks,
Petr

      reply	other threads:[~2022-09-20  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 13:29 [PATCH] x86: Avoid relocation information in final vmlinux Petr Pavlu
2022-09-13 23:40 ` Nathan Chancellor
2022-09-20  9:01   ` Petr Pavlu [this message]

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=f69770c3-e108-7968-e866-c1e85959aec5@suse.com \
    --to=petr.pavlu@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox