Can Cranelift or LLVM IRs be used to develop a simple OS from scratch? - operating-system

I am curious if I can develop my own programming language to output Cranelift or LLVM IRs, then use it to make a simple OS from scratch?
Specifically, do the instruction sets of Cranelift/LLVM IRs contain OS-level IO instructions?
Thank you.

Related

Where exactly is the issue with ABI stability in Swift programming

First of all, I've been an Objective C developer for years, and around the time that Swift was announced I was mostly maintaining existing Obj C projects. The chance never came to be fully invested in a Swift app, whether from scratch or to maintain. My efforts where directed mostly towards .Net and React Native at that time.
I've done research on what ABI is. It's all fine and dandy. From that answer, I can only assume how that comes into play for Swift, since I do not have much heavy involvement with Swift.
So, from simply guessing, is all the ruckus, racket, and fracas in Swift ABI talk to do with the 'assumed' fact that when a library is written/compiled with version 1.0 of Swift (before Swift 5), it will work fine with an app written in 1.0. When the next version of that library is written in Swift 2.0, that aforementioned app written in Swift 1.0 will not be able to use it, unless compiled for Swift 2.0? Assuming that I am correct on that one, what if I have an app written in Swift 4, and the library I wish to use was written in Swift 1.0 Can I use it? With Swift 5 now released, are ABI issues now resolved for Swift libraries and apps 5+, and not 5+ interacting with 5- ?
If I had experienced these issues first hand I might have had a better understanding of Swift ABI issues.
Please explain with actual examples that cover the full range of cases (if possible).
Update: please include if there are any issues with ABI for small version increases eg from swift 4.0 to 4.1
The chiefly interesting thing to know about ABI stability is that for systems before iOS 10.2 and Swift language versions before 5.0, the Swift language frameworks have to be embedded in the app, adding several MB to its size and perhaps some other runtime overhead. But in iOS 10.2+ and Swift 5.0+, now that there is ABI stability, that stuff is in the runtime and Swift apps are much smaller, probably faster, and quicker to launch.
In other words, thanks to ABI stability, Swift is now the first class citizen that Objective C and Cocoa have been all along.
Application Binary Interface. ABI stability for Swift is about compiling source code into binary files with a common interface over several versions of the language. Without an ABI stability, the binary files across versions of the language, are incompatible with each other, because their formats differ. Dynamic libraries, for instance, have a static call table. As quoted from Wikipedia: "An ABI defines how data structures or computational routines are accessed in machine code". An ABI stability ensures that the library and caller (the app) use the same binary protocol for invoking functions, even if not compiled for the same version of the language.
For Swift's purpose, an ABI stability will allow developers to switch to newer versions of the language, without updating their libraries/frameworks, that way taking advantage of the newer features of the language without waiting for the libraries to get updated. From a Swift.org article back in February: "Today, when a Swift library changes, any apps using that library have to be recompiled." Again, from that article:
ABI stability for Apple OSes means that apps deploying to upcoming releases of those OSes will no longer need to embed the Swift standard library and “overlay” libraries within the app bundle, shrinking their download size; the Swift runtime and standard library will be shipped with the OS, like the Objective-C runtime.
For you as a developer, ABI stability in Swift, means more compatibility with libraries. Due to the Swift language developers needing to ensure that the ABI stability doesn't break, the rate of addition of new features will drop.

mosync c++ or javascript

