Archive

Posts Tagged ‘llvm’

Secret instruction sets about to make a come-back

January 28th, 2010 Derek-Jones 7 comments

Now it has happened Apple’s launch of a new processor, the A4, seems such an obvious thing to do. As the manufacturer of propriety products Apple wants to have complete control over the software that customers run on those products. Using a processor whose instruction set and electrical signals are not publicly available goes a very long way to ensuring that somebody else’s BIOS/OS/drivers/etc do not replace Apple’s or that the distributed software is not ‘usefully’ patched (Apple have yet to reveal their intentions on publishing instruction set details, this is an off-the-cuff prediction on my part).

Why are Apple funding the development of the LLVM C/C++ compiler? Because it enables them to write a back-end for the A4 without revealing the instruction set (using gcc for this purpose would require that the source be distributed, revealing the instruction set). So much for my prediction that Apple will stop funding LLVM.

The landscape of compute intensive cpus used to be populated with a wide variety of offerings from many manufacturers. The very high price of riding the crest of Moore’s law is one of the reasons that Intel’s x86 acquired such a huge chunk of this market; one by one processor companies decided not to make the investment needed to keep their products competitive. Now that the applicability of Moore’s law is drawing to an end the treadmill of continued processor performance upgrades is starting to fading away. Apple are not looking at a processor upgrade cycle, that they need to keep up with to be competitive, that stretches very far into the future.

Isn’t keeping an instruction set secret commercial suicide? The way to sell hardware is to make sure that lots of software runs on it and software developers want instruction set details (well ok, a small number do, but I’m sure lots of others get a warm fuzzy feeling knowing that the information is available should they need it). This is very much a last century view. The world is awash with an enormous variety of software, including lot of it very useful open source, and there is a lot more information available about the set of applications many customers want to use most of the time. Other than existing practice there is little reason why a manufacturer of a proprietary product, that is not a processor, needs to release instruction set details.

In the early 1980s I was at the technical launch of the Inmos Transputer and was told that the instruction set would not be published because the company did not want to be tied down to backwards compatibility. Perish the thought that customers would write assembler because the Inmos supplied compilers produced poor quality code or that a third party compiler would good enough to gain a significant market share. In marketing ability Inmos was the polar opposite of Apple. For a while HP were not very forthcoming on the instruction set behind their PA-RISC processor.

Will the A4 instruction set remain secret? On the whole, perhaps it can. The software based approaches to reverse engineering an instruction set require access to a compiler that generates it. For instance, changing a plus to a minus in one expression and looking for the small change in the generated executable; figuring out which status flags are set under which conditions is harder, but given time it can be done. Why would Apple release executable compilers if it wants to control the software that runs on the A4?

If the instruction set were cracked where would a developer go to obtain a compiler targeting the A4?

Given the FSF’s history with Apple I would not be surprised if there was a fatwa against support for a proprietary instruction set in gcc. I suspect Apple would frown very heavily on such support ever being in the standard llvm distribution. I could see Apple’s lawyers sending letters to anybody making available a compiler that generated A4 code.

In the past manufacturers have tried to keep processor instruction sets secret and found that commercial reality required them to make this information freely available. Perhaps in the long term, like Moore’s law, the publication of detailed instruction set information may just be a passing phase.

Assessing my predictions for 2009

January 24th, 2010 Derek-Jones 1 comment

I have been rather remiss in revisiting the predictions I made for 2009 to see how they fared. Only two out of the six predictions were sufficiently precise to enable an assessment one year later; the other four talking more about trends. What of these two predictions?

The LLVM project will die. Ok, the project is still going and at the end of December the compiler could build itself but the build is not yet in a state to self host (i.e., llvm compiler creates an executable of itself from its own source and this executable can build an executable from source that is identical to itself {modulo date/time stamps etc}). Self hosting is a major event and on some of the projects I have worked on it has been a contractual payment milestone.

Is llvm competition for gcc? While there might not be much commercial competition as such (would Apple be providing funding to gcc if it were not involved in llvm?), I’m sure that developers working on both projects want their respective compiler to be the better one. According to some llvm benchmarks they compile code twice as fast as gcc. If this performance difference holds up across lots of source how might the gcc folk respond? Is gcc compiler time performance an issue that developers care about or is quality of generated code more important? For me the latter is more important and I have not been able to find a reliable, recent, performance comparison. I understand that almost all gcc funding is targeted at code generation related development, so if compile time is an issue gcc may be in a hole.

I still don’t see the logic behind Apple funding this project and continue to think that this funding will be withdrawn sometime, perhaps I was just a year off. I do wish the llvm developers well and look forward to them celebrating a self hosted compiler.

