Skip to content

Toolchain independence#717

Draft
wom-bat wants to merge 10 commits into
mainfrom
toolchain_independence
Draft

Toolchain independence#717
wom-bat wants to merge 10 commits into
mainfrom
toolchain_independence

Conversation

@wom-bat

@wom-bat wom-bat commented May 8, 2026

Copy link
Copy Markdown
Contributor

Make sddf build more independent of toolchain.
-- fix warnings from gcc
-- improve common.mk so switching toolchains actually rebuilds things

@wom-bat
wom-bat marked this pull request as draft May 8, 2026 01:05

REBUILD_CANDIDATE_OBJECTS := $(shell find . -name '*.o')
${REBUILD_CANDIDATE_OBJECTS): .EXTRA_PREREQS = ${CHECK_FLAGS_BOARD_HASH}
.EXTRA_PREREQS = ${CHECK_FLAGS_BOARD_HASH}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI Peter: #715. (I suspect this might be the BSD make instead of GNU make thing again? IDK)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be; I will check this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use so many GNUmake idioms I'd be surprised if BSD make builds the system at all.

@midnightveil midnightveil May 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to make make error if it's not GNUmake? That would solve this as well, I think. (I do recall us decided that we basically need GNUmake: our CI needs it explicitly)

@midnightveil midnightveil May 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction: macOS default is GNUmake 3.8, from 2006...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this up @midnightveil . @wom-bat Could you please review/consider merging my PR #715 ? I understand that in general we may not want to worry about supporting super old versions of make, however:

  1. We do not explicitly document that a certain version of make is required anywhere, and in this particular case the use of the .EXTRA_PREREQS variable just fails silently (or creates an unused variable), which is dangerous when it comes to dependency tracking.

  2. As I describe in my PR, I don't think there are any benefits of using .EXTRA_PREREQS here. common.mk does not contain any compilation rules for object files, and since automatic variable expansions only contain dependencies declared in the same file, there is no risk of the board cflags file being accidentally included in the compilation rules declared in other makefiles.commands.

Comment thread examples/blk/blk.mk


IMAGES := blk_driver.elf client.elf blk_virt.elf serial_virt_tx.elf serial_driver.elf
CFLAGS += -Wall -Wno-unused-function -Werror -Wno-unused-command-line-argument \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand wanting to remove these disabled warnings but it has nothing to do with GCC vs Clang... These should be separate commits not squished in with the rest silently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is GCC-versus clang ... the arguments are not available for gcc, and the warnings they suppress need to be fixed in-line in the code instead.

@midnightveil midnightveil May 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCC doesn't support -Wno-unused-function? but it says it does: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-function (and I'm pretty sure these pre-date clang-as-default).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Wunused-command-line-argument is the one it doesn't seem to accept... and if we can get rid of them, let's go ...

@wom-bat
wom-bat force-pushed the toolchain_independence branch 3 times, most recently from 55be0f0 to e017a3e Compare May 12, 2026 23:53
wom-bat added 9 commits May 13, 2026 09:54
Gcc complains about a multi-line // comment.  Fix it.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
GCC complained about an unused variable: remove it.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
This means we can get of the -Wno-unused-function compiler arg that is
unrecognised by GCC.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Extend the board-hash to include TOOLCHAIN and make it so *everything*
depends on it.
Make clang the default toolchain
Allow parent Makefiles to add to the flags depended on.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Extends flags with NVME and PARTITION so changing them forces a
rebuild.
Passes down Makefile flags to submake.
Reformat slightly for clarity

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
This allows compilation ... there are some debug print helper
functions in a block.h header file.
 -- Mark them inline so they don't get expanded if not used
 -- Mark them __attribute__((unused) to make sure the compiler doesn't
    complain.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
to make the style checker happy.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
in mmio.c -- clang complains about unused functions.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Fix style in timer/apb_timer/timer.c blk/mmc/imx/usdhc.c and Makefiles

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
@wom-bat
wom-bat force-pushed the toolchain_independence branch from e017a3e to 2bb2ae4 Compare May 12, 2026 23:54
Comment thread examples/blk/blk.mk Outdated
This is now set in common.mk.

Signed-off-by: Peter Chubb <Peter.Chubb@unsw.edu.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants