Closed mshockwave closed 3 years ago
cc @jcai19 who was just looking into the .ascii
directive.
@mshockwave can you test https://reviews.llvm.org/D91460 or ensure you tested with that commit?
Also, @mshockwave can you preprocess the file for a reduced test case? make CC=clang <path/to/file.i>
should work.
This is still reproducible:
CC scripts/mod/devicetable-offsets.s
scripts/mod/devicetable-offsets.c:11:2: error: invalid operand in inline asm: '.ascii "->SIZE_usb_device_id $0 sizeof(struct usb_device_id)"'
DEVID(usb_device_id);
^
scripts/mod/devicetable-offsets.c:5:22: note: expanded from macro 'DEVID'
#define DEVID(devid) DEFINE(SIZE_##devid, sizeof(struct devid))
^
./include/linux/kbuild.h:6:15: note: expanded from macro 'DEFINE'
asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
^
scripts/mod/devicetable-offsets.c:12:2: error: invalid operand in inline asm: '.ascii "->OFF_usb_device_id_match_flags $0 offsetof(struct usb_device_id, match_flags)"'
DEVID_FIELD(usb_device_id, match_flags);
^
scripts/mod/devicetable-offsets.c:7:2: note: expanded from macro 'DEVID_FIELD'
DEFINE(OFF_##devid##_##field, offsetof(struct devid, field))
Strangely, I cannot create the pre-processed source in this case:
glaubitz@node54:/data/home/glaubitz/linux> ARCH=m68k CROSS_COMPILE=m68k-suse-linux- make CC=clang scripts/mod/devicetable-offsets.i
glaubitz@node54:/data/home/glaubitz/linux> find . -name devicetable-offsets.i
glaubitz@node54:/data/home/glaubitz/linux>
$ clang --target=m68k-linux-gnu foo.c
struct usb_device_id { int foo; };
void bar(void) {
asm volatile("\n.ascii \"->" "SIZE_usb_device_id" " %0 " "sizeof(struct usb_device_id)" "\"" : : "i" (sizeof(struct usb_device_id)));
}
struct usb_device_id { int foo; };
void bar(void) {
asm volatile("\n.ascii \"foo\"" : : "i" (sizeof(struct usb_device_id)));
}
works, so it must be the %0
. Yeah:
struct usb_device_id { int foo; };
void bar(void) {
asm volatile("; %0" : : "i" (sizeof(struct usb_device_id)));
}
Patch for this issue is on Phab now: https://reviews.llvm.org/D102585 Feel free to make yourself a reviewer :-)
When cross compile with m68k:
A tons of error messages similar to the one below were thrown from
scripts/mod/devicetable-offsets.c
:This might be caused by the fact that the current M68k LLVM assembler can't handle the
$0
placeholder or even theascii
directive properly.