All of lore.kernel.org
 help / color / mirror / Atom feed
* EXTRA_CFLAGS when compiling Xen
@ 2016-02-17 10:19 Corneliu ZUZU
  2016-02-17 10:23 ` Razvan Cojocaru
  2016-02-17 10:34 ` Jan Beulich
  0 siblings, 2 replies; 10+ messages in thread
From: Corneliu ZUZU @ 2016-02-17 10:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Stefano Stabellini, Jan Beulich

Hi all,

Could anyone tell me if and how I could pass some GCC extra compilation flags when building Xen (i.e. make dist-xen)?
I tried:
* when running make: passing EXTRA_CFLAGS
* when running make: passing CFLAGS (this "works" but overrides the rest of the CFLAGS)
* when running ./configure: passing --extra-cflags.
None works.

Is there an established modality for this or must I manually modify the makefiles?
The reason I need this is to pass '-save-temps' to GCC, I want to inspect some code
and it would be easier to do that on the preprocessed files.

Thank you,
Corneliu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 10:19 EXTRA_CFLAGS when compiling Xen Corneliu ZUZU
@ 2016-02-17 10:23 ` Razvan Cojocaru
  2016-02-17 10:34   ` Corneliu ZUZU
  2016-02-17 10:34 ` Jan Beulich
  1 sibling, 1 reply; 10+ messages in thread
From: Razvan Cojocaru @ 2016-02-17 10:23 UTC (permalink / raw)
  To: Corneliu ZUZU, Xen-devel
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Andrew Cooper,
	Stefano Stabellini, Jan Beulich

> Could anyone tell me if and how I could pass some GCC extra compilation
> flags when building Xen (i.e. make dist-xen)?
> I tried:
> * when running make: passing EXTRA_CFLAGS
> * when running make: passing CFLAGS (this "works" but overrides the rest
> of the CFLAGS)
> * when running ./configure: passing --extra-cflags.
> None works.
> 
> Is there an established modality for this or must I manually modify the
> makefiles?
> The reason I need this is to pass '-save-temps' to GCC, I want to
> inspect some code
> and it would be easier to do that on the preprocessed files.

Does editing Config.mk not work?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 10:19 EXTRA_CFLAGS when compiling Xen Corneliu ZUZU
  2016-02-17 10:23 ` Razvan Cojocaru
@ 2016-02-17 10:34 ` Jan Beulich
  2016-02-17 12:09   ` Corneliu ZUZU
  1 sibling, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2016-02-17 10:34 UTC (permalink / raw)
  To: Corneliu ZUZU
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini

>>> On 17.02.16 at 11:19, <czuzu@bitdefender.com> wrote:
> Could anyone tell me if and how I could pass some GCC extra compilation 
> flags when building Xen (i.e. make dist-xen)?
> I tried:
> * when running make: passing EXTRA_CFLAGS
> * when running make: passing CFLAGS (this "works" but overrides the rest of the CFLAGS)
> * when running ./configure: passing --extra-cflags.
> None works.
> 
> Is there an established modality for this or must I manually modify the 
> makefiles?

Generally we'd rather avoid making it too easy to override the
compiler settings, in order to avoid then getting complaints
about things not building / working. Nevertheless I was of the
opinion that someone (was it Olaf) had added some way to do
such overrides. But ...

> The reason I need this is to pass '-save-temps' to GCC, I want to inspect 
> some code
> and it would be easier to do that on the preprocessed files.

... there's absolutely no need to for a case like this, at least as
long as the xen/ subtree is where you want to do this.
xen/Rules.mk has rules for what you want (and also for
producing the intermediate assembly file), just that you can't
achieve this by invoking make from the top level directory -
you need to run make directly in xen/ and manually specify
the intended target (including leading sub-directories).

Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 10:23 ` Razvan Cojocaru
@ 2016-02-17 10:34   ` Corneliu ZUZU
  0 siblings, 0 replies; 10+ messages in thread
