So in this example we'll update the sum of array code.
This is the sum of array code which is using text section will update uh this code to use store this
value in the data section.
So how do we what modifications are needed.
I'll first I'll say uh keep the I'll do not need this uh branch statement.
And I do not need this line because we are now aligning in the linker script.
So I'll delete this one and I'll say my text section starts here.
And this is my.
Uh, data section.
So very simple change I have made.
I have placed this in the data section.
I'm informing assembler, like you keep this in the data section and you keep the remaining everything
in the text section.
Now we will also have a linker script file here.
Uh, simple linker script which we have seen in the previous video here.
Here we are saying uh, assigning the location counter to zero.
So we are saying text section keep in zero location.
And the data section, uh, keep it location for double zero.
We don't have multiple object files.
For now we have only one object file.
So that should be fine.
Uh.
So what I will do, I will compile this one first.
Assembler.
Uh, some dot o and some dot s.
Now I have an object file.
Now I'm giving.
How how do I pass this to the linker.
So how how can I pass the linker script file?
Previously we used to text write zero.
Now instead of using that I can say I can pass a linker script file.
So um, an LD instead of D text and passing a linker script file.
So I'll say t some data LDS.
And now I can create an elf file as well as an input.
Now I have an Elf file and now I can dump the symbols.
Now, if you see here, uh, text section is placed with the address zero zero and section data section
is placed at the address for double zero.
This is what we have specified in the linker script file.
So this is a section placement.
We don't we have not done section merging because there was only one O file.
If you had multiple O files then linker will perform section merging.
But in this example using a linker script file we have performed section merging section merging here
merging not section merging we have performed section placement.
We have kept uh data section at address for double zero.
And we have kept the text section at address zero.