Is the performance of apps developed in mosync same c++ same as those developed with html5 and javascript.
What are the pros and cons of using c++ or using javascript.
Regards,
Pankaj
in short answer "No"!
When you are using the c++, you actually work with CPU (or at least Operating System), but if you write your programs with "HTML", an extra layer has been added.
The browser(Webkit in android and Iphone) interpret html/js and specially in android there is an obvious reduction in speed (its better on android 4.x but mosync doesn't support it by now )!
But designing User Interface in HTML is easy! and for simple applications its worth it IMO!

What programming languages can one use to develop iPhone, iPod Touch and iPad (iOS) applications?

What programming languages can one use to develop iPhone, iPod Touch and iPad (iOS) applications?
Also are there plans in the future to expand the amount of programming languages that iOS will support?
Apple lifted the restrictions on non-Objective C/C/C++ apps -- you just can't load code that isn't in the app bundle.
MonoTouch lets you use .NET languages -- C# is directly supported, but if you have Windows, you can make assemblies in any .NET language and use it.
There are rumors that Apple is going to support other languages directly -- I keep hearing ruby, but they are just rumors.
I think Lua is being used for game logic on a lot of apps.
EDIT (in 2018): Generally you can use any language that you can get to compile for iOS or even install language interpreters. The main thing you cannot do is load code from the Internet that wasn't in the app bundle.
People do this all of the time anyway (see React Native apps loading JavaScript from servers), but, technically, it's not allowed. The main thing that will get you attention from Apple if you make some kind of App Store that loads whole App-like things.
EDIT (in 2020): from #Pylot in comments: I know this is a long time ago, but now at least technically you can load code that isn’t embedded in the app, as you can write with JavaScript using the webview. Not staying your answer is wrong or anything, I definitely agree with you. but I was looking for something and found this post on the way. Figured if anyone sees this it might help them out.
The SDK agreement and App store guidelines have been changed (circa Sept 2010).
You can now probably use any compiled language that will compile to the same static ARM object file format as Xcode produces and that will link to (only) the public API's within Apple's frameworks and libraries. However, you can not use a JIT compiled language unless you pre-compile all object code before submission to Apple for review.
You can use any interpreted language, as long as you embed the interpreter, and do not allow the interpreter or the app to download and run any interpretable code other than code built into the app bundle before submission to Apple for review, or source code typed-in by the user.
Objective C and C will likely still be the most optimal programming language for anything requiring high performance and the latest API support (* see update below), as those are the languages for which Apple targets its iOS frameworks and tunes its ARM processor chipsets. Apple also supports the use of Javascript/HTML5 inside a UIWebView. Those are the only languages for which Apple has announced support. Anything else you will have to find support elsewhere.
But, if you really want, there are at least a half dozen BASIC interpreters now available in the iOS App store, so even "Stone Age" programming methodology is now allowed.
Added: (*) As of late 2014, one can also develop apps using Apple's new Swift programming language. As of early 2015, submitted binaries must include 64-bit (arm64) support.
With plans to slowly retire the long-used Objective-C, Apple has introduced a new programming language, called Swift, for designing apps and applications to run on Apple iOS devices and Apple Macintosh computers.
Apple says:
"Swift is a new programming language for iOS and OS X apps that builds on the best of C and Objective-C, without the constraints of C compatibility. Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun. Swift’s clean slate, backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works."
Introducing swift
What programming languages can one use to develop iPhone, iPod Touch and iPad (iOs) applications?
Ruby, Python, Lua, Scheme, Lisp, Smalltalk, C#, Haskell, ActionScript, JavaScript, Objective-C, C++, C. That's just the ones that pop into my head right now. I'm sure there's hundreds if not thousands of others. (E.g. there's no reason why you couldn't use any .NET language with MonoTouch, i.e. VB.NET, F#, Nemerle, Boo, Cobra, ...)
Also are there plans in the future to expand the amount of programming languages that iOs will support?
Sure. Pretty much every programming language community on this planet is currently working on getting their language to run on iOS.
Also, a lot of people are working on programming languages specifically designed for touch devices such as iPod touch, iPhone and iPad, e.g. Phil Mercurio's Thyrd language.
The programming language of iOS(and Mac OS) is Objective-C and C. You have to use Xcode platform to develop iOS apps, on the next version that is now available on beta release, Xcode 4 supports also C++.
It is also now possible to use OCaml for developing iOS applications. It is not part of the standard distribution and requires modifications provided by the Psellos company. See here for more information: http://psellos.com/ocaml/.
This might be an old thread, but I'd like to mention Appcelerator Titanium, which allows anyone versed in HTML5/JavaScript/CSS to develop iOS applications.
Only Objective-C is allowed by now... but since a few months ago you are allowed to write scripts that will be interpreted in your application.
So you may be able to write a LUA interpreter or a Python interpreter, then write some part of your application in this scripting language. If you want your application accepted on the App Store, these scripts have to be bundled with the application (your application cannot download it from the Internet for example)
see new app store rules
objective-c is the primary language used.
i believe there is a mono touch framework that can be used with c#
Adobe also is working in some tools, one is this iPhone Packager which can utilize actionscript code
You can use "smart BASIC" programming language. It is a genuine but very advanced BASIC language with all its power and simplicity. Using its free SDK, BASIC code can be easily published as a standalone App Store application. There are many apps in App Store, written in "smart BASIC" programming language.

Do you need Xcode to program iPhone apps?

I'm interested in making apps for the iphone. I was wondering if it were possible to make apps, WITHOUT Xcode. the only reason is because I'm dirt poor, and can't afford an Apple.
If it's games you're interested in developing, then another option might be to take a look at Unity (http://unity3d.com/). This would let you develop on the PC for free in a friendly environment for a beginner. If you then develop something that you decide you want to publish on iPhone, then at that point you could invest in a Mac and just rebuild the Unity app for iPhone on that.
Also, Unity lets you write scripts in both C# and Java so you wouldn't have to learn Obj-C.
The short answer is no. The long answer is "not exactly," but you can get started in some ways while you're working on getting access to a Mac you can do the work you'd like to do on.
"XCode" is more or less really two things:
(1) an IDE
(2) a toolchain with a C/ObjC/C++ compiler (really a version of gcc) and a big library of apps
You don't have to use #1 in order to build iPhone Apps, though it's genuinely helpful. You can get by with #2.
But without #2, you're going to have a hard time building an App you can sell in the App store.
So, it depends on what your goal is.
If it really is to build an app and get it out there, the easiest path is probably going to be to find some way to get access to a machine running OS (probably 10.5 and up) you can do development on. That might be talking a friend who has one into letting you spend some scheduled time on it, or it might be working and saving up for a used intel-based Mac mini (probably something you could get for $300), or it might be turning a PC you've got into a Hackintosh (or maybe setting up a Hackintosh VM on the PC if you're sharing it with others who might not want it transformed thusly :).
If your goal is to start learning how to do things while you work out how you're going to do the above, though, the good news is that it's not hard to get a hold of tools that will help you learn the technologies/languages involved in iPhone apps. Like I said earlier, Apple's compiler is really just a version of gcc. You can probably install gcc on your machine and write objective C programs with it. You could also look into GNUStep which could help you get familiar with a lot of the concepts and practices underlying how the Cocoa libraries work for the iPhone and OS X. And you could learn OpenGL ES, which would be great help if you ever end up working on an iPhone game.
Actually You can develop apps without a Mac. You can use a number of languages and tools that enable writing apps for iOS like:
- Python
- PhoneGap
- Appcelerator
- Mono
- Unity3D
- Unreal Engine
These all can export to iOS.
The only step that requires a Mac is publishing to the app store. But You can use any Mac for that, so You can publish from a friend's/neighbour's or actually anyone's Mac. That is the last step when You're sure everything is running perfectly. Perhaps Your application will earn You Your own Mac.
Also there are a number of publishing service providers in the internet (which don't cost nearly as much as a Mac). I don't remember any particular one at the moment, but I'm sure if You search You will find many. Good luck!
Unfortunately, although there are 'alternatives' (phonegap, mono touch, etc.) I believe you ultimately need Xcode and its tools to package/sign/publish your applications.
If you are really motivated though, you can look about ways of installing Mac OS X on a PC, though that is beyond the scope of this website.
In short, you need a mac. There a number of screwed up ways to do this without a mac, but for all intents and purposes you need a mac. A mac mini you can buy used for $300 on ebay will do the trick. You don't need a powerful machine.
Though Xcode itself is free it does require an Intel based Mac running Snow Leopard. You have 2 options:
Buy a refurbished Mac Pro or Mac mini from Apple website. They are not that expensive. You can use non-Apple peripherals with them to bring down the cost. And you will not be disappointed with quality.
Use Hackintosh to run the OS X on other Intel platform. Its hacky, difficult (carshes) and illegal.
Update:
For Objective C you can refer a pretty good documentation of Objective C language at iPhone developer portal. There are many other documents like memory management and human interface guidelines which should help you get started.
Once you have developed the familiarity with Objective C, you can then browse through various programming guides on iPhone development centre. If you want to follow a systematic approach, you may refer to "Beginning iPhone Development" book which I found pretty good.
Yes it's possible to develop applications for the mac/ipad/iphone without Xcode and without a mac/ipad/iphone.I own a imac,an ipad,and and a mac book pro.I tried to develop in xcode.
After some quick search on the internet I found this http://www.gnustep.org/. This is a framework you can use to develop in the objective C language,using GCC (the GNU compiler).There are other tools you can use,like GNU STEP Application project:this seems to be a sort of IDE (I didn't test it yet).
Yes and no. You can use alternative SDK's but they can be a pain to use and don't offer the publish/signing capabilities that Xcode does.

ARM decompiler available for iPhone

Is there any iphone ARM based decompiler available?
You might have some luck with Ida Pro. It's kind of expensive though. I'm not sure if it has ARM support, but OllyDbg generally does well for my windows project.
(I just looked at it, and OllyDbg doesn't support ARM, but I'm leaving the link because it's still a great program.)
Ida Pro is the disassembler, it translates the binary into human readable ARM assembler.
hex-rays also provides a real decompiler, which translates the disassembled code into C.