Reputation: 675
I read that every processor has its own assembly language, so is every processor has it own assembly or every architecture? How OS and programming languages work on different assemblies?
Upvotes: 5
Views: 1935
Reputation: 461
The process of assembling code is to translate opcodes - expressed as text - into binary.
Basically, you can say that each processor has its own instruction set. Binary code for a different processor will simply not run - or if the platform differences are only marginal, run and produce unexpected results (well, not really unexpected). This is why multiple install packages/CDs/DVDs for the very same program/OS exist for different platforms.
E.g. gcc
(GNU Compiler Collection) provides for the same release a variety of packages (see "Download gcc"),
built from the same (high-level) source code, but for different hardware architectures.
Upvotes: 4
Reputation: 191
each architecture has its own assembly language. and even within architectures there might be extensions which add extra commands (like the SSE extensions). Usually a Compiler can only create code for one architecture, and there might be optional flags which enable optimizations for the extensions. When these flags get enabled the program will usually only run on processors that support these extensions.
For programs and OS it usually means you should only use compiler options that are supported by all processors of the architecture they have to run on. If thats not optimized enough you have to deliver executables/libraries with multiple code paths for he different optimizations, and pick the right one at runtime.
Upvotes: 4