Perhaps -ggdb should imply -gstabs+ instead of -gdwarf-2 on Solaris
until DWARF2 is made to work?
Here are the symptoms of the problem:
$ cat t.c
main() { return 0; }
$ gcc -g t.c
$ gcc -gstabs+ t.c
$ gcc -gdwarf+ t.c
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef382387 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823b3 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823b7 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823bb is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823bf is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823d7 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823db is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823e9 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823ed is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823f5 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef3823fd is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/ccejGwd_1.o: symbol <unknown>: offset 0xef382405 is non-aligned
$ gcc -gdwarf t.c
ld: fatal: relocation error: R_SPARC_32: file /tmp/cc9kOY2_1.o: symbol <unknown>: offset 0xef382366 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/cc9kOY2_1.o: symbol <unknown>: offset 0xef38236a is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/cc9kOY2_1.o: symbol <unknown>: offset 0xef382372 is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/cc9kOY2_1.o: symbol <unknown>: offset 0xef38237a is non-aligned
ld: fatal: relocation error: R_SPARC_32: file /tmp/cc9kOY2_1.o: symbol <unknown>: offset 0xef382382 is non-aligned
$ gcc -ggdb t.c
ld: warning: relocation error: R_SPARC_32: file /tmp/ccBleot_1.o: symbol .text:
external symbolic relocation against non-allocatable section .debug_line;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccBleot_1.o: symbol .debug_abbrev:
external symbolic relocation against non-allocatable section .debug_info;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccBleot_1.o: symbol .text:
external symbolic relocation against non-allocatable section .debug_info;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccBleot_1.o: symbol .debug_line:
external symbolic relocation against non-allocatable section .debug_info;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccBleot_1.o: symbol .debug_info:
external symbolic relocation against non-allocatable section .debug_pubnames;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccBleot_1.o: symbol .debug_info:
external symbolic relocation against non-allocatable section .debug_aranges;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_32: file /tmp/ccBleot_1.o: symbol .text:
external symbolic relocation against non-allocatable section .debug_aranges;
cannot be processed at runtime: relocation ignored
Undefined first referenced
symbol in file
.debug_info /tmp/ccBleot_1.o
.text /tmp/ccBleot_1.o
.debug_abbrev /tmp/ccBleot_1.o
.debug_line /tmp/ccBleot_1.o
ld: fatal: Symbol referencing errors. No output written to a.out
$ gcc -gdwarf-2 t.c
ld: warning: relocation error: R_SPARC_32: file /tmp/ccR3d2__1.o: symbol .text:
external symbolic relocation against non-allocatable section .debug_line;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccR3d2__1.o: symbol .debug_abbrev:
external symbolic relocation against non-allocatable section .debug_info;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccR3d2__1.o: symbol .text:
external symbolic relocation against non-allocatable section .debug_info;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccR3d2__1.o: symbol .debug_line:
external symbolic relocation against non-allocatable section .debug_info;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccR3d2__1.o: symbol .debug_info:
external symbolic relocation against non-allocatable section .debug_pubnames;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_UA32: file /tmp/ccR3d2__1.o: symbol .debug_info:
external symbolic relocation against non-allocatable section .debug_aranges;
cannot be processed at runtime: relocation ignored
ld: warning: relocation error: R_SPARC_32: file /tmp/ccR3d2__1.o: symbol .text:
external symbolic relocation against non-allocatable section .debug_aranges;
cannot be processed at runtime: relocation ignored
Undefined first referenced
symbol in file
.debug_info /tmp/ccR3d2__1.o
.text /tmp/ccR3d2__1.o
.debug_abbrev /tmp/ccR3d2__1.o
.debug_line /tmp/ccR3d2__1.o
ld: fatal: Symbol referencing errors. No output written to a.out