Re: [PATCH] kbuild: use objcopy to generate asm-offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vegard Nossum <vegard.nossum@xxxxxxxxxx> 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




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux