mirror of
https://github.com/mirror/tinycc.git
synced 2026-08-18 11:03:27 +08:00
Add dwarf support
The new gcc12 release does not support stabs any more. This was a good reason to add support for dwarf. The stabs code still works and is used if configure option --dwarf is not used. Tested on x86_64, i386, arm, arm64, riscv64 with dwarf-5. Some debuggers may not support dwarf-5. Try using older dwarf versions i that case. The tccmacho.c code probably need some support for dwarf. arm-gen.c, arm64-gen.c, i386-gen.c, riscv64-gen.c, x86_64-gen. - fix get_sym_ref symbol size arm-link.c, arm64-link.c, i386-link.c, riscv64-link.c, x86_64-link.c - add R_DATA_32U libtcc.c: - parse -gdwarf option tcc.c: - add dwarf option tcc.h: - add dwarf option and sections tccelf.c: - init dwarf sections - avoid adding sh_addr for dwarf sections - remove dwarf relocs for output dll - add dwarf sections for tccrun tccgen.c: - add dwarf defines + global data - add dwarf_* functions - mix dwarf code with stabs code - a trick is used to emit function name in .debug_line section so only this section has to be parsed instead of .debug_info and .debug_abbrev. - fix init debug_modes tccrun.c: - add dwarf sections in rt_context - init them in tcc_run - add new dwarf code rt_printline_dwarf to find file/function dwarf.h: - New file tcc-doc.texi: - document dwarf configure: - add dwarf option lib/Makefile - change -gstabs into -gdwarf lib/bt-exe.c, tests/tests2/Makefile, tests/tests2/126_bound_global: - Add __bound_init call - Add new testcase to test it
This commit is contained in:
19
libtcc.c
19
libtcc.c
@@ -1722,6 +1722,12 @@ static void args_parser_listfile(TCCState *s,
|
||||
*pargc = s->argc = argc, *pargv = s->argv = argv;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DWARF
|
||||
#define DWARF_VERSION atoi(CONFIG_DWARF)
|
||||
#else
|
||||
#define DWARF_VERSION 0
|
||||
#endif
|
||||
|
||||
PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind)
|
||||
{
|
||||
TCCState *s1 = s;
|
||||
@@ -1819,6 +1825,7 @@ reparse:
|
||||
s->rt_num_callers = atoi(optarg);
|
||||
s->do_backtrace = 1;
|
||||
s->do_debug = 1;
|
||||
s->dwarf = DWARF_VERSION;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_TCC_BCHECK
|
||||
@@ -1826,16 +1833,22 @@ reparse:
|
||||
s->do_bounds_check = 1;
|
||||
s->do_backtrace = 1;
|
||||
s->do_debug = 1;
|
||||
s->dwarf = DWARF_VERSION;
|
||||
break;
|
||||
#endif
|
||||
case TCC_OPTION_g:
|
||||
/* Use "-g" as alias for "-g1". Use "-g0" to disable debug */
|
||||
/* Other common used values: "-g0", "-g1", "-g2" and "-g3" */
|
||||
/* no failure with unsupported options */
|
||||
if (isnum(*optarg))
|
||||
s->do_debug = 1;
|
||||
s->dwarf = DWARF_VERSION;
|
||||
if (*optarg == 'd') {
|
||||
s->dwarf = 5;
|
||||
if (!strncmp(optarg,"dwarf-",6))
|
||||
s->dwarf = atoi(optarg + 6);
|
||||
}
|
||||
else if (isnum(*optarg))
|
||||
s->do_debug = atoi(optarg);
|
||||
else
|
||||
s->do_debug = 1;
|
||||
break;
|
||||
case TCC_OPTION_c:
|
||||
x = TCC_OUTPUT_OBJ;
|
||||
|
||||
Reference in New Issue
Block a user