Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2039 → Rev 2040

/programs/develop/libraries/newlib/Makefile
18,6 → 18,7
crt/chkstk.S \
crt/exit.S \
crt/pseudo-reloc.c \
crt/dllstart.c \
crt/setjmp.S
STATIC_SRCS:= \
204,6 → 205,7
fdopen.c \
fflush.c \
flags.c \
fileno.c \
findfp.c \
fiprintf.c \
fiscanf.c \
/programs/develop/libraries/newlib/crt/chkstk.S
4,8 → 4,8
 
.section .text
 
.def ___chkstk; .scl 2; .type 32; .endef
.def __alloca; .scl 2; .type 32; .endef
#.def ___chkstk; .scl 2; .type 32; .endef
#.def __alloca; .scl 2; .type 32; .endef
___chkstk:
__alloca:
pushl %ecx /* save temp */
/programs/develop/libraries/newlib/crt/crt_amz.S
1,11 → 1,19
 
.section .text
 
.global __start
.global ___main
.global _DllMainCRTStartup
 
 
.section .init
 
.def __start; .scl 2; .type 32; .endef
.def _DllMainCRTStartup; .scl 2; .type 32; .endef
 
.align 4
__start:
_DllMainCRTStartup:
 
call __pei386_runtime_relocator
jmp _main
 
/programs/develop/libraries/newlib/dll.lds
1,8 → 1,6
 
OUTPUT_FORMAT(pei-i386)
 
ENTRY("__start")
 
SECTIONS
{
. = SIZEOF_HEADERS;
/programs/develop/libraries/newlib/pe/loader.c
561,9 → 561,77
nt = MakePtr( PIMAGE_NT_HEADERS32, dos, dos->e_lfanew);
 
return MakePtr(void*, raw, nt->OptionalHeader.AddressOfEntryPoint);
};
 
 
void *get_proc_address(module_t *module, char *proc_name)
{
 
PIMAGE_DOS_HEADER expdos;
PIMAGE_NT_HEADERS32 expnt;
PIMAGE_EXPORT_DIRECTORY exp;
 
uint32_t *exp_functions;
uint16_t *exp_ordinals;
char **exp_names;
 
int minn, maxn;
char *export_name;
uint16_t ordinal;
void *function=NULL;
 
exp = module->img_exp;
 
exp_functions = MakePtr(uint32_t*,exp->AddressOfFunctions,module->start);
exp_ordinals = MakePtr(uint16_t*, exp->AddressOfNameOrdinals,module->start);
exp_names = MakePtr(char**, exp->AddressOfNames,module->start);
 
minn = 0;
maxn = exp->NumberOfNames - 1;
while (minn <= maxn)
{
int mid;
int res;
 
mid = (minn + maxn) / 2;
 
export_name = MakePtr(char*,exp_names[mid],module->start);
 
res = strcmp(export_name, proc_name);
if (res == 0)
{
ordinal = exp_ordinals[mid];
function = MakePtr(void*,exp_functions[ordinal], module->start);
 
if((uint32_t)function >= (uint32_t)exp)
{
printf("forward %s\n", function);
}
else
{
DBG(" \t\tat %x\n", function);
};
break;
}
else if (minn == maxn)
{
DBG(" unresolved %s\n",proc_name);
break;
}
else if (res > 0)
{
maxn = mid - 1;
}
else
{
minn = mid + 1;
}
};
 
return function;
};
 
 
module_t* load_module(const char *name)
{
char *path;
642,7 → 710,18
list_add_tail(&module->list, &dll_list);
 
if( link_image(img_base))
{
int (*dll_startup)(module_t *mod, uint32_t reason);
 
dll_startup = get_proc_address(module, "DllStartup");
if( dll_startup )
{
if( 0 == dll_startup(module, 1))
return 0;
}
return module;
};
 
return NULL;
};
 
/programs/develop/libraries/newlib/static.lds
90,7 → 90,7
. = . + 256;
___pgmname = .;
___menuet__app_path_area = .;
. = . + 1024 + 16;
. = . + 1024 + __size_of_stack_reserve__;
___stacktop = .;
___memsize = . ;
}