Skip to content

Commit 56481d5

Browse files
author
grischka
committed
bored...
/* Use "-g" as alias for "-g1". Use "-g0" to disable debug */ So not using -g is now the alias for -g0 ?!? This reverts commit 8759b25. This reverts commit 3ce7bc6. This reverts commit 5fb582a. This reverts commit aea68db. This reverts commit fa9c31c. This reverts commit b3bebdb. This reverts commit ecf8e5a. This reverts commit fe6b5c0. This reverts commit e2e5377. This reverts commit 1cd7998.
1 parent 1cd7998 commit 56481d5

File tree

18 files changed

+76
-124
lines changed

18 files changed

+76
-124
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ c2str
2828
tags
2929
TAGS
3030
tcc.1
31-
tcc.pod
31+
*.pod
3232
tcc-doc.html
3333
tcc-doc.info
3434

Makefile

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ ifndef TOP
88
INCLUDED = no
99
endif
1010

11-
# Uncomment the next two commands to allow debug this Makefile
12-
# When enabled, GNU make will no longer execute commands directly.
13-
# All build commands will be executed using the shell. This needs more time
14-
#OLD_SHELL := $(SHELL)
15-
#SHELL = $(info Building $* $(if $<, (from $<))$(if $?, ($? newer)))$(OLD_SHELL)
16-
1711
ifeq ($(findstring $(MAKECMDGOALS),clean distclean),)
1812
include $(TOP)/config.mak
1913
endif
@@ -244,7 +238,7 @@ endif
244238

245239
# convert "include/tccdefs.h" to "tccdefs_.h"
246240
%_.h : include/%.h conftest.c
247-
$S$(CC) -DC2STR $(filter %.c,$^) -o c2str$(EXESUF) && ./c2str$(EXESUF) $< $@
241+
$S$(CC) -DC2STR $(filter %.c,$^) -o c2str.exe && ./c2str.exe $< $@
248242

249243
# target specific object rule
250244
$(X)%.o : %.c $(LIBTCC_INC)
@@ -261,7 +255,7 @@ tcc$(EXESUF): tcc.o $(LIBTCC)
261255
# Cross Tiny C Compilers
262256
# (the TCCDEFS_H dependency is only necessary for parallel makes,
263257
# ala 'make -j x86_64-tcc i386-tcc tcc', which would create multiple
264-
# c2str and tccdefs_.h files in parallel, leading to access errors.
258+
# c2str.exe and tccdefs_.h files in parallel, leading to access errors.
265259
# This forces it to be made only once. Make normally tracks multiple paths
266260
# to the same goals and only remakes it once, but that doesn't work over
267261
# sub-makes like in this target)
@@ -332,6 +326,8 @@ tcc.1 : tcc-doc.pod
332326
%.pod : %.texi
333327
$(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@)
334328

329+
doc : $(TCCDOCS)
330+
335331
# --------------------------------------------------------------------------
336332
# install
337333

@@ -410,10 +406,6 @@ tags : ; ctags $(TAGFILES)
410406
# cannot have both tags and TAGS on windows
411407
ETAGS : ; etags $(TAGFILES)
412408

413-
# documentation
414-
doc: tcc-doc.html tcc-doc.info tcc.1
415-
416-
417409
# create release tarball from *current* git branch (including tcc-doc.html
418410
# and converting two files to CRLF)
419411
TCC-VERSION = tcc-$(VERSION)
@@ -443,15 +435,16 @@ testspp.%:
443435
@$(MAKE) -C tests/pp $@
444436

445437
clean:
446-
@rm -f tcc$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) tcc.pod tags ETAGS
438+
@rm -f tcc$(EXESUF) tcc_p$(EXESUF) *-tcc$(EXESUF) tags ETAGS *.pod
447439
@rm -f *.o *.a *.so* *.out *.log lib*.def *.exe *.dll a.out *.dylib *_.h
448440
@$(MAKE) -s -C lib $@
449441
@$(MAKE) -s -C tests $@
450442

451443
distclean: clean
452-
@rm -fv config.h config.mak config.texi tcc.1 tcc-doc.info tcc-doc.html
444+
@rm -fv config.h config.mak config.texi
445+
@rm -fv $(TCCDOCS)
453446

454-
.PHONY: all clean test tar tags ETAGS distclean install uninstall FORCE
447+
.PHONY: all clean test tar tags ETAGS doc distclean install uninstall FORCE
455448

456449
help:
457450
@echo "make"

arm-asm.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,6 @@ static int asm_parse_vfp_regvar(int t, int double_precision)
7777
return -1;
7878
}
7979

