On 22 July 2012 20:42, Anton Korobeynikov <anton at korobeynikov.info> wrote:>> Any suggestions? > Try to specify CPU explicitly.He shouldn't have to, but that might help. Maybe setting -march? This is a big mess... I thought that v7 always assumed Thumb2 for the thumb flag, and v7M should always assume Cortex-M3 CPU if none provided. It's funny that James had a great patch to solve all those problems by implementing Clang's architecture selection in table-gen more than an year ago. I wonder what happened to that thread... :/ -- cheers, --renato http://systemcall.org/
Anton Korobeynikov
2012-Jul-22 20:39 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
> He shouldn't have to,Well, right. In the case when driver would behave properly :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
salvatore benedetto
2012-Jul-22 21:03 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
On Sun, Jul 22, 2012 at 10:37 PM, Renato Golin <rengolin at systemcall.org> wrote:> On 22 July 2012 20:42, Anton Korobeynikov <anton at korobeynikov.info> wrote: >>> Any suggestions? >> Try to specify CPU explicitly. > > He shouldn't have to, but that might help. Maybe setting -march? This > is a big mess... > > I thought that v7 always assumed Thumb2 for the thumb flag, and v7M > should always assume Cortex-M3 CPU if none provided. > > It's funny that James had a great patch to solve all those problems by > implementing Clang's architecture selection in table-gen more than an > year ago. I wonder what happened to that thread... :/While we are at it, if a new comer would like to understand where everything takes place, where should he look? I did a grep in the source and eventually ended up in clang/something/driver. Regards, S.
On 22 July 2012 22:03, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:> While we are at it, if a new comer would like to understand where everything > takes place, where should he look? > > I did a grep in the source and eventually ended up in clang/something/driver.That's pretty much it: clang/lib/Driver http://clang.llvm.org/doxygen/dir_20b6fcdbe5e465b3389293c5a4a7422f.html However, don't ever assume that that code is correct, or good. It's a big mess and should be refactored to avoid the ridiculous command line you had to use, when a simple "-mcpu=cortex-m3" should suffice. -- cheers, --renato http://systemcall.org/
Chris Cadwallader
2012-Jul-23 16:03 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
On Darwin, if -march is armv7 clang's driver will assume you want thumb2 unless you also give it -mno-thumb but that is irrelevant with mcpu=cortex-m3. I agree its a mess. -Chris On Jul 22, 2012, at 4:37 PM, Renato Golin wrote:> On 22 July 2012 20:42, Anton Korobeynikov <anton at korobeynikov.info> wrote: >>> Any suggestions? >> Try to specify CPU explicitly. > > He shouldn't have to, but that might help. Maybe setting -march? This > is a big mess... > > I thought that v7 always assumed Thumb2 for the thumb flag, and v7M > should always assume Cortex-M3 CPU if none provided. > > It's funny that James had a great patch to solve all those problems by > implementing Clang's architecture selection in table-gen more than an > year ago. I wonder what happened to that thread... :/ > > -- > cheers, > --renato > > http://systemcall.org/ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On 23 July 2012 17:03, Chris Cadwallader <ccadwallader at arxan.com> wrote:> On Darwin, if -march is armv7 clang's driver will assume you want thumb2 unless you also give it -mno-thumb but that is irrelevant with mcpu=cortex-m3.I think that Thumb2 should be the default for v7 on any system, not just Darwin. Maybe some ARM folk can comment on this... -- cheers, --renato http://systemcall.org/
On Jul 23, 2012, at 1:52 PM, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:> On Mon, Jul 23, 2012 at 8:14 PM, Renato Golin <rengolin at systemcall.org> wrote: >> On 23 July 2012 17:03, Chris Cadwallader <ccadwallader at arxan.com> wrote: >>> On Darwin, if -march is armv7 clang's driver will assume you want thumb2 unless you also give it -mno-thumb but that is irrelevant with mcpu=cortex-m3. >> >> I think that Thumb2 should be the default for v7 on any system, not >> just Darwin. Maybe some ARM folk can comment on this... >> > > Just out of curiosity, is anyone working on this? > Is there a ticket opened? > > And yet out of curiosity, how much of work is this? > Weeks? Months? >The more "make the driver more sane for ARM cross compilers" work? That could be a pretty big deal, though it'd mostly be political and testing work. The actual implementation details are likely to not be that bad. Making Thumb2 the default for any ARMv7 triple, on the other hand, is a change that could be made in a matter of minutes. See ToolChain::ComputeLLVMTriple(). In particular, the following: // Thumb2 is the default for V7 on Darwin. // // FIXME: Thumb should just be another -target-feaure, not in the triple. StringRef Suffix = getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple)); bool ThumbDefault = (Suffix.startswith("v7") && getTriple().isOSDarwin()); Just remove the check for Darwin. -Jim> As I have officially switched to clang for my project, I'm very > interested in seeing this fixed. :-) > > Regards, > S. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On 24 July 2012 17:53, Jim Grosbach <grosbach at apple.com> wrote:> The more "make the driver more sane for ARM cross compilers" work? That could be a pretty big deal, though it'd mostly be political and testing work. The actual implementation details are likely to not be that bad.I think there's more to it that just "sane for ARM". Mips, PowerPC and other "main" architectures also probably suffer from cross-compilation issues and should be dealt with by any patch that fixes ARM. James has a patch, ready to commit, and that transformed Clang's driver into a pattern-matching monster. You could just specify -mcpu, or just -march or just -mtune and it'd do everything else for you. All in table-gen, all clean and easy to maintain. It was roughly 5~8 files, about a thousand lines of code, mostly new stuff and cleaning the trash/ IIRC, it took him a week or so to do all that, and months waiting for answers, then years waiting for more answers. It was more than just tests, and until today I have no idea what it was... There was always something wrong but no one could tell what, but it stopped the patch anyway. Seeing the state that the driver is today (exactly the same mess it was last year), I say anyone could do it in a week in table-gen and encompass one major architecture. Another week or so to encompass all others. (James had for Intel and ARM). AFAIK, James is on holidays, I think he'll be happy to hear that his idea is now getting more acceptance, and maybe even resurrect his original patch.> Making Thumb2 the default for any ARMv7 triple, on the other hand, is a change that could be made in a matter of minutes.It's not that simple. That defaults Thumb for v7 architectures, which means armv7 and thumbv7 would be the same. A better fix would be to make thumbv7m to actually produce the correct thumb code! I'll have a look at this. It should be just a matter of spotting the Thumb2 flag for v7m. And for the love of god, stop with "Suffix.startswith("v7")"!!! -- cheers, --renato http://systemcall.org/
Eric Christopher
2012-Jul-24 20:32 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
On Jul 24, 2012, at 1:29 PM, Renato Golin <rengolin at systemcall.org> wrote:> IIRC, it took him a week or so to do all that, and months waiting for > answers, then years waiting for more answers. It was more than just > tests, and until today I have no idea what it was... There was always > something wrong but no one could tell what, but it stopped the patch > anyway.I'm going to take some offense at this. I was reviewing all of his patches and the last I heard from him was that he was going to tablegen everything and send it back out. I don't recall ever seeing it and definitely never got a ping on it. -eric
Eric Christopher
2012-Jul-24 20:35 UTC
[LLVMdev] Setting up a cross-compiler for cortex-m3
On Jul 24, 2012, at 1:32 PM, Eric Christopher <echristo at apple.com> wrote:> > On Jul 24, 2012, at 1:29 PM, Renato Golin <rengolin at systemcall.org> wrote: > >> IIRC, it took him a week or so to do all that, and months waiting for >> answers, then years waiting for more answers. It was more than just >> tests, and until today I have no idea what it was... There was always >> something wrong but no one could tell what, but it stopped the patch >> anyway. > > I'm going to take some offense at this. I was reviewing all of his patches > and the last I heard from him was that he was going to tablegen everything > and send it back out. I don't recall ever seeing it and definitely never got > a ping on it.To give myself a little bit of wiggle room here I'll say "don't recall getting a ping from James on it". -eric
On Jul 24, 2012, at 1:29 PM, Renato Golin <rengolin at systemcall.org> wrote:> On 24 July 2012 17:53, Jim Grosbach <grosbach at apple.com> wrote: >> The more "make the driver more sane for ARM cross compilers" work? That could be a pretty big deal, though it'd mostly be political and testing work. The actual implementation details are likely to not be that bad. > > I think there's more to it that just "sane for ARM". Mips, PowerPC and > other "main" architectures also probably suffer from cross-compilation > issues and should be dealt with by any patch that fixes ARM. > > James has a patch, ready to commit, and that transformed Clang's > driver into a pattern-matching monster. You could just specify -mcpu, > or just -march or just -mtune and it'd do everything else for you. All > in table-gen, all clean and easy to maintain. It was roughly 5~8 > files, about a thousand lines of code, mostly new stuff and cleaning > the trash/ > > IIRC, it took him a week or so to do all that, and months waiting for > answers, then years waiting for more answers. It was more than just > tests, and until today I have no idea what it was... There was always > something wrong but no one could tell what, but it stopped the patch > anyway. > > Seeing the state that the driver is today (exactly the same mess it > was last year), I say anyone could do it in a week in table-gen and > encompass one major architecture. Another week or so to encompass all > others. (James had for Intel and ARM). AFAIK, James is on holidays, I > think he'll be happy to hear that his idea is now getting more > acceptance, and maybe even resurrect his original patch. > >I'm with Eric, here. Huh? You have a very different recollection of events than I.> >> Making Thumb2 the default for any ARMv7 triple, on the other hand, is a change that could be made in a matter of minutes. > > It's not that simple. That defaults Thumb for v7 architectures, which > means armv7 and thumbv7 would be the same. A better fix would be to > make thumbv7m to actually produce the correct thumb code! >The question was how to get the same behavior as on Darwin. I pointed at the code that does this for Darwin. I make no claims that the code there, or anywhere else in Driver, for that matter, is anything resembling a paragon of fine design. That was, however, not the question.> I'll have a look at this. It should be just a matter of spotting the > Thumb2 flag for v7m. And for the love of god, stop with > "Suffix.startswith("v7")"!!!Patches welcome.> > -- > cheers, > --renato > > http://systemcall.org/
On 24 July 2012 21:32, Eric Christopher <echristo at apple.com> wrote:> I'm going to take some offense at this.Please, don't! My memory is not trust-worthy to that point. ;)> I was reviewing all of his patches > and the last I heard from him was that he was going to tablegen everything > and send it back out. I don't recall ever seeing it and definitely never got > a ping on it.He sent out the table-gen quite a few times, but it got some vague reviews at the beginning (I think you went on holidays), than you and him (possibly) ended up ping-ponging privately and than it stopped. Not sure what happened, don't take my memory to the letter. Anyway, I've seen the bug salvatore referred to (4127) and I think there is more to it than what we had. AFAICS, there are three fronts: 1. Simple, table-gen pattern-match monster, that guesses most options by one or two pieces of information. James had that. This is good for Salvatore's use case, when you just want it to work when you say "-mcpu=cortex-m3". 2. Complete, configuration file driven, where you can fine tune every bit of your compilation, linking etc. This could be also generated from a table-gen front-end, extended from James' patch. 3. Command line options, good for CMake environments (where some local dirs have special behaviour, etc). These options can ALSO be derived from the table-gen description, but that will be a bit harder, to keep the ones we have now with the same behaviour. -- cheers, --renato http://systemcall.org/
Maybe Matching Threads
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3
- [LLVMdev] Setting up a cross-compiler for cortex-m3