public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "HON  LUU" <hon@dreambigsemi.com>
To: "gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: gcc question
Date: Wed, 8 Sep 2021 15:06:54 +0000	[thread overview]
Message-ID: <DB6PR02MB3111B61150346E2A307E4B13DDD49@DB6PR02MB3111.eurprd02.prod.outlook.com> (raw)

Hi,

I work on a project, that want to reuse device driver code in user space environment. The reason being that all RTL simulation, will be running on user space, but a portion of device driver code has a c-model which is served as “functional model” of corresponding RTL. We would like to device driver code unmodified in our RTL simulation/verification environment.

To achieve the goal, I set out to do the following:
     + Compile my device driver code using kernel KBuild system with V=1 to get gcc commands from the system for all my .c files
           Make V=1 -C /lib/modules/`uname -r`/build M=$(PWD) modules  ## the build completed without any issues, as expected.
     + For each gcc command for a .c files, I removed “-mcmodel=kernel -fno-PIE” and added “-fPIC”
           Orig:   gcc -Wp,-MD,/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/.cdev.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated   -I./include/drm-backport -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -DCONFIG_TPAUSE=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -D__READ_ONCE_DEFINED__ -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall -Werror -DRHEL8SP5 -DRHEL8 -DKERNEL_HAS_KCONFIG_H -DKERNEL_HAS_EXPORT_H -DDEBUGFS -I/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_access -I/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma -DKERNEL_193 -I/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/include -I/lib/modules/4.18.0-338.el8.x86_64/source/include -I.  -DMODULE  -DKBUILD_BASENAME='"cdev"' -DKBUILD_MODNAME='"qdma"' -c -o /home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/.tmp_cdev.o /home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/cdev.c
            Changed: :   gcc -Wp,-MD,/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/.cdev.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated   -I./include/drm-backport -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fPIC -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -DCONFIG_TPAUSE=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -D__READ_ONCE_DEFINED__ -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall -Werror -DRHEL8SP5 -DRHEL8 -DKERNEL_HAS_KCONFIG_H -DKERNEL_HAS_EXPORT_H -DDEBUGFS -I/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma/qdma_access -I/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/libqdma -DKERNEL_193 -I/home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/include -I/lib/modules/4.18.0-338.el8.x86_64/source/include -I.  -DMODULE  -DKBUILD_BASENAME='"cdev"' -DKBUILD_MODNAME='"qdma"' -c -o /home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/.tmp_cdev.o /home/hon/work/FPGA-Driver-Software/components/nic/linux/driver/external/dma_ip_drivers/QDMA/linux-kernel/drv/cdev.c
      + The modified gcc command did not compile. The error message would look like this.
In file included from ././include/linux/compiler_types.h:58,
                 from <command-line>:
./arch/x86/include/asm/jump_label.h: In function ‘unmap_user_buf.part.3’:
./include/linux/compiler-gcc.h:305:38: error: asm operand 0 probably doesn’t match constraints [-Werror]
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                      ^~~
./arch/x86/include/asm/jump_label.h:38:2: note: in expansion of macro ‘asm_volatile_goto’
  asm_volatile_goto("1:"
  ^~~~~~~~~~~~~~~~~
./include/linux/compiler-gcc.h:305:38: error: impossible constraint in ‘asm’
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                      ^~~
./arch/x86/include/asm/jump_label.h:38:2: note: in expansion of macro ‘asm_volatile_goto’
  asm_volatile_goto("1:"
  ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:55: /home/hon/work/highlandrv/cosim.new/external/dma_ip_drivers/QDMA/linux-kernel/drv/cdev.o] Error 1


I googled it quite a bit, but don’t know how to fix the error. I hope someone would give me a hint what went wrong and how to fix it, or point me to a right direction.

I appreciated your help and precious time.

Regards,
Hon
hon@dreambigsemi.com<mailto:hon@dreambigsemi.com>


             reply	other threads:[~2021-09-08 15:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 15:06 HON  LUU [this message]
2021-09-08 16:20 ` Segher Boessenkool
2021-09-08 16:26   ` HON  LUU
2021-09-08 16:27   ` HON  LUU
2021-09-08 17:05   ` HON  LUU
2021-09-08 23:13     ` HON  LUU
2021-09-10 17:58       ` HON  LUU
2021-09-10 18:36         ` Segher Boessenkool
2021-09-11 21:08           ` HON  LUU
2021-09-13 19:10             ` HON  LUU
2021-09-13 19:22             ` Florian Weimer
2021-09-13 19:40               ` HON  LUU
2021-09-13 19:42                 ` Florian Weimer
2021-09-13 19:50                   ` HON  LUU
2021-09-13 19:51                     ` Florian Weimer
2021-09-13 19:52                       ` HON  LUU
2021-09-13 19:42                 ` HON  LUU
  -- strict thread matches above, loose matches on Subject: below --
2006-02-26 22:53 Brendan Darrer
2006-02-26 23:52 ` Ernest L. Williams Jr.
2006-02-27 15:29 ` Brian Budge
2002-06-12  9:29 j y
2002-06-12 11:16 ` Shawn Starr
2001-07-20  4:35 Steve Kieu
2000-08-13 19:34 tao tong
2000-04-10  7:46 GCC question Gibson, Terry
2000-04-10  8:12 ` Alexandre Oliva
2000-01-06 15:46 Black, Christopher T
2000-04-01  0:00 ` Black, Christopher T
     [not found] <947048956.20674.ezmlm@gcc.gnu.org>
2000-01-04 21:22 ` John Ratcliff
2000-04-01  0:00   ` John Ratcliff

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=DB6PR02MB3111B61150346E2A307E4B13DDD49@DB6PR02MB3111.eurprd02.prod.outlook.com \
    --to=hon@dreambigsemi.com \
    --cc=gcc-help@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).