80-
__attribute__((unused))
81-
static int asm_parse_vfp_status_regvar(int t)
82-
{
83-
switch (t) {
84-
case TOK_ASM_fpsid:
85-
return 0;
86-
case TOK_ASM_fpscr:
87-
return 1;
88-
case TOK_ASM_fpexc:
89-
return 8;
90-
default:
91-
return -1;
92-
}
93-
}
94-
9580
/* Parse a text containing operand and store the result in OP */
9681
static void parse_operand(TCCState *s1, Operand *op)
9782
{
@@ -2240,6 +2225,20 @@ static void asm_floating_point_data_processing_opcode(TCCState *s1, int token) {
22402225
asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode1, ops[0].reg, (ops[1].type == OP_IM8) ? ops[1].e.v : ops[1].reg, (ops[2].type == OP_IM8) ? ops[2].e.v : ops[2].reg, opcode2, 0);
22412226
}
22422227

2228+
static int asm_parse_vfp_status_regvar(int t)
2229+
{
2230+
switch (t) {
2231+
case TOK_ASM_fpsid:
2232+
return 0;
2233+
case TOK_ASM_fpscr:
2234+
return 1;
2235+
case TOK_ASM_fpexc:
2236+
return 8;
2237+
default:
2238+
return -1;
2239+
}
2240+
}
2241+
22432242
static void asm_floating_point_status_register_opcode(TCCState* s1, int token)
22442243
{
22452244
uint8_t coprocessor = CP_SINGLE_PRECISION_FLOAT;

arm-link.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ enum float_abi {
2828

2929
#include "tcc.h"
3030

31+
#ifdef NEED_RELOC_TYPE
3132
/* Returns 1 for a code relocation, 0 for a data relocation. For unknown
3233
relocations, returns -1. */
3334
int code_reloc (int reloc_type)
@@ -107,7 +108,7 @@ int gotplt_entry_type (int reloc_type)
107108
return -1;
108109
}
109110

110-
#ifndef TCC_TARGET_PE
111+
#ifdef NEED_BUILD_GOT
111112
ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr)
112113
{
113114
Section *plt = s1->plt;
@@ -177,6 +178,7 @@ ST_FUNC void relocate_plt(TCCState *s1)
177178
}
178179
}
179180
#endif
181+
#endif
180182

181183
void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val)
182184
{

arm64-link.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "tcc.h"
2424

25+
#ifdef NEED_RELOC_TYPE
2526
/* Returns 1 for a code relocation, 0 for a data relocation. For unknown
2627
relocations, returns -1. */
2728
int code_reloc (int reloc_type)
@@ -91,7 +92,7 @@ int gotplt_entry_type (int reloc_type)
9192
return -1;
9293
}
9394

94-
__attribute__((unused))
95+
#ifdef NEED_BUILD_GOT
9596
ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr)
9697
{
9798
Section *plt = s1->plt;
@@ -111,7 +112,6 @@ ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_
111112

112113
/* relocate the PLT: compute addresses and offsets in the PLT now that final
113114
address for PLT and GOT are known (see fill_program_header) */
114-
__attribute__((unused))
115115
ST_FUNC void relocate_plt(TCCState *s1)
116116
{
117117
uint8_t *p, *p_end;
@@ -166,6 +166,8 @@ ST_FUNC void relocate_plt(TCCState *s1)
166166
}
167167
}
168168
}
169+
#endif
170+
#endif
169171

170172
void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val)
171173
{

configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ mandir=""
2727
infodir=""
2828
sysroot=""
2929
cross_prefix=""
30-
test -z "$CC" && CC="gcc"
31-
test -z "$cc" && cc="$CC"
30+
cc="gcc"
3231
ar="ar"
3332
bigendian="no"
3433
mingw32="no"
@@ -46,7 +45,7 @@ confvars=
4645
suggest="yes"
4746
gcc_major=0
4847
gcc_minor=0
49-
cc_name="$cc"
48+
cc_name="gcc"
5049
ar_set=
5150
darwin=
5251
cpu=
@@ -408,6 +407,7 @@ if test "$cc_name" != "tcc"; then
408407
OPT1="-Wdeclaration-after-statement -fno-strict-aliasing"
409408
# we want -Wno- but gcc does not always reject unknown -Wno- options
410409
OPT2="-Wpointer-sign -Wsign-compare -Wunused-result -Wformat-truncation"
410+
OPT2="$OPT2 -Wstringop-truncation"
411411
if test "$cc_name" = "clang"; then
412412
OPT1="$OPT1 -fheinous-gnu-extensions"
413413
OPT2="$OPT2 -Wstring-plus-int"

i386-asm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode)
833833
goto next;
834834
alltypes |= ops[i].type;
835835
}
836+
(void)alltypes; /* maybe unused */
836837
/* all is matching ! */
837838
break;
838839
next: ;

i386-link.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "tcc.h"
2525

