linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Vegard Nossum <vegard.nossum@oracle.com>,
	Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	linux-um@lists.infradead.org, bpf@vger.kernel.org,
	llvm@lists.linux.dev, Vegard Nossum <vegard.nossum@oracle.com>
Subject: Re: [PATCH] kbuild: use objcopy to generate asm-offsets
Date: Tue, 03 Sep 2024 09:45:11 +1000	[thread overview]
Message-ID: <875xrd7h88.fsf@mail.lhotse> (raw)
In-Reply-To: <20240828083605.3093701-1-vegard.nossum@oracle.com>

Vegard Nossum <vegard.nossum@oracle.com> writes:
> In order to give assembly code access to C structs without having to
> hardcore member offsets, the kernel compiles a C source file listing all
> the structs and offsets that are needed in assembly code. Using some
> C preprocessor trickery and a sed script, the compiled assembly code is
> turned back into C preprocessor code that in turn can be used by the
> asssembly code.
>
> This sed script is very hard to read and understand.
>
> Remove the sed script and compile the C source listing structs and
> offsets to an object file (instead of assembly code) that embeds C source
> directly. Then extract the C source using objcopy.
>

I threw some builders at this and hit a few errors:

parisc:
  # make -s -j 160 ARCH=parisc64 O=/kisskb/build/mpe_generic-64bit_defconfig_parisc64-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/hppa-linux/bin/hppa64-linux-  
  {standard input}: Assembler messages:
  {standard input}: Error: .size expression for main does not evaluate to a constant
  make[3]: *** [/kisskb/src/scripts/Makefile.build:244: scripts/mod/devicetable-offsets.o] Error 1

s390:
  # make -s -j 32 ARCH=s390 O=/kisskb/build/mpe_defconfig_s390x-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/s390-linux/bin/s390-linux-  
  In file included from /kisskb/src/arch/s390/include/asm/ptrace.h:11,
                   from /kisskb/src/arch/s390/kernel/vdso64/vdso_user_wrapper.S:7:
  /kisskb/src/arch/s390/include/uapi/asm/ptrace.h:167: warning: "STACK_FRAME_OVERHEAD" redefined
    167 | #define STACK_FRAME_OVERHEAD    160      /* size of minimum stack frame */
        | 
  In file included from /kisskb/src/include/asm-generic/asm-offsets.h:1,
                   from ./arch/s390/include/generated/asm/asm-offsets.h:1,
                   from /kisskb/src/arch/s390/kernel/vdso64/vdso_user_wrapper.S:5:
  ./include/generated/asm-offsets.h:51: note: this is the location of the previous definition
     51 | #define STACK_FRAME_OVERHEAD -96 /* sizeof(struct stack_frame) */

mips:
  # make -s -j 32 ARCH=mips O=/kisskb/build/mpe_defconfig_mips-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/mips-linux/bin/mips-linux-  
  {standard input}: Assembler messages:
  {standard input}:27: Error: junk at end of line, first unrecognized character is `M'
  {standard input}:212: Error: junk at end of line, first unrecognized character is `M'
  {standard input}:265: Error: junk at end of line, first unrecognized character is `M'
  {standard input}:338: Error: junk at end of line, first unrecognized character is `M'
  {standard input}:596: Error: junk at end of line, first unrecognized character is `S'
  {standard input}:608: Error: junk at end of line, first unrecognized character is `L'
  {standard input}:721: Error: junk at end of line, first unrecognized character is `L'
  {standard input}:806: Error: junk at end of line, first unrecognized character is `L'
  {standard input}:963: Error: junk at end of line, first unrecognized character is `P'
  {standard input}:996: Error: junk at end of line, first unrecognized character is `K'
  {standard input}:1161: Error: junk at end of line, first unrecognized character is `M'
  make[3]: *** [/kisskb/src/scripts/Makefile.build:244: arch/mips/kernel/asm-offsets.o] Error 1

riscv:
  # make -s -j 160 ARCH=riscv O=/kisskb/build/mpe_defconfig_riscv-gcc13 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-  
  In file included from /kisskb/src/arch/riscv/kernel/asm-offsets.c:9:
  /kisskb/src/arch/riscv/kernel/asm-offsets.c: In function 'asm_offsets':
  /kisskb/src/include/linux/kbuild.h:6:9: error: invalid 'asm': invalid use of '%c'
      6 |         asm volatile( \
        |         ^~~
  /kisskb/src/include/linux/kbuild.h:12:9: note: in expansion of macro '_LINE'
     12 |         _LINE("#define " #sym " %c0 /* " #val " */", "i" (val))
        |         ^~~~~
  /kisskb/src/include/linux/kbuild.h:15:9: note: in expansion of macro 'DEFINE'
     15 |         DEFINE(sym, offsetof(struct str, mem))
        |         ^~~~~~
  /kisskb/src/arch/riscv/kernel/asm-offsets.c:25:9: note: in expansion of macro 'OFFSET'
     25 |         OFFSET(TASK_THREAD_RA, task_struct, thread.ra);
        |         ^~~~~~
  /kisskb/src/include/linux/kbuild.h:6:9: error: invalid 'asm': invalid use of '%c'
      6 |         asm volatile( \
        |         ^~~


Full list here, but note there are some unrelated pre-existing failures:
  http://kisskb.ellerman.id.au/kisskb/head/259bba3447faaf5e5b12ae41a26a62978d4c1965/


cheers


  parent reply	other threads:[~2024-09-02 23:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28  8:36 [PATCH] kbuild: use objcopy to generate asm-offsets Vegard Nossum
2024-08-28 10:07 ` Vegard Nossum
2024-08-29 14:58 ` kernel test robot
2024-08-29 15:50 ` kernel test robot
2024-08-29 20:37 ` kernel test robot
2024-09-02 23:45 ` Michael Ellerman [this message]
2024-09-03  7:20   ` Vegard Nossum
2024-09-03  9:28     ` Masahiro Yamada

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=875xrd7h88.fsf@mail.lhotse \
    --to=mpe@ellerman.id.au \
    --cc=bpf@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=vegard.nossum@oracle.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;
as well as URLs for NNTP newsgroup(s).