Wow @ESP_igrr, that code (in binutils-gdb) is handy! That definitely seems to document all the arithmetic needed for the possible XTENSA relocs. I do have one question there about the binutils code: when I parse an xtensa ELF binary, I see tiny sections just for the relocs for each section e.g. `.rela.text`. So, I'm thinking that the `rela` refers to the type of relocation that stores all info within the relocation info, and doesn't require reading the address from the `.text` section as part of the arithmetic (which would be `rel`, not `rela`). But the calculation for R_XTENSA_32 in binutils appears like it does do a `rel`? See line 1876 here:
https://sourceware.org/git/gitweb.cgi?p ... HEAD#l1876
Am I missing something? Either the ELF section name is misleading, or binutils is wrong, or I haven't grasped it yet.
Now I have some questions about the resulting ELF binary, specifically some extra sections I wasn't expecting (especially after running `strip --strip-unneeded -g -x` to produce a stripped binary, the sections still remain):
I'm sure I can get rid of the first two, just seems odd that `strip --strip-unneeded` didn't do that.
I'm especially curious as to the .xt.lit and .xt.prop sections as I haven't seen those before. I can just reloc them as well, but would be nice to know if I can just strip them and/or what the tradeoff would be. Or if there is a doc about what those sections do I'd be happy to read it! The best I could find so far was this thread (which seems to indicate they are useful, but optional?):
http://lists.linux-xtensa.com/pipermail ... 01150.html