-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assembly listing as output of c and cxx target types #24
Comments
I am wondering if we need a mirror mechanism of ad hoc prerequisites (see #25), that is, ad hoc targets. In fact, we already have it at the build model level (called ad hoc target groups and we use to handle things like |
I believe this would be useful. Generally, I've encountered the following types of rules in various places I've worked:
Having the ability to do all three, with clear examples and documentation would be awesome. |
Ok, I am finally starting to look into this and have a proposed syntax. Probably easiest is to show an example for an assembler listing and a linker map. We start with this:
Which we can make more explicit (but we don't have to; the below will work even if you let
Now comes the listing and map:
This will "work" currently (i.e., produce listing/map) but the files won't be part of the build model, won't be cleaned, etc. Next we enter them as ad hoc group members (this is the proposed syntax):
In fact, we can fairly easy make this work (has been on my TODO for some time):
But eventually I want to end up with something like this (the idea of
So back to the ad hoc member syntax, here are a couple of more examples:
How does this look? |
Hi @boris-kolpackov, thanks for taking the time to think about this and propose a new syntax. I really like the proposed syntax, especially if the This is somewhat tangential to the specific case of assembly listing and linker map file, but what if the ad hoc output is not easily named, for example the output is more than one file (perhaps multiple files output to a directory), or the filenames are determined by the contents of a code-generation program (or input to that program not provided directly on the command line but instead in the contents of one of the input files)? I believe such situations should be avoided whenever possible by somehow making the output filenames/directories a command line argument, but on occasion I've seen programs that behave this way and they always seem to cause grief, likely due to the dependency graph not being accurate. |
The underlying build model is general enough to handle such cases but expressing them using the |
I took a stab at this and so far things seem to work out well. The ad hoc targets are cleaned and can even be installed, if necessary. One tricky area is using such ad hoc targets as prerequisites for other targets. Currently our ad hoc group machinery does not support this but it's probably something that someone will want to do sooner rather than later. Do you have any realistic use-case for this? E.g., where you would want to use a linker map as an input to another build rule or some such? |
@hazelnusse I am pretty much done with this (sans the documentation and that
You can even build/depend on the group members:
It would be helpful if you could try this on your use-cases and see if there are any issues. Regarding the |
As of 0.13.0 we now have support for ad hoc recipes: https://build2.org/release/0.13.0.xhtml#adhoc-recipe So, functionally, I believe everything described in this issue is now achievable. We still have no documentation so let's keep this issue open until we fix that. |
The ability to optionally generate assembly listings during the compilation step is useful in some applications. For gcc/g++, this can be achieved by passing
-Wa,-a[cdghlns]=<listfile>
during the compilation step. This is documented for binutilsas
here:https://sourceware.org/binutils/docs/as/a.html#a
I'm not certain how this would work in Visual Studio or clang. With clang it seems that the
-S
flag will generate the listing, but the object file is not generated -- I'm not sure if there is a way to make clang do both in a single step. Runningobjdump
as a separate step is an option but I think if it can be done during the compilation this is preferable.The text was updated successfully, but these errors were encountered: