0

I want to pad each function with a required number of nops using linker script. I figured I would need -ffunction-sections switch during compilation. And add some QUAD(0) in the .text() defination of linker script. But it seems it is not working. Basically I need to pad each function with fixed number of bytes ( not for alignment purposes ). How do I go about it ?

zephyr0110
  • 223
  • 1
  • 11
  • For Context, Why do you want to do this ? – NWS Apr 04 '17 at 05:04
  • Imagine a satellite running a binary. We discover an error in a function. Rather than uplinking full binary(which is costly in terms of bandwidth). Just uplink the new function. – zephyr0110 Apr 04 '17 at 05:06
  • I don’t think this question has anything specifically to do with [tag:ada]! – Simon Wright Apr 04 '17 at 08:49
  • Well, I thought someone will tell me to add macro of nops at end of each function in C. So to avoid that I put a tag that language is ada. Macros are not possible. – zephyr0110 Apr 04 '17 at 12:03
  • 1
    Some Ada implementations allow inline assembly on certain targets, for [example](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/inline_assembler.html). – trashgod Apr 04 '17 at 17:28
  • What system is this? – user3344003 Apr 04 '17 at 20:37
  • Whatever approach you take, how will you ensure that the compiler will not optimize the nop statements out of the executable? – Jim Rogers Apr 05 '17 at 16:27
  • @JimRogers, that’s the reason Prakhar wants to work linker script magic - i.e. post-compilation. – Simon Wright Apr 05 '17 at 16:42
  • System is a Sparc V8 based processor. If there would have been switch to add prologue and epilogue of nops ! – zephyr0110 Apr 05 '17 at 16:53
  • Possible duplicate of [Sparc Function compilation alignment](http://stackoverflow.com/questions/43166369/sparc-function-compilation-alignment) – trashgod Apr 08 '17 at 14:57

0 Answers0