HushengGen / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[PATCH] fixing FreeBSD issue with sbrk #599

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It was wrong assembly specifically for FreeBSD in sbrk overriding code.

Please check in this patch that fixes the crash in the corresponding test case 
on BSD.

Original issue reported on code.google.com by yuriv...@gmail.com on 15 Jan 2014 at 12:01

Attachments:

GoogleCodeExporter commented 9 years ago
My guess is dlfcn is not going to work with -static. But on the other hand 
GOTPCREL appears to assume PIC at least. And at least on GNU system libc.a is 
not built with -fPIC.

So perhaps brokenness of -static is preserved.

Would be nice if you could confirm.

Original comment by alkondratenko on 15 Jan 2014 at 6:29

GoogleCodeExporter commented 9 years ago
David, I'm not aware of any better way to CC you. Can you please have a quick 
look at this and post your opinion ?

Original comment by alkondratenko on 18 Jan 2014 at 10:32

GoogleCodeExporter commented 9 years ago
curbrk is the private symbol in FreeBSD's libc, so accessing it from the other 
module like this isn't legal in any case. So the previous assembly was just 
plain wrong in both PIC and !PIC versions.

-static case is still broken on BSD, this patch only makes it work for dynamic 
case which is also a major use case for perftools. I don't see how you can fix 
this to work in -static case without changing libc.

Original comment by yuriv...@gmail.com on 20 Jan 2014 at 6:14

GoogleCodeExporter commented 9 years ago
I'm not able to verify this code, but it looks sane.

I've applied your patch. Thanks.

Original comment by alkondratenko on 20 Jan 2014 at 6:40