added -nostdlib

This commit is contained in:
bellard
2003-04-27 11:45:01 +00:00
parent 7828683e60
commit 2b64f2f570
2 changed files with 21 additions and 12 deletions

View File

@ -778,8 +778,10 @@ static void tcc_add_runtime(TCCState *s1)
int i;
Section *s;
snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.o");
tcc_add_file(s1, buf);
if (!s1->nostdlib) {
snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "libtcc1.o");
tcc_add_file(s1, buf);
}
#ifdef CONFIG_TCC_BCHECK
if (do_bounds_check) {
unsigned long *ptr;
@ -811,7 +813,7 @@ static void tcc_add_runtime(TCCState *s1)
}
#endif
/* add libc if not memory output */
if (s1->output_type != TCC_OUTPUT_MEMORY) {
if (s1->output_type != TCC_OUTPUT_MEMORY && !s1->nostdlib) {
tcc_add_library(s1, "c");
tcc_add_file(s1, CONFIG_TCC_CRT_PREFIX "/crtn.o");
}
@ -1248,12 +1250,14 @@ int tcc_output_file(TCCState *s1, const char *filename)
p = s1->plt->data;
p_end = p + s1->plt->data_offset;
put32(p + 2, get32(p + 2) + s1->got->sh_addr);
put32(p + 8, get32(p + 8) + s1->got->sh_addr);
p += 16;
while (p < p_end) {
if (p < p_end) {
put32(p + 2, get32(p + 2) + s1->got->sh_addr);
put32(p + 8, get32(p + 8) + s1->got->sh_addr);
p += 16;
while (p < p_end) {
put32(p + 2, get32(p + 2) + s1->got->sh_addr);
p += 16;
}
}
}