This fixes the bug that "tcc -gdwarf ..." still creates the stab debug infos, when tcc was build without using DWARF debug infos by default (configure option: --dwarf=x) -- Regards ... Detlef
Unified · Split
| @@ -1867,9 +1867,10 @@ reparse: · 1866 unmodified lines | |||
| 1867 | #endif | 1867 | #endif |
| 1868 | case TCC_OPTION_g: | 1868 | case TCC_OPTION_g: |
| 1869 | s->do_debug = 1; | 1869 | s->do_debug = 1; |
| 1870 | s->dwarf = DWARF_VERSION; | 1870 | s->dwarf = DWARF_VERSION; |
| 1871 | if (strstart("dwarf-", &optarg)) | 1871 | |
| 1872 | s->dwarf = atoi(optarg); | 1872 | if (strstart("dwarf", &optarg)) |
| 1873 | s->dwarf = (*optarg) ? (0 - atoi(optarg)) : DEFAULT_DWARF_VERSION; | ||
| 1873 | break; | 1874 | break; |
| 1874 | case TCC_OPTION_c: | 1875 | case TCC_OPTION_c: |
| 1875 | x = TCC_OUTPUT_OBJ; | 1876 | x = TCC_OUTPUT_OBJ; |
| @@ -1815,10 +1815,18 @@ ST_FUNC void tcc_tcov_reset_ind(TCCState *s1); · 1814 unmodified lines | |||
| 1815 | #define dwarf_str_section s1->dwarf_str_section | 1815 | #define dwarf_str_section s1->dwarf_str_section |
| 1816 | #define dwarf_line_str_section s1->dwarf_line_str_section | 1816 | #define dwarf_line_str_section s1->dwarf_line_str_section |
| 1817 | 1817 | ||
| 1818 | /* default dwarf version for "-g". use 0 to emit stab debug infos */ | ||
| 1818 | #ifndef DWARF_VERSION | 1819 | #ifndef DWARF_VERSION |
| 1819 | # define DWARF_VERSION 0 | 1820 | # define DWARF_VERSION 0 |
| 1820 | #endif | 1821 | #endif |
| 1821 | 1822 | ||
| 1823 | /* default dwarf version for "-gdwarf" */ | ||
| 1824 | #ifdef TCC_TARGET_MACHO | ||
| 1825 | # define DEFAULT_DWARF_VERSION 2 | ||
| 1826 | #else | ||
| 1827 | # define DEFAULT_DWARF_VERSION 5 | ||
| 1828 | #endif | ||
| 1829 | |||
| 1822 | #if defined TCC_TARGET_PE | 1830 | #if defined TCC_TARGET_PE |
| 1823 | # define R_DATA_32DW 'Z' /* fake code to avoid DLL relocs */ | 1831 | # define R_DATA_32DW 'Z' /* fake code to avoid DLL relocs */ |
| 1824 | #elif defined TCC_TARGET_X86_64 | 1832 | #elif defined TCC_TARGET_X86_64 |