0

For a project we are looking for way to store strings without past by .data. Indeed we want to store them on the fly during the all execution of our program.

We saw things like that at beginning of programms :

.data 
  hello : .asciiz "hello world"

But we want to store them in the stack-segment during all execution

Thanks for future help

Erend
  • 11
  • 3
  • You can store it on the stack if you write code that places it on the stack. There is no compile-time directive for it. You can also copy a string from `.data` to stack, but you need code for that too. – Jester Nov 17 '17 at 22:48
  • We are writing a compiler and we only have const string so we need to know if we can delete them after we used them – Erend Nov 17 '17 at 22:52
  • Not sure what you mean by that and why you want to delete them. Anyway, you can overwrite them with zeroes or whatever. If they are at the end of your `.data` and you have no `.bss` you might be able to reduce memory by `brk`. You could also have it in a non-loaded section of your binary and `mmap`/`munmap` as needed. I think all of this is probably overkill, just keep the constants and move on. – Jester Nov 19 '17 at 13:48
  • Thanks for these precisions ! – Erend Nov 19 '17 at 17:47

0 Answers0