[cfe-dev] [Modules TS] feedback

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Fri May 12 09:54:39 PDT 2017


On Thu, May 11, 2017 at 11:18 PM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Hi David,
>
> David Blaikie <dblaikie at gmail.com> writes:
>
> >   -Xclang -fmodules-codegen
> >   -Xclang -fmodules-debuginfo
> >
> > [...]
> >
> > It should work naturally either way, I think.
>
> Yep, all works now, thanks.
>
> Somewhat related question: what happens if I pass -fPIC? I assume I
> will need different .o for PIC/non-PIC. Will I also need different
> .pcm files?
>
> I tend to think the answer is yes since at the minimum -fPIC may
> define preprocessor macros that may change the translation unit.
>

If a flag changes things like preprocessor macros then it would need to be
consistently passed to all stages (including the first one - that generates
the .pcm). I know Clang has some enforcement of matching flags between PCM
generation steps and uses (& hopefully that also triggers on the
PCM->Object step too, though I haven't checked).

I'm not sure how lenient those checks are (whether they have many false
positives (flagging mismatched flags that are benign/can be composed
without conflicting) or false negatives (allowing mismatched flags that are
incompatible))

Richard might be able to say more about that.

I think -O flags also generate preprocessor defines, so I expect they would
be checked/enforced by this too, and not possible to use a PCM built with a
different -O level than its use.


>
> I guess what I am trying to understand is if .pcm is just the AST
> or if it actually includes some object/intermediate code? For example,
> does it make sense to pass -O when generating .pcm? Sorry if these
> are stupid/obvious questions ;-).
>
>
> Thanks,
> Boris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170512/82b36bbf/attachment.html>


More information about the cfe-dev mailing list