Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Hajda, Andrzej" <andrzej.hajda@intel.com>
To: Jeff Dagenais <jeff.dagenais@gmail.com>, <igt-dev@lists.freedesktop.org>
Cc: Jeff Dagenais <jdagenais@tesla.com>
Subject: Re: [PATCH i-g-t] scripts/generate_iga64_codes: prevent objcopy from modifying the input file
Date: Mon, 4 Nov 2024 10:44:52 +0100	[thread overview]
Message-ID: <e7831c5f-1bc7-4919-8213-42e142afc521@intel.com> (raw)
In-Reply-To: <20241030184054.73065-1-jdagenais@tesla.com>

W dniu 30.10.2024 o 19:40, Jeff Dagenais pisze:
> This script uses objcopy in order to dump a section. Objcopy is meant
> for copying and expects a second argument. Failing that, it uses the
> input file as output. Even though there's no intented change to the
> file, this operation still re-writes the file completely.
> 
> In most cases, this re-writes the file as it was before. But in
> cross-compilation cases, the "objcopy" program in the PATH used here
> might be different than the toolchain which generated the ELF file.
> 
> In all cases, this causes a racy re-build of the .a, and in the worst
> case, the objcopy re-written .o and .a files are actually incompatible
> with the cross-linker used downstream in the ninja build causing failure
> to find all symbols from the libs passed to this script.
> 
> ```
> ../lib/intel_batchbuffer.c:763: undefined reference to
> `gen8_gpgpu_fillfunc'
> ../lib/intel_batchbuffer.c:762: undefined reference to
> `xehp_gpgpu_fillfunc'
> [...]
> ```
> 
> The intent of the command was just to extract info from the LIBS, not
> modify them. Using /dev/null as output file ensures the input files will
> not be modified.
> 
> Signed-off-by: Jeff Dagenais <jeff.dagenais@gmail.com>

Thx for the fix.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej

> ---
>   scripts/generate_iga64_codes | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/generate_iga64_codes b/scripts/generate_iga64_codes
> index d1e40b600..bbf1f7008 100755
> --- a/scripts/generate_iga64_codes
> +++ b/scripts/generate_iga64_codes
> @@ -37,7 +37,7 @@ ASMS=()
>   while  read -d $'\0' asm; do
>       test -z "$asm" && continue
>       ASMS+=( "$asm" )
> -done < <(for f in $LIBS; do objcopy --dump-section .iga64_assembly=/dev/stdout $f.p/*.o; done)
> +done < <(for f in $LIBS; do objcopy --dump-section .iga64_assembly=/dev/stdout $f.p/*.o /dev/null; done)
>   
>   # check if we need to recompile - checksum difference and compiler present
>   MD5_ASMS="$(md5sum <<< "${ASMS[@]}" | cut -b1-32)"


      parent reply	other threads:[~2024-11-04  9:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 18:40 [PATCH i-g-t] scripts/generate_iga64_codes: prevent objcopy from modifying the input file Jeff Dagenais
2024-10-31 16:51 ` Kamil Konieczny
2024-11-04  6:29 ` ✓ CI.xeBAT: success for " Patchwork
2024-11-04  6:39 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-11-05 16:32   ` Kamil Konieczny
2024-11-04  8:11 ` ✗ CI.xeFULL: " Patchwork
2024-11-05 16:30   ` Kamil Konieczny
2024-11-04  9:44 ` Hajda, Andrzej [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=e7831c5f-1bc7-4919-8213-42e142afc521@intel.com \
    --to=andrzej.hajda@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jdagenais@tesla.com \
    --cc=jeff.dagenais@gmail.com \
    /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