This patch fixes calculating address of label on ppc32 (for -fPIC), I was using gcc as reference. You can try to run this example with and without the patch and see the difference:
unsigned int foo(void) {
return 0;
}
int main() {
L: attribute ((unused));
static const unsigned int arr[] =
{
(unsigned int) &&x - (unsigned int)&&L ,
(unsigned int) &&y - (unsigned int)&&L
};
unsigned int ret = foo();
void* g = (void *) ((unsigned int)&&L + arr[ret]);
goto *g;x:
return 15;
y:
return 25;
}
I don't think that we should be calling setUsesTOCBasePtr outside of 64-bit code.