Re: DDK build result different from VS result
From: Mark Roddy (markr_at_hollistech.com)
Date: 01/29/05
- Next message: Tom Udale: "USB2 Avstream driver"
- Next in thread: Hannes: "Re: DDK build result different from VS result"
- Maybe reply: Hannes: "Re: DDK build result different from VS result"
- Reply: Hannes: "Re: DDK build result different from VS result"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 29 Jan 2005 14:30:36 -0500
Hannes wrote:
> Hi,
>
> Due to the following post, I am trying to convert my VS.NET 2003 kernel
> driver project into a VS.NET 2003 makefile project, so I can compile using
> the DDK compiler, which seem safer and more supproted for kernel development.
>
> http://msdn.microsoft.com/newsgroups/managed/default.aspx?dg=microsoft.public.development.device.drivers&mid=00dc9074-bd6a-4e83-9c69-ea7b770c3780&sloc=en-us
>
> I have noticed, though, that my driver becomes about twice as large (500kB
> vs. 250kB) when built through the DDK compiler. What can cause this?
>
> I am using Mark Roddy's DDKBUILD utility, and I have carefully ported all
> the compiler flags from the VC project into this new makefile project.
>
I'm confused. The only flags of interest with respect to
compilation/linking of your driver are in the Sources file, not in the
VC project file. That is th whole point of ddkbuild - to get your driver
built using the standard settings from the ddk. So what flags are we
talking about here?
> Now, if I, in my own makefile comment out the call to
>
> !INCLUDE $(NTMAKEENV)\makefile.def
>
> and instead write my own makefile, like this:
>
> !INCLUDE sources
>
> $(TARGETNAME): $(SOURCES)
> rc $(MY_RC_FLAGS) $(C_DEFINES) $(TARGETNAME).rc
> cl $(USER_C_FLAGS) $(C_DEFINES) $(SOURCES) /link $(LINKER_FLAGS)
> $(TARGETLIBS)
> !ENDIF
>
Then you are off on your own with an unsupported build process. This
doesn't mean that your build process is wrong or faulty, it is just
unsupported.
> the driver file now becomes about half the size, 250kB. This is also the
> size I used to get through my old VS project (that was using the VS compiler).
>
> I have compared the flags sent to 'cl' by examining the two different
> buildfre_w2K_x86.log files generated by the DDK included makefile vs my own
> makefile. It appears that my own makefile passes exactly the flags that I
> intended, while the DDK included makefile passes an extra set of flags to the
> compiler.
>
That would be the flags that Microsoft, for good or bad, has decided are
the correct flags for compilation/linking of drivers.
> For instance, /G6 is passed, while I actually want /G7. So I end up with a
> warning that /G7 overrides /G6. This I can take, but how about all the other
> flags, can I not avoid all the "default" compiler flags and JUST use my own
> flags?
>
So how exactly are you setting the optimization flags? Better yet, why
not just leave the flags alone and use the default settings in the ddk?
> Also, I noticed how 'link' is sent a whole set of flags, EVEN WHEN I add
> LINKER_FLAGS=
> in my sources file. Using my own makefile, I get exactly the flags I want
> passed on to the linker, and the outcome is, again, the smaller 250kB rather
> than 500kB.
>
Once again you seem to have conflicted goals here. You want to use the
ddk toolset to get standard results, but you want to override all the
settings from the toolset so that you can get non-standard results. The
whole point of using the ddk toolset is to use standard tools with
standard settings so that the ouput has a reasonable chance of working
correctly, (ignoring source code defects.)
Of course there are linker flags that are immune to whatever you set
LINKER_FLAGS to. Search for LINKER_FLAGS in <ddkdir>\bin\makefile.new to
get a better understanding of what is going on here. It ain't magic.
> I am trying to use maximum optimization, global optimization, and optimize
> for speed, on both builds. All compiled versions of the driver seem to work,
> even though I have not yet tested them for speed.
>
> Perhaps a bunch of stuff is being stripped in one case, but not the other,
> not affecting the performance of the resulting driver?
>
> Is it expected for the 2000 FREE DDK build environment to generate larger
> files, or are there more options I can configure, to make it behave just like
> when I write my own makefile? I have studied the documentation for all the
> build macros available to makefile and sources, and I don't see any more that
> could affect my build result.
>
>
> Thansk, and let me know if you need more information!
>
> Any input appreciated,
>
> / Hannes.
I suggest that you strip all the crap out of your sources file, and
unless there is some real need to worry about compilation/linking size
and or speed optimizations, accept what you get.
I generally worry about compiler and linker settings right after I am
convinced that all software defects have been eliminated from the
module, and that there are no algorithmic optimizations left to
implement, which is to say I never worry about compiler and linker settings.
-- ===================== Mark Roddy DDK MVP Windows 2003/XP/2000 Consulting Hollis Technology Solutions 603-321-1032 www.hollistech.com
- Next message: Tom Udale: "USB2 Avstream driver"
- Next in thread: Hannes: "Re: DDK build result different from VS result"
- Maybe reply: Hannes: "Re: DDK build result different from VS result"
- Reply: Hannes: "Re: DDK build result different from VS result"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|