In this video we will be looking into linker script file.
We know linker performs as part as part of relocation.
It performs section merging and section placement.
So linker script file allows the programmer to control how section sections are merged or in what locations
they are placed in memory.
So if you look at this thing, this is a very simple, uh, linker script file, and it has a particular
syntax which we need to follow.
And first we are writing a sections.
This is very important linker command.
It specifies how sections are to be merged and at what location they are to be placed.
And then you inside this block, this is the block here.
And here you have something known as dollar dot or period.
It represents a location counter.
So here we are initializing the value to zero.
It can be assigned a different value okay.
And then we are specifying here in this uh thing we are saying that we have to uh merge text sections
of this two files okay.
And merge text section of this is a section merging of text section okay.
So very simple.
Uh, linker file, we are saying start at zero zero and this is a section placement.
And then you are saying section merging by asking it to merge the text section of both these things.
Now I can also uh, I can also say this, I can also update this too.
I can use a wildcard wildcard character instead of saying ABC dot zero and diff.
Oh, if I have 4 or 5 files, I need to specify all those files.
I can simply say start.
Okay, here I can say star and I can keep as it is.
So it will what it will do.
It will merge all.
Whatever the dot files are there, it will merge all of this text section of all the files.
I can also do it for the data section.
So if a program is containing both text section and data section, I can perform section merging and
section placement like this.
So I am starting assigning the location counter to zero, and then all the text sections merged and
placed at this particular location.
Then I am updating the location counter to 400 and all the data sections I am placing after 400.
Uh, if I do not have this uh uh, location counter updated, uh, or assign a different value, then
what?
After the text section completes, the data section will be placed.
It will be very adjacent to each other.
But here, uh, using this, I can update.
A different value and I can keep the data section at a different location.
So this is a very simple example of, uh, uh.
Linker script.