Viewing Issue Simple Details
[ Jump to Notes ]
|
[ View Advanced ]
[ Issue History ]
[ Print ]
|
ID |
Category |
Severity |
Reproducibility |
Date Submitted |
Last Update |
0000553 |
[uClibc] Architecture Specific |
minor |
always |
11-21-05 08:34 |
11-21-05 15:57 |
|
Reporter |
Melange |
View Status |
public |
|
Assigned To |
uClibc |
Priority |
normal |
Resolution |
fixed |
|
Status |
closed |
|
Product Version |
0.9.28 |
|
Summary |
0000553: ldd segfaults on non-linux systems |
Description |
ldd fails with a 'Segmentation violation' error, regardless of the file it is given as a parameter. Running "ldd --help" works though. |
Additional Information |
I've spotted the reason for this: The bswap_32() function in utils/bswap.h is incorrect. It uses swab() to perform the byte-swapping, but that's the wrong function for this job. From the swab() man page: "This function copies N bytes from the memory region pointed to by IN to the memory region pointed to by OUT, exchanging adjacent even and odd bytes." - pretty clear actually, that'll work for 16, but never for 32 bits (maps AABBCCDD => BBAADDCC instead of DDCCBBAA).
I've hacked up my own implementation of bswap_32() and now ldd works just fine (ldd.target too btw). I don't think I need to paste the code here, swapping 4 bytes is just too trivial (one ought to think :).
This piece of code comes only into play #ifndef __linux__, that's why the topic of this issue says that this affects non-linux systems only.
Tested under Cygwin, building a cross-toolchain here with uClibc 0.9.19, but I've looked into the sources of 0.9.28 and there's still the same bug. |
|
Attached Files |
|
|