non-zero O_TEXT for open syscall for Linux binaries (not source)

From: Paul Edwards
Date: Mon Feb 26 2024 - 05:03:37 EST


(I would like to be cced to email if possible)

Hello.

I would like to construct some custom Linux (not other-system)
binaries that are intended to run on both a genuine Linux x86
system and a non-Linux system where CRLF is used for line
endings of text (not binary) files. When the Linux binary is run
on a genuine Linux system, the line ending is expected to be
just LF - as now.

I believe I have everything in place to begin the construction
of the non-Linux system.

The non-Linux system is not intended to claim POSIX-compliance,
and will just run certain carefully-constructed Linux binaries that
do direct syscalls (no shared libraries are used). I have control
of a C library that will do this. There are other ways to kludge
conditional execution, but the neatest solution is an official
O_TEXT (for the same reason that Cygwin created one -
giving prior art).

I can actually go ahead and do this myself by just defining
O_TEXT to 0x8000 0000 - and it will be a long time - if
ever - before Linux uses this bit for an open flag for
something else.

Another option would be to define O_TEXT to the same as
O_NOATIME as I don't care if my text files (only) on Linux
don't get the access time set, but the binary ones all do.
The non-Linux system would in turn be forever unable to
do anything with the access time - but that doesn't bother me
much. Another flag could be used instead though, that has
even less impact (any suggestions?).

But the neatest option is to get an official flag for Linux.

It's not enough to get POSIX updated either, as Linux can
simply set O_TEXT to 0 to satisfy the POSIX requirements.

So it is Linux that matters.

Any suggestions before I go ahead with proof of concept?

Thanks. Paul.