From: Corneliu ZUZU @ 2016-02-17 10:34 UTC (permalink / raw)
  To: Razvan Cojocaru, Xen-devel
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Andrew Cooper,
	Stefano Stabellini, Jan Beulich

On 2/17/2016 12:23 PM, Razvan Cojocaru wrote:
>> Could anyone tell me if and how I could pass some GCC extra compilation
>> flags when building Xen (i.e. make dist-xen)?
>> I tried:
>> * when running make: passing EXTRA_CFLAGS
>> * when running make: passing CFLAGS (this "works" but overrides the rest
>> of the CFLAGS)
>> * when running ./configure: passing --extra-cflags.
>> None works.
>>
>> Is there an established modality for this or must I manually modify the
>> makefiles?
>> The reason I need this is to pass '-save-temps' to GCC, I want to
>> inspect some code
>> and it would be easier to do that on the preprocessed files.
> Does editing Config.mk not work?

I was wondering also if there is a "proper" way to do that, but that 
easily does the job, thanks.

For whoever else needs this, I simply added CFLAGS += -save-temps=obj in 
Config.mk (see similar "CFLAGS +=" lines).

Corneliu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 10:34 ` Jan Beulich
@ 2016-02-17 12:09   ` Corneliu ZUZU
  2016-02-17 12:43     ` Jan Beulich
  2016-02-17 17:02     ` Konrad Rzeszutek Wilk
  0 siblings, 2 replies; 10+ messages in thread
From: Corneliu ZUZU @ 2016-02-17 12:09 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini

On 2/17/2016 12:34 PM, Jan Beulich wrote:
>
>> The reason I need this is to pass '-save-temps' to GCC, I want to inspect
>> some code
>> and it would be easier to do that on the preprocessed files.
> ... there's absolutely no need to for a case like this, at least as
> long as the xen/ subtree is where you want to do this.
> xen/Rules.mk has rules for what you want (and also for
> producing the intermediate assembly file), just that you can't
> achieve this by invoking make from the top level directory -
> you need to run make directly in xen/ and manually specify
> the intended target (including leading sub-directories).
>
> Jan
>

I wouldn't want to needlessly insist, but of course a canonical way to 
do this would be preferred.
I do see the %.i targets there in Rules.mk invoking the preprocessor, 
but I haven't yet figured how to make those execute.

Could you detail what make args would activate execution of the %.i targets?
This is not so important since for now Razvan's suggestion does the 
trick (or adding %.i as a dependency for %.o in Rules.mk),
but I thought it would be nice for future reference, so only respond 
when/if you have the time/disposition.

Thanks,
Corneliu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 12:09   ` Corneliu ZUZU
@ 2016-02-17 12:43     ` Jan Beulich
  2016-02-17 13:11       ` Corneliu ZUZU
  2016-02-17 17:02     ` Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2016-02-17 12:43 UTC (permalink / raw)
  To: Corneliu ZUZU
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini

>>> On 17.02.16 at 13:09, <czuzu@bitdefender.com> wrote:
> On 2/17/2016 12:34 PM, Jan Beulich wrote:
>>
>>> The reason I need this is to pass '-save-temps' to GCC, I want to inspect
>>> some code
>>> and it would be easier to do that on the preprocessed files.
>> ... there's absolutely no need to for a case like this, at least as
>> long as the xen/ subtree is where you want to do this.
>> xen/Rules.mk has rules for what you want (and also for
>> producing the intermediate assembly file), just that you can't
>> achieve this by invoking make from the top level directory -
>> you need to run make directly in xen/ and manually specify
>> the intended target (including leading sub-directories).
> 
> I wouldn't want to needlessly insist, but of course a canonical way to 
> do this would be preferred.
> I do see the %.i targets there in Rules.mk invoking the preprocessor, 
> but I haven't yet figured how to make those execute.
> 
> Could you detail what make args would activate execution of the %.i targets?

