[clang] [Clang][z/OS] Add CSECT option and pragma (PR #234368)

Maryam Moghadas via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 13:59:46 PST 2026


maryammo wrote:

> > > > Add -mcsect[=]/-mno-csect and #pragma csect(code|static, "name") for z/OS. Clang emits the CSECT names as zos_csect_code/zos_csect_static module flags; backend support will follow in a separate patch.
> > > 
> > > 
> > > What's the actual difference between `-mcsect` (no qualifier) and `-mno-csect`? I see that with `-mno-csect` you do not provide the module flags, but the back-end will still choose a section name, and that seems to be the same as when using `-mcsect` without qualifier. Am I missing something here?
> > 
> > 
> > They can differ when the output and source file names differ. With `-mno-csect`, the backend uses the source file name. With `-mcsect`, the output file name is used. `main.c -o bar` gives `main#C` with `-mno-csect` and `bar#C` with `-mcsect`.
> 
> I see, thanks. Might be good to have that explained in the documentation.

My earlier answer is out of date. In this [commit](https://github.com/llvm/llvm-project/pull/238830/changes/83f769fa4fb5d3dab6d8ad54ef00551c8ebb8871) I changed `-mno-csect` to use a single space as the CSECT name instead of the source file name, compatible with the XL compilers. So `-mno-csect` and `-mcsect` now differ: `-mno-csect` gives a single space, and `-mcsect` gives `<output file>#C` and `#S`.

https://github.com/llvm/llvm-project/pull/234368


More information about the cfe-commits mailing list