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 FireStatsbuy propecia online usa

buy cialis without prescription

cheap propecia 5mg

discount levitra online us

buy cialis on line

cialis soft tablets

levitra mail order

buy cialis online without prescription

order cheap propecia

canada cheap propecia

cialis from mexico

cialis professional

cialis in canada

buy propecia online pharmacy

how to buy cialis in canada

indian generic levitra

online levitra tablet

buy propecia no prescription

online cheap viagra

map of france with cialis

buy propecia online without prescription

buy cheap generic propecia

levitra or viagra

online order propecia

generic viagra made in india

cialis dosagem

generic cialis india discount

buy viagra online canada

cialis express delivery

cheap levitra online

china viagra

levitra online us

canada viagra generic

cialis usa

levitra cheap fast

cialis next day

cialis germany

cialis daily price

cialis india

best propecia prices

buy propecia without a prescription

canadian healthcare viagra

cialis canadian pharmacy

buy canada levitra

buy propecia pills

buy pfizer viagra in canada

cialis canada online pharmacy

order cheapest propecia online

cheap cialis soft

cialis vs levitra

generic propecia mastercard

cheapest propecia in uk

cialis and canada custom

buy propecia uk

buying viagra without prescription

herbal propecia

lowest price for propecia

generic cialis next day delivery

non pescription cialis

buy canada in propecia

cialis price 100 mg

levitra best price

cheap online propecia

bestellen levitra online

buy prescription propecia

cialis strenght mg

buy levitra online us

5 mg cialis canada

canadian cialis

cialis online canada

obtain viagra without prescription

cialis 30 mg

buy cheap generic levitra

cialis endurance

cheap levitra prescription

discount levitra purchase

buy branded viagra online

levitra viagra cialis

cialis 20 mg

buy levitra by mail

levitra pill

buy propecia canada

buy generic viagra india rx

canada viagra pharmacies scam

ordering propecia

cheapest price propecia cheap

get cialis online

buy propecia generic

cialis brand name

canadian healthcare viagra sales

cheap levitra without prescription

lowest price propecia best

indian viagra

cialis levitra sales

cialis canada illegal buy

beta blockers and viagra

levitra next day delivery

cialis brand

canadian online pharmacy cialis

buy mg propecia

brand viagra

buy pfizer viagra online

cialis angioplasty

online propecia uk

cialis for women

generic propecia fda approved

buy branded viagra online

50 mg cialis dose

buy cheapest cialis

order viagra or levitra

cheap viagra no prescription

buy generic propecia online

canadian pharmacy cialis pfizer

buying viagra with no prescription

buy propecia without prescription

cheap canadian viagra

cheapest prices on viagra

buying propecia online

buy propecia in the uk

buy cialis online uk

buy cialis cannada

cialis c 50

can i order viagra from the chemist

online propecia sales

buy dosages levitra

cialis online

cialis 50 mg dose

dose cialis

cost of propecia

cialis on women

buy cialis fedex shipping

buy dosages levitra

generic levitra cheap

buy real cialis

discount propecia propecia

cialis canadian

cialis generic 100 mg

cheepest cialis

cialis by mail

buying propecia

buy propecia in the uk

best doses for propecia

buying cialis soft tabs 100 mg

cialis 5 mg

buy viagra online cheap us

canada online pharmacy levitra

online viagra gel to buy

cialis philippines

brand name cialis overnight

effect of cialis on women

buy pfizer viagra

buying cialis in canada

buy cheap levitra

buy cialis in usa

canadian viagra india

buy propecia on line

discount drug propecia

does generic cialis work

cialis buy

cialis discount prices

generic propecia finasteride

buying viagra in canada

cialis medication

canadian generic cialis

cialis blood thinner

buy propecia cheap

lowest propecia prices in canada

buy real viagra online

generic propecia canada

buy levitra in europe

buy generic propecia online

buy cheapest propecia

best viagra

cialis daily availability

canadian women viagra

cialis 5 mg buy

cheap levitra prescription

canadian viagra generic

cialis buy overnight

canadian pharmacy cialis pfizer

cialis cost canada

buying viagra in canada

chip cialis

cialis cheap us pharmacy

cheapest overnight cialis

buy levitra vardenafil

cialis daily

cialis tablets foreign

canada viagra

levitra paypal

cialis transdermal

cialis quick shipment

buy viagra in canada

cheapest viagra usa

cialis daily cost

cost of viagra

buying cialis

levitra tabs

cialis daily canada

buying generic propecia

mail order propecia

buy cheap propecia

cialis discount

buy pfizer viagra in canada

once daily cialis

generic levitra vardenafil

cialis profesional

cialis no rx

buy cialis cannada

canada viagra pharmacies scam

buy cheap propecia online

cialis india

cialis for sale

cialis for sale

levitra tablets

cialis on sale

buy propecia prescriptions online

buy propecia online prescription

healthcare of canada pharmacy

order propecia

buy levitra online

drug generic propecia

canada meds viagra

bio viagra herbal

original levitra

buy prescription propecia without

discount cialis

cialis online without prescription

express viagra delivery

cheap propecia online

cheapest propecia in uk

cialis india pharmacy

cialis trazodone

5 mg daily cialis

cialis next day delivery

canada meds viagra

buying propecia online

mexico levitra

cialis 100 mg

cialis without prescription

canadain viagra india

gerenic cialis

cialis brand

buy viagra online canada

buy propecia where

cialis overnight

buying generic cialis mexico rx

5mg propecia

best propecia prices

buy cialis online canada