This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD] PowerPC64 TOC indirect to TOC relative code editing
> Huh, I first wrote a patch that used the original for loop and decided
> it was cleaner to use do {} while(). You need an extra variable too,
> which probably will not be eliminated by a compiler.
>
> if (start == 0)
> start = 1;
> for (unsigned int i = 1; i < shnum; ++i)
> {
> unsigned int rel_shndx = i + start - 1;
> if (rel_shndx >= shnum)
> rel_shndx = i - shnum + 1;
> const unsigned char* p = pshdrs + rel_shndx * This::shdr_size;
>
> If I keep the do..while, where did you want the parens? Like this?
>
> } while ((i = (i + 1 == shnum) ? 1 : i + 1) != start);
>
> Now that you've seen the for loop option, which do you prefer?
Let me think about this. I'm thinking of something a bit more
ambitious (but just a bit).
-cary