Makes me wonder how the rather detailed reply I've already given
(which also answers this question) hasn't been sufficient.

Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 12:43     ` Jan Beulich
@ 2016-02-17 13:11       ` Corneliu ZUZU
  2016-02-17 13:54         ` Jan Beulich
  0 siblings, 1 reply; 10+ messages in thread
From: Corneliu ZUZU @ 2016-02-17 13:11 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini

On 2/17/2016 2:43 PM, Jan Beulich wrote:
>>>> On 17.02.16 at 13:09, <czuzu@bitdefender.com> wrote:
>> On 2/17/2016 12:34 PM, Jan Beulich wrote:
>>>> The reason I need this is to pass '-save-temps' to GCC, I want to inspect
>>>> some code
>>>> and it would be easier to do that on the preprocessed files.
>>> ... there's absolutely no need to for a case like this, at least as
>>> long as the xen/ subtree is where you want to do this.
>>> xen/Rules.mk has rules for what you want (and also for
>>> producing the intermediate assembly file), just that you can't
>>> achakieve this by invoking me from the top level directory -
>>> you need to run make directly in xen/ and manually specify
>>> the intended target (including leading sub-directories).
>> I wouldn't want to needlessly insist, but of course a canonical way to
>> do this would be preferred.
>> I do see the %.i targets there in Rules.mk invoking the preprocessor,
>> but I haven't yet figured how to make those execute.
>>
>> Could you detail what make args would activate execution of the %.i targets?
> Makes me wonder how the rather detailed reply I've already given
> (which also answers this question) hasn't been sufficient.
>
> Jan
>

I don't see why there's need for insults when one asks politely.
Of course, 'rather detailed' is always a rather subjective assessment.
Wonder no more. The original response:
* doesn't specify what additional make arguments/environment vars should 
be set if I'm to run make from ./xen/ rather then ./
* doesn't make it clear what you mean by "intended target". I suppose 
you weren't suggesting to manually run make for *each*
source file I want to preprocess one by one, since I was asking how to 
do that for all sources ('make dist-xen'...)

Thanks anyway,
Corneliu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 13:11       ` Corneliu ZUZU
@ 2016-02-17 13:54         ` Jan Beulich
  2016-02-17 17:09           ` Corneliu ZUZU
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2016-02-17 13:54 UTC (permalink / raw)
  To: Corneliu ZUZU
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini

>>> On 17.02.16 at 14:11, <czuzu@bitdefender.com> wrote:
> On 2/17/2016 2:43 PM, Jan Beulich wrote:
>>>>> On 17.02.16 at 13:09, <czuzu@bitdefender.com> wrote:
>>> On 2/17/2016 12:34 PM, Jan Beulich wrote:
>>>>> The reason I need this is to pass '-save-temps' to GCC, I want to inspect
>>>>> some code
>>>>> and it would be easier to do that on the preprocessed files.
>>>> ... there's absolutely no need to for a case like this, at least as
>>>> long as the xen/ subtree is where you want to do this.
>>>> xen/Rules.mk has rules for what you want (and also for
>>>> producing the intermediate assembly file), just that you can't
>>>> achakieve this by invoking me from the top level directory -
>>>> you need to run make directly in xen/ and manually specify
>>>> the intended target (including leading sub-directories).
>>> I wouldn't want to needlessly insist, but of course a canonical way to
>>> do this would be preferred.
>>> I do see the %.i targets there in Rules.mk invoking the preprocessor,
>>> but I haven't yet figured how to make those execute.
>>>
>>> Could you detail what make args would activate execution of the %.i targets?
>> Makes me wonder how the rather detailed reply I've already given
>> (which also answers this question) hasn't been sufficient.
> 
> I don't see why there's need for insults when one asks politely.

I'm sorry, but your reply gave the impression that you didn't read
mine, which I considered an attempt to be wasting my time.