26-
#ifndef ELF_OBJ_ONLY
26+
#ifdef NEED_RELOC_TYPE
2727
/* Returns 1 for a code relocation, 0 for a data relocation. For unknown
2828
relocations, returns -1. */
2929
int code_reloc (int reloc_type)
@@ -92,6 +92,7 @@ int gotplt_entry_type (int reloc_type)
9292
return -1;
9393
}
9494

95+
#ifdef NEED_BUILD_GOT
9596
ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr)
9697
{
9798
Section *plt = s1->plt;
@@ -169,6 +170,7 @@ ST_FUNC void relocate_plt(TCCState *s1)
169170
}
170171
}
171172
#endif
173+
#endif
172174

173175
void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val)
174176
{

libtcc.c

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ LIBTCCAPI void tcc_delete(TCCState *s1)
836836
tcc_free(s1->tcc_lib_path);
837837
tcc_free(s1->soname);
838838
tcc_free(s1->rpath);
839+
tcc_free(s1->elf_entryname);
839840
tcc_free(s1->init_symbol);
840841
tcc_free(s1->fini_symbol);
841842
tcc_free(s1->outfile);
@@ -1567,23 +1568,6 @@ static const TCCOption tcc_options[] = {
15671568
{ NULL, 0, 0 },
15681569
};
15691570

1570-
typedef struct stdvalue {
1571-
uint32_t cversion;
1572-
const char * name;
1573-
} stdvalue;
1574-
1575-
/* accepted values for the -std= option */
1576-
static const stdvalue std_values[] = {
1577-
{ 199901, "c99" },
1578-
{ 201112, "c11" },
1579-
{ 201710, "c17" },
1580-
{ 202000, "c2x" },
1581-
{ 199901, "gnu99" },
1582-
{ 201112, "gnu11" },
1583-
{ 201710, "gnu17" },
1584-
{ 202000, "gnu2x" }
1585-
};
1586-
15871571
typedef struct FlagDef {
15881572
uint16_t offset;
15891573
uint16_t flags;
@@ -1837,18 +1821,13 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind)
18371821
break;
18381822
#endif
18391823
case TCC_OPTION_g:
1840-
/* Use "-g" as alias for "-g1". Use "-g0" to disable debug */
1841-
/* Other common used values: "-g0", "-g1", "-g2" and "-g3" */
1842-
/* no failure with unsupported options */
18431824
s->do_debug = 1;
18441825
s->dwarf = DWARF_VERSION;
18451826
if (*optarg == 'd') {
18461827
s->dwarf = 5;
18471828
if (!strncmp(optarg,"dwarf-",6))
18481829
s->dwarf = atoi(optarg + 6);
18491830
}
1850-
else if (isnum(*optarg))
1851-
s->do_debug = atoi(optarg);
18521831
break;
18531832
case TCC_OPTION_c:
18541833
x = TCC_OUTPUT_OBJ;
@@ -1873,21 +1852,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind)
18731852
s->static_link = 1;
18741853
break;
18751854
case TCC_OPTION_std:
1876-
x = 0;
1877-
if (*optarg == '=') {
1878-
do {
1879-
if (strcmp(std_values[x].name, &optarg[1]) == 0) {
1880-
x = std_values[x].cversion;
1881-
}
1882-
else
1883-
++x;
1884-
} while (x < (sizeof(std_values)/sizeof(stdvalue)));
1885-
}
1886-
if (x > (sizeof(std_values)/sizeof(stdvalue)))
1887-
s->cversion = x;
1888-
else
1889-
goto unsupported_option;
1890-
1855+
if (strcmp(optarg, "=c11") == 0)
1856+
s->cversion = 201112;
18911857
break;
18921858
case TCC_OPTION_shared:
18931859
x = TCC_OUTPUT_DLL;
@@ -2018,11 +1984,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind)
20181984
s->filetype = x | (s->filetype & ~AFF_TYPE_MASK);
20191985
break;
20201986
case TCC_OPTION_O:
2021-
/* Use "-O" as alias for "-O1". */
2022-
/* Other common used values: "-O0", "-O1", "-O2", "-O3" and "-Os" */
2023-
/* no failure with unsupported options */
2024-
x = *optarg;
2025-
s->optimize = isnum(x) ? atoi(optarg) : (x) ? x : 1;
1987+
s->optimize = atoi(optarg);
20261988
break;
20271989
case TCC_OPTION_print_search_dirs:
20281990
x = OPT_PRINT_DIRS;

tcc-doc.texi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ Turn on/off linking of all objects in archives.
349349
Debugger options:
350350

351351
@table @option
352-
@item -g[x]
352+
@item -g
353353
Generate run time stab debug information so that you get clear run time
354354
error messages: @code{ test.c:68: in function 'test5()': dereferencing
355355
invalid pointer} instead of the laconic @code{Segmentation

0 commit comments

Comments
 (0)