8 ms·
Don't remove the $(nop) command below
- oneplane 10y agoI wonder what voodoo it actually does. Would this be traceable in the compiler?
- jschwartzi 10y agoThis is a makefile, so no. What you could do is replace the $(eval $(call PREPARE_LIB,libname-glob)) lines wherever they are with $(info $(call PREPARE_LIB,libname-glob)) and see what actually expands. But I suspect they've either tried that, or the usage of this macro in conjunction with other macros is so complex that it's not super-easy to parse the output and find the problem. Make is so useful that I'm willing to live without things like a debugger and useful error messages in order to have the flexibility to implement a build system.
- dima55 10y agoMerry christmas: http://bashdb.sourceforge.net/remake/ http://bashdb.sourceforge.net/remake/
- ww520 10y agoIt probably has delimiting effect. Without the NOP, the macro expansion probably would concatenate together as foobar rather than foo bar.
- patmcguire 10y agoThere's a story I've heard that ends with the real reason being that the author thought it would be funny to have people asking him why there were three consecutive nops years after the fact.
- Retr0spectrum 10y agoIt was removed here, with a partial explanation: https://github.com/rust-lang/rust/commit/fca66702a44038b14d8f9bd282ad56c04e9fdcf6 https://github.com/rust-lang/rust/commit/fca66702a44038b14d8... "Adding blank lines means two steps from different defines will not end up on the same line."
- deleted 10y ago[deleted]
- kibwen 10y agoI was about to say, don't bother submitting a patch to fix this, as last week rustc completely moved away from make, deleting all its makefiles in the process: https://github.com/rust-lang/rust/pull/39431 https://github.com/rust-lang/rust/pull/39431 I'm curious how OP even ended up trawling old versions of rustc's makefiles from 2014. I bet there's an interesting story there. :P
- krupan 10y agoSo they switched from make to something called rustbuild, it appears. A quick search didn't turn up any details on rustbuild for me. Is it something very rust specific, or could I use it for other projects?
- steveklabnik 10y agoIt is specific to the compiler. https://github.com/rust-lang/rust/tree/master/src/bootstrap https://github.com/rust-lang/rust/tree/master/src/bootstrap It basically consists of: 1. A python script to make sure you have the correct environment, and that kicks off cargo to compile the program used in step 2. ("rustbuild" proper.) 2. A Rust program that manages the full build (remember, Rust is bootstrapped, so there's three stages...) 3. That build kicks off a number of "cargo build"s for all the components and glues the final result together. For any project written in Rust, pure Cargo should be enough.
- 10y ago
- hgdsraj 10y agoThere's likely a data bubble or dependency in the CPU pipeline that needs an extra few picoseconds to fetch the correct data.
- zapu 10y agoI think this is for Makefiles...
- kibwen 10y agoUgh, they were right, Rust's syntax really is garbage. :P
- Retr0spectrum 10y agoWhat do you mean? Makefiles are not written in rust...
- kibwen 10y agoJust making a joke, my friend. :)
- bcook 10y agoUse /s or include a pic of your sarcastic facial expression next time...
- spdionis 10y agoLuckily we can't include pics
- lisivka 10y agoWe can, using data: protocol. Copy following text to URL field: data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve" height="100px" width="100px"><g><path d="M28.1,36.6c4.6,1.9,12.2,1.6,20.9,1.1c8.9-0.4,19-0.9,28.9,0.9c6.3,1.2,11.9,3.1,16.8,6c-1.5-12.2-7.9-23.7-18.6-31.3 c-4.9-0.2-9.9,0.3-14.8,1.4C47.8,17.9,36.2,25.6,28.1,36.6z"/><path d="M70.3,9.8C57.5,3.4,42.8,3.6,30.5,9.5c-3,6-8.4,19.6-5.3,24.9c8.6-11.7,20.9-19.8,35.2-23.1C63.7,10.5,67,10,70.3,9.8z"/><path d="M16.5,51.3c0.6-1.7,1.2-3.4,2-5.1c-3.8-3.4-7.5-7-11-10.8c-2.1,6.1-2.8,12.5-2.3,18.7C9.6,51.1,13.4,50.2,16.5,51.3z"/><path d="M9,31.6c3.5,3.9,7.2,7.6,11.1,11.1c0.8-1.6,1.7-3.1,2.6-4.6c0.1-0.2,0.3-0.4,0.4-0.6c-2.9-3.3-3.1-9.2-0.6-17.6 c0.8-2.7,1.8-5.3,2.7-7.4c-5.2,3.4-9.8,8-13.3,13.7C10.8,27.9,9.8,29.7,9,31.6z"/><path d="M15.4,54.7c-2.6-1-6.1,0.7-9.7,3.4c1.2,6.6,3.9,13,8,18.5C13,69.3,13.5,61.8,15.4,54.7z"/><path d="M39.8,57.6C54.3,66.7,70,73,86.5,76.4c0.6-0.8,1.1-1.6,1.7-2.5c4.8-7.7,7-16.3,6.8-24.8c-13.8-9.3-31.3-8.4-45.8-7.7 c-9.5,0.5-17.8,0.9-23.2-1.7c-0.1,0.1-0.2,0.3-0.3,0.4c-1,1.7-2,3.4-2.9,5.1C28.2,49.7,33.8,53.9,39.8,57.6z"/><path d="M26.2,88.2c3.3,2,6.7,3.6,10.2,4.7c-3.5-6.2-6.3-12.6-8.8-18.5c-3.1-7.2-5.8-13.5-9-17.2c-1.9,8-2,16.4-0.3,24.7 C20.6,84.2,23.2,86.3,26.2,88.2z"/><path d="M30.9,73c2.9,6.8,6.1,14.4,10.5,21.2c15.6,3,32-2.3,42.6-14.6C67.7,76,52.2,69.6,37.9,60.7C32,57,26.5,53,21.3,48.6 c-0.6,1.5-1.2,3-1.7,4.6C24.1,57.1,27.3,64.5,30.9,73z"/></g></svg>
- deleted 10y ago[deleted]
- lowbloodsugar 10y agoReminds me of the R4300 multiply bug, and the lazy compiler fix that just always emitted a nop between them if it saw two mults in a row. It was a real, hardware bug tho.
- dfox 10y agoVery often hardware bugs can be worked around by well-placed NOP. Last time I did that was on MSP430, where it seems that some integrated peripherals set completion interrupt flag one cycle before the operation really completes. (I'm not sure whether it really is bug, I didn't find this documented anywhere, but for TI's example this does not matter and produces marginally better performance)
- throwanem 10y agoWhich MSPs, if I may? I use some of their 2xxx hobbyist line (since I'm a hobbyist), and this sounds like the kind of PITA that I'm not nearly enough of an embedded dev to avoid tearing my hair out over.
- jlubawy 10y agoThe MSP430x5xx and MSP430x6xx families have this problem. From the user-guide [1]: > Include at least one instruction between the clear of an interrupt enable or interrupt flag and the EINT instruction. For example: Insert a NOP instruction in front of the EINT instruction. > Include at least one instruction between DINT and the start of an code sequence that requires protection from interrupts. For example: Insert a NOP instruction after the DINT Luckily if you use the MSP compiler's intrinsic functions to enable/disable interrupts it takes care of this for you. [1] http://www.ti.com/lit/pdf/slau208 http://www.ti.com/lit/pdf/slau208
- dfox 10y agoWhat I described happened on G2553 with USCI_A in SPI mode. Given the fact that various code samples on the net do not handle this behavior it seems that it is either happening only for some configurations or only on some versions of the HW. But: when you see even bytes on SPI dropped or replaced with previous ones, add NOP.
- flukus 10y agoLooks like they're using make as way to much of a programming language instead of the IMO much better declarative approach, way too many loops and function calls rather than dependencies. I'm not sure but it also looks like it's building too many things instead of different build for different configurations.
- brson 10y agoYes, the Makefiles were an abomination. Nobody could understand them. The reason the makefiles are so heavily macroized like they are is because of cross-compile bootstrapping, where the build rules are the same in many configurations, with slight differences. Effectively, large swaths of the makefiles were parameterized over 4 different values.
- sebcat 10y agoSincere question - why not use autotools? It's a lot easier writing a Makefile.am declaring the parts of the project and having platform specific stuff handled by autoconf. I find autotools very complex and bloated, but it tends to make builds for different platforms, cross compilation, dependency checking and other tasks easy for me. It's often easier than dealing with (g)make directly IMHO.
- Manishearth 10y agoThe answer here is probably "bootstrapped compilers are hard". Rust compiles itself thrice in a typical compile (most devs do fewer stages when hacking), and the makefile needs to distinguish between these, and it gets more complex while cross compiling where your host/target change halfway through the process. So it's quite possible that it's easier to make work in pure make.
- _yosefk 10y agoI dunno, I've never seen a readable Makefile in any system above say 300 files. If you could write readable declarative Makefiles getting the job done, would there be autotools? This is not to say that autotools get the job done beautifully, just that their existence demonstrates how the problem gets us all contort violently to terrible effect like a wounded animal screaming and running into trees. I admit that I despise make and maybe I don't get the beauty (I get the beauty of the idea but I've never seen it result in actual beautiful Makefiles), and maybe if you linked to what you consider a good open source Makefile, we could discuss this in more concrete terms.
- klank 10y agoReminds me of a bug we encountered building mobile devices. Turns out if a certain instruction was executed on a page boundary the CPU would lock up (the gist of the issue anyway, might have had to do with being in an elevated mode as well). Appeared to be a problem in silicon. Unfortunately I can't remember enough details but a NOP or strategically placed variable solved it.
- deleted 10y ago[deleted]
- CalChris 10y agoRust is obtuse enough and then there's its macro language. A macro language should be long on expediency and short on syntax. It doesn't have to be all powerful just useful. The CPP accomplishes this. Rust's macro language is the opposite, all powerful and mostly unusable.
- Gankro 10y agoAh good, now the whole world gets to enjoy the greatest Makefile ever. For other curiosities of Rust's history and bootstrapping process, I recommend brson's annotated stdlib: https://github.com/brson/annotated-std-rs/commit/e50c2b16455ceff29488bf1f058b6c10906ef990 https://github.com/brson/annotated-std-rs/commit/e50c2b16455...
- Retr0spectrum 10y agoThat was a much more interesting read than I anticipated.
- tomcam 10y agoThanks, that sucked me in. Starting after line 93 it gets downright fascinating. Have written commercial compilers but not self-hosted so it was illuminating
- botverse 10y agoReminds me of the story of The Magic Switch: https://news.ycombinator.com/item?id=181045 https://news.ycombinator.com/item?id=181045
- josteink 10y agoAh good old makefiles. This reminds me of this one which I discovered via a recent HN-submission[1]. Falsehoods programmers believe about build systems: http://pozorvlak.livejournal.com/174763.html http://pozorvlak.livejournal.com/174763.html [1] https://news.ycombinator.com/item?id=13637102 https://news.ycombinator.com/item?id=13637102
- kozak 10y agoA better comment would describe a test case that would allow to quickly confirm that the command can be removed when the compiler bug is fixed. Because otherwise it can be there for ages, because everyone will be afraid of touching the code.
- s_kilk 10y agoReminds me of the time my team found a bug in the .Net C# compiler. A whole branch of an if/else statement was being ignored, as in, it simply wasn't present in the emitted IL. Adding a little `&& 1 == 1` to the conditional made the compiler do the right thing again. Edit: preemptively, no there wasn't anything special or weird about this conditional.