bazelbuild/platforms

Define a value for "no OS"?

UlrichEckhardt opened this issue · 3 comments

Hello!

I'm working on embedded code which does not run with any OS underneath (on "bare metal"). My initial thought was to specifiy "OS=none" or something like that. What do you think of adding such a constant?

One issue I see is that it looks like it is not really a constraint, rather the opposite thereof. On the other hand, bare metal means direct access to device registers and similar things that the OS prevents normally. Interestingly, compiling an OS kernel itself would be one example of a program that requires this.

Thoughts? Ideas? Concerns?

Uli

aiuto commented

This needs some thought to find a real compelling use case.
For the most part, a select would pick up none in //conditions:default.
I also have a hunch that people compiling an OS might actually define the target os as their OS. Imagine the Mach kernel being used in MacOS or vanilla Mach.

Looks like this already exists!

platforms/os/BUILD

Lines 52 to 55 in 3fbc687

constraint_value(
name = "none",
constraint_setting = ":os",
)

Not sure why I missed this, thanks to @cpsauer for pointing this out. I think it might have been that I was using an older version of Bazel, because the company I worked for had this contstraint.

Anyway, no need to keep this open.