> Of course, 'rather detailed' is always a rather subjective assessment.
> Wonder no more. The original response:
> * doesn't specify what additional make arguments/environment vars should 
> be set if I'm to run make from ./xen/ rather then ./

Why would I mention env vars when there are none to set (at least
I don't need any that aren't set in my ./.config).

> * doesn't make it clear what you mean by "intended target". I suppose 
> you weren't suggesting to manually run make for *each*
> source file I want to preprocess one by one, since I was asking how to 
> do that for all sources ('make dist-xen'...)

"I want to inspect some code" didn't read like you needed to inspect
every translation unit; I'm sorry if this ended up being a mis-
interpretation. I don't think tree-wide saving of intermediate files
would work reliably, since iirc paths get dropped from file names
when determining the names of the intermediate files.

Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 12:09   ` Corneliu ZUZU
  2016-02-17 12:43     ` Jan Beulich
@ 2016-02-17 17:02     ` Konrad Rzeszutek Wilk
  1 sibling, 0 replies; 10+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-02-17 17:02 UTC (permalink / raw)
  To: Corneliu ZUZU
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini, Jan Beulich

On Wed, Feb 17, 2016 at 02:09:43PM +0200, Corneliu ZUZU wrote:
> On 2/17/2016 12:34 PM, Jan Beulich wrote:
> >
> >>The reason I need this is to pass '-save-temps' to GCC, I want to inspect
> >>some code
> >>and it would be easier to do that on the preprocessed files.
> >... there's absolutely no need to for a case like this, at least as
> >long as the xen/ subtree is where you want to do this.
> >xen/Rules.mk has rules for what you want (and also for
> >producing the intermediate assembly file), just that you can't
> >achieve this by invoking make from the top level directory -
> >you need to run make directly in xen/ and manually specify
> >the intended target (including leading sub-directories).
> >
> >Jan
> >
> 
> I wouldn't want to needlessly insist, but of course a canonical way to do
> this would be preferred.
> I do see the %.i targets there in Rules.mk invoking the preprocessor, but I
> haven't yet figured how to make those execute.

You are probably running in the problem that XEN_ROOT and BASEDIR is not set.

I usually do:

make -f $(BASEDIR)/Rules.mk -C arch/x86 build_id.o

from xen/xen directory. Thought it does not seem to work for me now. It had
in the past.
Ah,

I also added an specific entry to top root Makefile to make it work for
me (since it has some many env variables):

diff --git a/xen/Makefile b/xen/Makefile
index 5d98bcb..b5870b1 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -39,8 +39,8 @@ dist: install
 
 build install:: include/config/auto.conf
 
-.PHONY: build install uninstall clean distclean cscope TAGS tags MAP gtags
-build install uninstall debug clean distclean cscope TAGS tags MAP gtags::
+.PHONY: build install uninstall clean distclean cscope TAGS tags MAP gtags custom
+build install uninstall debug clean distclean cscope TAGS tags MAP gtags custom::
 ifneq ($(XEN_TARGET_ARCH),x86_32)
        $(MAKE) -f Rules.mk _$@
 else
@@ -132,6 +132,8 @@ $(TARGET): delete-unfresh-files
        $(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
        $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
 
+_custom:
+       $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $(TARGET)
 # drivers/char/console.o contains static banner/compile info. Blow it away.
 # Don't refresh these files during e.g., 'sudo make install'
 .PHONY: delete-unfresh-files



> 
> Could you detail what make args would activate execution of the %.i targets?
> This is not so important since for now Razvan's suggestion does the trick
> (or adding %.i as a dependency for %.o in Rules.mk),
> but I thought it would be nice for future reference, so only respond when/if
> you have the time/disposition.


> 
> Thanks,
> Corneliu.
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: EXTRA_CFLAGS when compiling Xen
  2016-02-17 13:54         ` Jan Beulich
