-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix compile error #14202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix compile error #14202
Conversation
riscv-none-elf-ld: warning: /home/hujun5/downloads1/vela_sim/nuttx/nuttx has a LOAD segment with RWX permissions riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(riscv_modifyreg32.o): in function `spin_lock_irqsave_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:534:(.text.modifyreg32+0x1e): undefined reference to `this_cpu' riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(riscv_modifyreg32.o): in function `spin_unlock_irqrestore_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:701:(.text.modifyreg32+0x82): undefined reference to `this_cpu' riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(bl602_serial.o): in function `spin_lock_irqsave_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:534:(.text.up_putc+0x12): undefined reference to `this_cpu' riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(bl602_serial.o): in function `spin_unlock_irqrestore_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:701:(.text.up_putc+0x84): undefined reference to `this_cpu' riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libsched.a(irq_attach.o): in function `spin_lock_irqsave_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:534:(.text.irq_attach+0x26): undefined reference to `this_cpu' riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libsched.a(irq_attach.o):/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:701: more undefined references to `this_cpu' follow Signed-off-by: hujun5 <hujun5@xiaomi.com>
|
[Experimental Bot, please feedback here] The PR summary needs to be more descriptive. Here's a breakdown of the issues and how to improve the PR: Issues:
Improved PR Summary: ## Summary
This PR fixes a compile-time error encountered on the RISC-V architecture due to missing `this_cpu` symbol references within spinlock functions. The issue arises from the use of `spin_lock_irqsave_wo_note` and `spin_unlock_irqrestore_wo_note` in specific code paths where the `this_cpu` variable is not defined.
This PR resolves the issue by [briefly explain your solution, e.g., "ensuring the `this_cpu` definition is available in the affected files/modules" or "refactoring the code to avoid direct use of `this_cpu` in those specific instances."].
**Related Issue:** [If applicable, link to a NuttX issue]
## Impact
* **Is new feature added? Is existing feature changed?** No.
* **Impact on user (will user need to adapt to change)?** NO
* **Impact on build (will build process change)?** YES. This fixes a build error specifically affecting the RISC-V architecture.
* **Impact on hardware (will arch(s) / board(s) / driver(s) change)?** NO
* **Impact on documentation (is update required / provided)?** NO
* **Impact on security (any sort of implications)?** NO
* **Impact on compatibility (backward/forward/interoperability)?** NO
* **Anything else to consider?** N/A
## Testing
I confirm that changes are verified on the following setups:
* **Build Host:** [e.g., Ubuntu 20.04, GCC 10.2.1]
* **Target:** [e.g., RISC-V simulator, QEMU, specific RISC-V board:config]
**Testing logs before change:**
[Paste relevant log snippet showing the compile errors] [Paste relevant log snippet showing successful compilation] Key Points:
|
| int me; | ||
|
|
||
| #ifdef CONFIG_SMP | ||
| me = up_cpu_index(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
define the up cupu index to zero when not in SMP mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up_cpu_index may not zero when in AMP mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
fix compile error
riscv-none-elf-ld: warning: /home/hujun5/downloads1/vela_sim/nuttx/nuttx has a LOAD segment with RWX permissions
riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(riscv_modifyreg32.o): in function
spin_lock_irqsave_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:534:(.text.modifyreg32+0x1e): undefined reference tothis_cpu'riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(riscv_modifyreg32.o): in function
spin_unlock_irqrestore_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:701:(.text.modifyreg32+0x82): undefined reference tothis_cpu'riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(bl602_serial.o): in function
spin_lock_irqsave_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:534:(.text.up_putc+0x12): undefined reference tothis_cpu'riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libarch.a(bl602_serial.o): in function
spin_unlock_irqrestore_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:701:(.text.up_putc+0x84): undefined reference tothis_cpu'riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libsched.a(irq_attach.o): in function
spin_lock_irqsave_wo_note': /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:534:(.text.irq_attach+0x26): undefined reference tothis_cpu'riscv-none-elf-ld: /home/hujun5/downloads1/vela_sim/nuttx/staging/libsched.a(irq_attach.o):/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:701: more undefined references to `this_cpu' follow
Impact
none
Testing
ci