about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-04 00:37:33 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-04 00:37:33 -0400
commit5bd0ab8af66829af74ed80cac767ce1c041fd767 (patch)
tree0e4c9ae49ee2aea74348ae866a2cdb0197ce2315 /lib
parent450f2c4a8515f2c5c9f469082bf69fdef009d26a (diff)
downloadmusl-5bd0ab8af66829af74ed80cac767ce1c041fd767.tar.gz
musl-5bd0ab8af66829af74ed80cac767ce1c041fd767.tar.xz
musl-5bd0ab8af66829af74ed80cac767ce1c041fd767.zip
work around nasty gcc bug in the i386 syscall asm
when the "r" (register) constraint is used to let gcc choose a
register, gcc will sometimes assign the same register that was used
for one of the other fixed-register operands, if it knows the values
are the same. one common case is multiple zero arguments to a syscall.
this horribly breaks the intended usage, which is swapping the GOT
pointer from ebx into the temp register and back to perform the
syscall.

presumably there is a way to fix this with advanced usage of register
constaints on the inline asm, but having bad memories about hellish
compatibility issues with different gcc versions, for the time being
i'm just going to hard-code specific registers to be used. this may
hurt the compiler's ability to optimize, but it will fix serious
miscompilation issues.

so far the only function i know what compiled incorrectly is
getrlimit.c, and naturally the bug only applies to shared (PIC)
builds, but it may be more extensive and may have gone undetected..
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions