IBM Z and LinuxONE Languages

Languages

Languages

Broad range of supported development languages and tools allows to transform software delivery practices.

 View Only
  • 1.  Metal C ARMODE compiler option

    Posted Thu May 21, 2020 02:49 AM
    Edited by FANG LU Thu May 21, 2020 10:30 PM
    Disclaimer: This post is migrated from IBM Developer Answers that is no longer in use. Its original author is javapaul , posted on Oct. 30, 2018.

    Metal C ARMODE compiler option is generating code that stays in ARMODE when calling external functions that are not ARMODE. That makes the option useless to me unless there is a way around this. I cannot change the headers in the external functions to specify NOARMODE. Without the ARMODE option I cannot detect at compile time if it is ARMODE in my epilog and prolog code using the global symbol &CCN_ASCM.


    -----------------------------------------------------
    Question asked by javapaul on Oct. 30, 2018
    -----------------------------------------------------


  • 2.  RE: Metal C ARMODE compiler option

    Posted Thu May 21, 2020 02:50 AM
    Edited by FANG LU Thu May 21, 2020 03:03 AM

    You should be able to specify the attribute that turns off ARMODE for a given function. Here is the relevant text in the Metal C Programming Guide that describes it:

    To override the effect of the ARMODE option and selectively re-set particular
    functions to be in non-AR mode (or primary address space control mode), use
    __attribute__((noarmode)). For more information on this attribute, see armode |
    noarmode type attribute (C only) and z/OS Metal C Programming Guide and
    Reference.
    When NOARMODE is in effect, functions are not in AR mode unless
    __attribute__((armode)) is specifically specified for the functions.


    ----------------------------------------------
    Answered by dinoxlc on Oct. 30, 2018
    ----------------------------------------------



  • 3.  RE: Metal C ARMODE compiler option

    Posted Thu May 21, 2020 02:51 AM
    Edited by FANG LU Thu May 21, 2020 03:04 AM
    Yes, I already know that. That works fine for internal functions that I want to run NOARMODE. The problem is that it's calling external functions, in separate source modules, in ARMODE. I don't think it should be doing that. I have no control over those modules. It would be completely impractical to modify all of those prototypes to be NOARMODE.

    -------------------------------------------
    Replied by javapaul on Oct. 31,  2018
    -------------------------------------------



  • 4.  RE: Metal C ARMODE compiler option

    Posted Thu May 21, 2020 02:51 AM
    Edited by FANG LU Thu May 21, 2020 03:05 AM
    Is compiling with -qnoarmode and then adding __attribute__((armode)) for each function that has to run in ARMODE something that might work for you?

    -----------------------------------------------------
    Answered by Nicole Trudeau on Nov. 1, 2018
    -----------------------------------------------------



  • 5.  RE: Metal C ARMODE compiler option

    Posted Thu May 21, 2020 02:51 AM
    Edited by FANG LU Thu May 21, 2020 03:06 AM
    Yes, that is what I am doing to get around it. I still think the compiler is incorrect but I can get around the problem so I'm moving on. It makes no sense for the compiler to assume that because one piece of source code is ARMODE then everything it calls is ARMODE by default.

    -------------------------------------------
    Replied by javapaul on Nov. 1,  2018
    --------------------------------------------



  • 6.  RE: Metal C ARMODE compiler option

    Posted Thu May 21, 2020 02:52 AM
    Edited by FANG LU Thu May 21, 2020 03:07 AM
    I think you're looking for global symbols such as &CCN_ASCM but without having to specify the ARMODE option because it forces the ARMODE on all functions. Unfortunately, this cannot be done today. Perhaps these symbols should be emitted even without the ARMODE option if __attribute((armode)) is encountered in the source. Please open a Request for Enhancement (RFE) if you'd like to see this functionality to be considered for a future release.

    ----------------------------------------------------
    Answered by Nicole Trudeau on Nov. 5, 2018
    ----------------------------------------------------