Messages in this thread | | | Subject | Re: [PATCH] objtool: Support multiple rodata sections. | From | Allan Xavier <> | Date | Fri, 3 Aug 2018 19:41:32 +0100 |
| |
Hi Josh,
Thanks for your comments, I've sent a v2 with fixes for what you mentioned, but also just wanted to respond to some of your comments directly.
On 26/07/18 17:36, Josh Poimboeuf wrote: > >> + if (strstr(sec->name, ".rodata") == sec->name) { >> + sec->rodata = true; >> + found = true; > > This check is too broad. It will also match the following sections: > > .rodata.str1.8 > .rodata.str1.1 > .rela.rodata > .init.rodata
As written, it doesn't match .rela.rodata or .init.rodata, although you're right that incorrectly matches .rodata.str1.[18] as well as .rodata.<funcname>.str1.[18] when data sections are used.
In the v2 I've addressed this by checking for .str1. before the last character of the section name, I fully admit it's pretty ugly though and the logic could be relaxed for a cleaner implementation, it depends on how strict you want to be.
Alternatively, it could also be possible to key off whether the rodata section has any relocations, which has the additional benefit of narrowing down which rodata sections are likely to contain jump tables.
Let me know what you think of this or if you have any better suggestions.
> Also, the loop should break once it finds an rodata section.
I don't quite understand your point here. If the loop breaks once it has found an .rodata section it would only ever mark that one section as rodata, ignoring the rest?
Thanks, Allan
| |