How to create an low-level object file? [closed] - c

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Basically what I want is to create an object file (maybe x64 ELF one) with assembly code which could then be linked with other object files in order to create one executable. Also I would like to export some addresses from this object and also to import some from the other object files it will link to.
I'll be happy if it can target linux x64 (I'm using OpenSuse now) and can be used with some default linker (like 'ld' maybe).
I want to make a compiler using 'C' language.

Just generate assembly code, and use the assembler to convert to object format.

Related

Changing values of CPU registers under GNU/Linux [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is it possible to change values of CPU registers under GNU/Linux with help of C programming language code?
To answer your question: Using standard C then no it's not possible.
But some compilers have extensions to allow you to write inline assembler. Also, you can write your own assembler files and have functions that can be called from your C source in them. Use an assembler to create object files that you link with the rest of your program.

Developing a custom filesystem for an operating system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am developing an operating system using C, Assembler and the GCC Cross Compiler. I have already implemented a working kernel that prints to the screen and allows the user to type in some simple commands. I have already looked into some file systems such as FAT32 and LFS. What other options do I have about implementing my very own filesystem?
There's always Practical File System Design with the Be File System (PDF).

Does .obj file contains machine code in binary language? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am confused about .obj files created using C language. Does they contain machine code and is the machine code in binary language, as it is known that the machine can understand only binary language. Moreover, my thinking of machine code is that it is a set of machine instructions in binary language (I may be wrong). Please explain.
An object file is a file containing object code, meaning relocatable format machine code that is usually not directly executable. .obj is the compiled object file that is used by the linker (along with the necessary library (.h) files) to create an executable. The executable is then loaded into the memory for execution using a loader.
Please read the following for more information-
What is compiler, linker, loader?

Building go linker as a stand alone tool [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I was browsing the go source and I wanted to build it as a standalone linker for osx that can generate mach-o files. Is there anyway to do this?
The linker is already a standalone tool. You can see it by running
go tool -n 6l
which will print the location of the 6l (x86 64 bit linker) executable.
The source code of 6l can be found in GOROOT/src/cmd/6l.
In that directory you can use make to build it.

How to find built directory string in C exec.file? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
while reading docs for FreeBSD 7.3 gdb, I saw a mention of built directory info stored in binary files. How is it stored, and how could it be retrieved?
If a binary is built with debug info, then it will contain debug symbol information that contains full path names, so when you debug, your debugger can find source files and correlate source code with execution. Open the binary file in any hex editor and you will be able to see the path strings

Resources