Static analysis will go mainstream. Ok, I was overly optimistic here. There do not seem to have been any casualties in 2009 among the commercial vendors selling static analysis tools and the growth of PHP has resulted in a number of companies selling tools that scan for source security vulnerabilities (.e.g, SQL injection attacks).

I was hoping that the availability of Treehydra would spark the development of static analysis plugins for gcc. Perhaps the neatness of the idea blinded me to what I already knew; many developers dislike the warnings generated by the -Wall option and therefore might be expected to dislike any related kind of warning. One important usability issue is that Treehydra operates on the abstract syntax tree representation used internally by gcc, GIMPLE. Learning about this representation requires a big investment before a plugin developer becomes productive.

One tool that did experience a lot of growth in 2009 was Coccinelle, at least judged by the traffic on its mailing list. The Coccinelle developers continue to improve it and are responsive the questions. Don’t be put off by the low version number (currently 0.2), it is much better than most tools with larger version numbers.

Compiler writing: The career path to World domination

November 7th, 2009 Derek-Jones 3 comments

Compiler writing is not usually thought of as a career path that leads to becoming Ruler of the World. Perhaps this is because compiler writing is a relatively new profession and us compiler writers are still toiling in obscurity awaiting the new dawn.

What might be a workable plan for a compiler writer to become Ruler of the World? One possibility is to write a compiler for the language in which most of the World’s critical software is written (i.e., C) and for that compiler to become the one that the vendors of this critical software all use (i.e., gcc). This compiler needs to do more that just compile the source code it is feed, it also needs to generate code that creates a backdoor in important programs (e.g., the login program).

But, you say, this cannot happen with gcc because its source is available for everybody to read (and spot any backdoor generator). In his 1984 Turing acceptance lecture Ken Thompson showed how a compiler could contain a backdoor that was not visible in its source. The idea is for the compiler writer to modify a compiler to detect when it is being used to compile itself and to insert the backdoor generating code into its own executable. This modified compiler is then used to compile itself and the resulting executable made the default compiler; the backdoor modifications are then removed from the compiler source, they are no longer needed because the previously compiled compiler will spot when it is being used to compile its own source and generate the code necessary to propagate the backdoor code into the executable it creates.

How would the world counter the appearance of such a modified gcc? Obviously critical programs would need to be recompiled by a version of gcc that did not contain the backdoor. Today there are several companies and many amateur groups that distribute their own Linux distributions which they build from source. It should be relatively easy to obtain a usable executable of gcc from 10 years ago; remember what is needed is a version capable of compiling the latest gcc sources.

The ideal time to create a backdoor’ed version of gcc is while its development was under the control of one person, so early in the development history that all versions available anywhere are very likely to be derived from it. How can we prove that the original author of gcc did not do just this?

It could be argued that the very substantial changes to the gcc sources (most of the source has probably been rewritten several times) mean that the coding patterns searched for by the executable to detect that it is compiling itself have long gone and at some point the backdoor failed to propagate itself to the next executable.

Compilers other than gcc might also include backdoors that propagate themselves. However, the method of propagation is likely to be different. Compiling the gcc sources with a non-gcc compiler creates an executable that should exhibit the same behavior as a gcc-compiled executable. Differences in the behavior of these independently built executables is a cause for concern (one difference might be caused by differences in the conversion of floating-point literals, a recent PhD thesis provides more detail).

The problem with compiling the gcc sources is that they make use of language extensions that few, if any, other compilers support. I know IBM added modified one of their C compilers to support those gcc extensions needed to compile the Linux kernel, but I don’t know if this compiler is capable of compiling the gcc sources. The LLVM project intended to support many gcc extensions but I don’t know if they aim to be able to compile the gcc sources.

Another option is to compare the assembler generated when gcc compiles itself against the corresponding source code. A very expensive task for source code measured in hundreds of thousands of lines. Adding the necessary language extension support to another compiler would probably be cheaper and also create a tool that could be used to check future releases of gcc.

FireStats icon Powered by FireStatscialis iop

canadian healthcare viagra

lowest propecia prices in canada

buy levitra american pharmacy

best online generic levitra

cialis low price

canada viagra generic

hydrochlorothiazide cialis

5 mg daily cialis

levitra cheap canadian pharmacy

cialis iop

cheap viagra or cialis

effect of cialis on women

canadian healthcare viagra sales

indian cialis

cialis buy

canadian pharmacy

buy generic levitra online

5 mg cialis

cialis discounts

buy propecia without prescription

ordering viagra

50 mg cialis

cialis fast

buy propecia international pharmacy

buy cialis in canada

cheap online propecia

cialis germany

buying cialis without a prescription

cheap levitra

cialis cheap

generic cialis next day delivery

cost of cialis

cialis 5 mg

canada online pharmacy propecia

buy branded viagra online

mail order levitra