@ 2016-02-17 17:09           ` Corneliu ZUZU
  0 siblings, 0 replies; 10+ messages in thread
From: Corneliu ZUZU @ 2016-02-17 17:09 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Tamas K Lengyel, Keir Fraser, Ian Campbell, Razvan Cojocaru,
	Andrew Cooper, Xen-devel, Stefano Stabellini

On 2/17/2016 3:54 PM, Jan Beulich wrote:
>>>> On 17.02.16 at 14:11, <czuzu@bitdefender.com> wrote:
>> On 2/17/2016 2:43 PM, Jan Beulich wrote:
>>>>>> On 17.02.16 at 13:09, <czuzu@bitdefender.com> wrote:
>>>> On 2/17/2016 12:34 PM, Jan Beulich wrote:
>>>>>> The reason I need this is to pass '-save-temps' to GCC, I want to inspect
>>>>>> some code
>>>>>> and it would be easier to do that on the preprocessed files.
>>>>> ... there's absolutely no need to for a case like this, at least as
>>>>> long as the xen/ subtree is where you want to do this.
>>>>> xen/Rules.mk has rules for what you want (and also for
>>>>> producing the intermediate assembly file), just that you can't
>>>>> achakieve this by invoking me from the top level directory -
>>>>> you need to run make directly in xen/ and manually specify
>>>>> the intended target (including leading sub-directories).
>>>> I wouldn't want to needlessly insist, but of course a canonical way to
>>>> do this would be preferred.
>>>> I do see the %.i targets there in Rules.mk invoking the preprocessor,
>>>> but I haven't yet figured how to make those execute.
>>>>
>>>> Could you detail what make args would activate execution of the %.i targets?
>>> Makes me wonder how the rather detailed reply I've already given
>>> (which also answers this question) hasn't been sufficient.
>> I don't see why there's need for insults when one asks politely.
> I'm sorry, but your reply gave the impression that you didn't read
> mine, which I considered an attempt to be wasting my time.
>
>> Of course, 'rather detailed' is always a rather subjective assessment.
>> Wonder no more. The original response:
>> * doesn't specify what additional make arguments/environment vars should
>> be set if I'm to run make from ./xen/ rather then ./
> Why would I mention env vars when there are none to set (at least
> I don't need any that aren't set in my ./.config).
>
>> * doesn't make it clear what you mean by "intended target". I suppose
>> you weren't suggesting to manually run make for *each*
>> source file I want to preprocess one by one, since I was asking how to
>> do that for all sources ('make dist-xen'...)
> "I want to inspect some code" didn't read like you needed to inspect
> every translation unit; I'm sorry if this ended up being a mis-
> interpretation. I don't think tree-wide saving of intermediate files
> would work reliably, since iirc paths get dropped from file names
> when determining the names of the intermediate files.
>
> Jan
>
>

I'm sorry too :) I honestly thought you were suggesting that there is a 
target which would build Xen (as I would build it normally, i.e. 'make 
dist-xen') and also call the %.i targets in the process. I spent like 
half an hour trying to figure out what that target was before asking for 
details, heh, it didn't cross my mind to ask you directly if you meant 
the actual files to be the targets. In my mind it seemed obvious what I 
mean, but now that you mention it I wasn't actually that clear, I 
apologize for that.

Regards,
Corneliu.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-17 17:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 10:19 EXTRA_CFLAGS when compiling Xen Corneliu ZUZU
2016-02-17 10:23 ` Razvan Cojocaru
2016-02-17 10:34   ` Corneliu ZUZU
2016-02-17 10:34 ` Jan Beulich
2016-02-17 12:09   ` Corneliu ZUZU
2016-02-17 12:43     ` Jan Beulich
2016-02-17 13:11       ` Corneliu ZUZU
2016-02-17 13:54         ` Jan Beulich
2016-02-17 17:09           ` Corneliu ZUZU
2016-02-17 17:02     ` Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.