Also, ich habe ein bischen nachgeforscht in dem ich mir assembler code beim gcc generiren lassen habe.
Es sieht so aus, Fehlerquelle bold markiert.
_nl_load_locale:
.LFB58:
.loc 1 134 0
stwu 1,-176(1)
.LCFI3:
mflr 0
stw 0,180(1)
.LCFI4:
stmw 22,136(1)
.LCFI5:
.loc 1 143 0
.LBB6:
li 0,0
.loc 1 134 0
mr 25,3
.loc 1 140 0
li 23,1
.loc 1 145 0
lwz 3,0(3)
.loc 1 134 0
mfcr 12
mr 31,1
.LCFI6:
.loc 1 143 0
stw 0,8(25)
.loc 1 134 0
mr 22,4
.loc 1 142 0
stw 23,4(25)
.loc 1 145 0
li 4,0
.loc 1 134 0
stw 12,132(1)
.LCFI7:
.loc 1 145 0
bl __open
.loc 1 146 0
cmpwi 0,3,0
.loc 1 145 0
mr 28,3
.loc 1 146 0
blt- 0,.L22
.loc 1 150 0
addi 30,31,16
li 3,3
mr 4,28
mr 5,30
bl __fxstat64
cmpwi 0,3,0
blt- 0,.L25
.loc 1 156 0
lwz 0,32(31)
rlwinm 0,0,0,16,19
cmpwi 0,0,16384
beq- 0,.L45
.L26:
.loc 1 182 0
bl __errno_location
.loc 1 192 0
lwz 4,68(31)
.loc 1 182 0
mr 27,3
.loc 1 192 0
li 5,1
li 3,0
li 6,2
mr 7,28
li 8,0
.loc 1 182 0
lwz 24,0(27)
.loc 1 192 0
bl __mmap
.loc 1 194 0
cmpwi 7,3,0
cmpwi 0,3,4660
.loc 1 192 0
mr 29,3
.loc 1 194 0
mfcr 26
rlwinm 26,26,28,0xf0000000
beq- 0,.L46
.L29:
.loc 1 228 0
mr 3,28
bl __close
.loc 1 230 0
mtcrf 128,26
beq- 0,.L22
.loc 1 234 0
lwz 5,68(31)
mr 3,22
mr 4,29
bl _nl_intern_locale_data
.loc 1 235 0
cmpwi 0,3,0
beq- 0,.L47
.loc 1 246 0
li 0,0
.loc 1 249 0
stw 3,8(25)
.loc 1 246 0
stw 0,0(3)
.loc 1 247 0
stw 23,12(3)
.loc 1 250 0
.L22:
Und das ist die Funktion von dem das Assembler Code entstanden.
Code: Alles auswählen
_nl_load_locale (struct loaded_l10nfile *file, int category)
{
int fd;
void *filedata;
struct stat64 st;
struct locale_data *newdata;
int save_err;
int alloc = ld_mapped;
file->decided = 1;
file->data = ((void *)0);
fd = __open (file->filename, 00);
if (__builtin_expect (fd, 0) < 0)
return;
if (__builtin_expect (__fxstat64 (3, fd, &st), 0) < 0)
{
puntfd:
__close (fd);
return;
}
if (__builtin_expect (((((st.st_mode)) & 0170000) == (0040000)), 0))
{
char *newp;
size_t filenamelen;
__close (fd);
filenamelen = strlen (file->filename);
newp = (char *) __builtin_alloca (filenamelen + 5 + _nl_category_name_sizes[category] + 1);
(__extension__ (__builtin_constant_p (_nl_category_names[category]) && __builtin_constant_p (_nl_category_name_sizes[category] + 1) && ((size_t)(const void *)((_nl_category_names[category]) + 1) - (size_t)(const void *)(_nl_category_names[category]) == 1) && _nl_category_name_sizes[category] + 1 <= 8 ? __builtin_memcpy ((__extension__ (__builtin_constant_p ("/SYS_") && __builtin_constant_p (5) && ((size_t)(const void *)(("/SYS_") + 1) - (size_t)(const void *)("/SYS_") == 1) && 5 <= 8 ? __builtin_memcpy ((__extension__ (__builtin_constant_p (file->filename) && __builtin_constant_p (filenamelen) && ((size_t)(const void *)((file->filename) + 1) - (size_t)(const void *)(file->filename) == 1) && filenamelen <= 8 ? __builtin_memcpy (newp, file->filename, filenamelen) + (filenamelen) : __mempcpy (newp, file->filename, filenamelen))), "/SYS_", 5) + (5) : __mempcpy ((__extension__ (__builtin_constant_p (file->filename) && __builtin_constant_p (filenamelen) && ((size_t)(const void *)((file->filename) + 1) - (size_t)(const void *)(file->filename) == 1) && filenamelen <= 8 ? __builtin_memcpy (newp, file->filename, filenamelen) + (filenamelen) : __mempcpy (newp, file->filename, filenamelen))), "/SYS_", 5))), _nl_category_names[category], _nl_category_name_sizes[category] + 1) + (_nl_category_name_sizes[category] + 1) : __mempcpy ((__extension__ (__builtin_constant_p ("/SYS_") && __builtin_constant_p (5) && ((size_t)(const void *)(("/SYS_") + 1) - (size_t)(const void *)("/SYS_") == 1) && 5 <= 8 ? __builtin_memcpy ((__extension__ (__builtin_constant_p (file->filename) && __builtin_constant_p (filenamelen) && ((size_t)(const void *)((file->filename) + 1) - (size_t)(const void *)(file->filename) == 1) && filenamelen <= 8 ? __builtin_memcpy (newp, file->filename, filenamelen) + (filenamelen) : __mempcpy (newp, file->filename, filenamelen))), "/SYS_", 5) + (5) : __mempcpy ((__extension__ (__builtin_constant_p (file->filename) && __builtin_constant_p (filenamelen) && ((size_t)(const void *)((file->filename) + 1) - (size_t)(const void *)(file->filename) == 1) && filenamelen <= 8 ? __builtin_memcpy (newp, file->filename, filenamelen) + (filenamelen) : __mempcpy (newp, file->filename, filenamelen))), "/SYS_", 5))), _nl_category_names[category], _nl_category_name_sizes[category] + 1)));
fd = __open (newp, 00);
if (__builtin_expect (fd, 0) < 0)
return;
if (__builtin_expect (__fxstat64 (3, fd, &st), 0) < 0)
goto puntfd;
}
save_err = (*__errno_location ());
#define MAP_COPY MAP_PRIVATE
filedata = __mmap ((caddr_t) 0, st.st_size,
0x1, 0x000|0x002, fd, 0);
if (__builtin_expect (filedata == ((void *) -1), 0))
{
if (__builtin_expect ((*__errno_location ()), 38) == 38)
{
alloc = ld_malloced;
filedata = malloc (st.st_size);
if (filedata != ((void *)0))
{
off_t to_read = st.st_size;
ssize_t nread;
char *p = (char *) filedata;
while (to_read > 0)
{
nread = __read (fd, p, to_read);
if (__builtin_expect (nread, 1) <= 0)
{
free (filedata);
if (nread == 0)
((*__errno_location ()) = (22));
goto puntfd;
}
p += nread;
to_read -= nread;
}
((*__errno_location ()) = (save_err));
}
}
}
__close (fd);
if (__builtin_expect (filedata == ((void *)0), 0))
return;
newdata = _nl_intern_locale_data (category, filedata, st.st_size);
if (__builtin_expect (newdata == ((void *)0), 0))
{
if (alloc == ld_mapped)
__munmap ((caddr_t) filedata, st.st_size);
return;
}
newdata->name = ((void *)0);
newdata->alloc = alloc;
file->data = newdata;
}
Leider weiter meine Assembler Kenntnisse sind nicht ausreichend. Aber ich vermute es liegt and dem statement, nämlich "(void*)-1"
if (__builtin_expect (filedata == ((void *) -1), 0))
Oder an etwas in der Art.
Ich würde mich sehr freuen auf ein Workarond für das Problem oder ein Tip. Wenn jemand Lust und Ahnung hat ich kann die drei loadlocale Dateien per mail zu senden.
loadlocale.c // sources
loadlocale.i //preprocessed sources
loadlocale.s //assembler code
Danke in voraus