beta blockers and viagra

buy generic propecia

canada online pharmacy propecia

cialis canada illegal buy

bying viagra online cheap us

buy propecia online pharmacy

buying viagra with no prescription

cialis from canada

canadian cialis

buy levitra with no prescription

cialis for women

generic propecia india

how to get cialis no prescription

canadian pharmacy cialis pfizer

order propecia prescriptions

5 mg cialis canada

best prices for propecia

buy generic propecia

best viagra

cheap discount levitra

brand viagra over the net

buy viagra

cheap propecia canada

cheapest propecia uk

5 mg daily cialis

generic viagra in canada

cialis daily cost

cialis discount

cheapest prices on viagra

buying cialis next day delivery

brand name cialis

canada viagra

buy prescription propecia without

original brand cialis

index

generic propecia online pharmacy

cialis daily in canada

cheap levitra uk

generic propecia uk

buy cheapest propecia

buy cheapest cialis

online pharmacy levitra

online propecia uk

how does viagra work

canadian generic cialis

buying online propecia

cialis refractory

cialis generic

buy cheap generic levitra

buy viagra pills

cialis for less 20 mg

cialis professional no prescription

mexico viagra

buy propecia in canada

buying cialis next day delivery

cialis alternatives

cheap viagra pills

cialis by mail

buy levitra now

buy now online propecia

cheap viagra generic

best price for propecia

natural viagra

best deal for propecia

generic propecia effective

levitra sex pill

low cost propecia

buy real cialis

baldness male propecia

cialis from mexico

mexico pharmacy cialis

cialis overnight delivery

canadian healthcare pharmacy

buy viagra germany canadian meds

cialis professional 20 mg

buy viagra germany canadian meds

cialis soft tabs

buying cialis

cialisis in canada

buy propecia pills

buy canada levitra

cialis alternatives

buy cialis online without prescription

generic cialis from india

generic levitra online

get cialis

buy levitra by mail

canadian viagra and healthcare

buy propecia online prescription

best price propecia

generic viagra canadian

generic cialis canadian

buy viagra online canada

cialis generic 100 mg

buy levitra us

buy branded viagra online

buy cialis in usa

buy levitra low price

discount levitra online

canadian pharmacies cialis

levitra without prescriptions

online levitra

levitra online us

cialis low price

cheap fast levitra

cialis brand name

order viagra or levitra

cheap levitra prescription

cialis discount prices

cialis brand

canadian healthcare

cialis en mexico

brand name cialis

cialis overnight

levitra sales uk

cheap online levitra

growth hair propecia

cost of cialis

canadian healthcare viagra sales

herbal viagra

cialis levitra sales

cialis from mexico

canadian drug viagra soft

cialis kanada

canadian cialis

levitra cheapest

cialis on women

cheapest viagra

buy propecia online without prescription

canadian generic viagra online

canadian propecia rx

buy branded viagra

best way to use cialis

canada meds viagra

buy pfizer viagra

overnight canadian viagra

generic cialis next day delivery

canadian healthcare cialis

generic cialis sale

cialis no rx

buy cialis next day delivery

levitra discount

online pharmacy cost levitra

best online generic levitra

cost of viagra

cialis dosage mg

cheap viagra or cialis

cialis 100 mg generic

canadian propecia cheap

levitra vs viagra

best levitra price

buy pfizer viagra online

cialis women

buy cheap generic propecia

next day delivery cialis

best price levitra online

ordering cialis gel

canadian viagra

canada meds viagra

discount canadian cialis

canadian pharmacy viagra

discount levitra rx

cheap viagra generic

brand viagra professional

generic propecia finasteride

buying viagra with no prescription

cialis for less 20 mg

buying generic cialis mexico rx

obtain viagra without prescription

buy pfizer viagra in canada

cost of viagra in germany

buying levitra online

cialis professional 100 mg

buy propecia generic

cialis daily canada

cialis brand

canadian pharmacy viagra legal

buy viagra in canada no prescription

canadian viagra

cialis headaches

cialis canadian

cheap order prescription propecia

buy branded viagra

lowest price levitra

buy cialis for daily use

lowest cost levitra

drug generic propecia

discount levitra online us

levitra canadian pharmacy

herbal alternative to cialis

cialis professional

5 mg original brand cialis

5 mg cialis

cialis vs levitra

best online levitra

levitra

order levitra

daily dosage cialis

canada pharmacy propecia

buy propecia online pharmacy

cialis cheap us pharmacy

canadian pharmacy discount code viagra

fast propecia

cialis canada online pharmacy

cialis professional no prescription

buy viagra online canada

cialis 5 mg italia

5mg propecia

low price cialis

cheapest online propecia

getting cialis from canada

cialis delivered overnight

buy xenical propecia