Chaining Atoms together

Hi Nick,

Thanks for your reply.

The usecase here is just trying to construct a valid ELF. The lld linker needs to handle all sorts of code written in assembly as well as 'C'. The usecase is just one example of it.

I have also seen similiar code in http://lxr.free-electrons.com/source/arch/powerpc/kernel/head_32.S?a=powerpc which has global and local labels.

You are right, that the function has multiple entry points. You can remove the .local directive too.

Thanks

Shankar Easwaran

Hi Nick,

Waiting for your feedback on this.

Thanks

Shankar Easwaran

Ping ?

Hi Nick,

Waiting for your feedback on this.

It seems the crux of the issue is that in ELF, an assembly programmer can put any random value into the .size directive and you want to faithfully reproduce that st_size value in the final executable.

Given that the atom model already has a "size" for atoms and for any compiler generated code that size will be the same as the st_size, I don't think we should add a new kind of "size" attribute to the atom model. It would only be used by odd hand written ELF assembly files. I think a better way to handle extra info like this is to have the ELF Reader add a new Reference to DefinedAtoms if and only if the st_size does not match the computed atom size. The Reference has no target and some special kind value known only to the ELF Reader and Writer. The ELF Writer normally sets the st_size field based on the atom size, but it the atom contains one of these special Refererences, the st_size comes from the Reference addend.

-Nick