Makefile: fix support checks that use grep
Status from this message: Applied this series to the riscv/opensbi repo.
Get series with b4
b4 am [email protected] change-id 20260909-makefile_extension_grep-4f9fcea894cdVersions newest first
- v2 Latest3 patches 1 replyApplied
- v13 patches 3 repliesSuperseded
Changes in v2 from the cover letter
- Rebased onto latest master, removed old CC (their changes merged
already), no functional changes
- Link to v1: https://patch.msgid.link/[email protected]
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | Makefile: don't grep when setting CC_SUPPORT_ZICSR_ZIFENCEIMakefile | +1 | 0 replies | |
| 2/3 | Makefile: don't grep when setting CC_SUPPORT_STRICT_ALIGNMakefile | +1 | 0 replies | |
| 3/3 | Makefile: don't grep when setting CC_SUPPORT_SAVE_RESTOREMakefile | +1 | 0 replies |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Anup Patel |
|---|---|
| Series | R-b |
| 1/3 | |
| 2/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/3] Makefile: fix support checks that use grep
When building OpenSBI in environments where extensions from the ISA are used to generate build paths (e.g. Yocto Project), the Makefile checks which use grep to look for patterns can incorrectly match against the build paths, rather than the command's exit status. This means a workaround is needed to handle checking for extensions like zicsr and zifencei. Instead, make the following variable assignments use the same exit status pattern as OPENSBI_LD_PIE:
CC_SUPPORT_ZICSR_ZIFENCEICC_SUPPORT_STRICT_ALIGNCC_SUPPORT_SAVE_RESTORE
Tested by building a full image in Yocto including OpenSBI and booting it in QEMU.
Note that only the first patch (for CC_SUPPORT_ZICSR_ZIFENCEI) is needed to fix the Yocto QEMU case, but I've submitted the remaining two for consistency. Also since submitting the first version of this series two additional uses of grep have appeared in the Makefile, but I've opted not to change them since they don't appear to result in the same issue observed in Yocto.
See also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15897
As an example, in my Yocto build environment, values like CC for OpenSBI are set like:
|export CC="riscv64-poky-linux-gcc -march=rv64imafdc_zicsr_zifencei -mabi=lp64d -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,relro,-z,now -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/tgamblin/workspace/ypbuilds/poky-qemuriscv64/build/tmp/work/riscv64imafdc_zicsr_zifencei-poky-linux/opensbi/1.9/recipe-sysroot"
and the build error:
| /tmp/ccnpajj3.s: Assembler messages: | /home/tgamblin/workspace/ypbuilds/poky-qemuriscv64/build/tmp/work/riscv64imafdc_zicsr_zifencei-poky-linux/opensbi/1.9/sources/opensbi-1.9/lib/sbi/sbi_tlb.c:176: | Error: unrecognized opcode `fence.i', extension `zifencei' required
Checking the exit status directly avoids a positive match as happens with grep.
---
Changes in v2:
- Rebased onto latest master, removed old CC (their changes merged
already), no functional changes
- Link to v1: https://patch.msgid.link/[email protected]
---
Trevor Gamblin (3):
Makefile: don't grep when setting CC_SUPPORT_ZICSR_ZIFENCEI
Makefile: don't grep when setting CC_SUPPORT_STRICT_ALIGN
Makefile: don't grep when setting CC_SUPPORT_SAVE_RESTORE
Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 5a175017261af97e9122fcb9d9012481cdb5aa41
change-id: 20260909-makefile_extension_grep-4f9fcea894cd
Best regards,
Signature · 7 lines
Trevor Gamblin <[email protected]> -- opensbi mailing list [email protected] http://lists.infradead.org/mailman/listinfo/opensbi