This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
When I first tried GNU ld on SunOS 4.1.x, I liked the inclusion of
file, function and line number in undefined error messages. I finally
got tired of seeing `.text+0xXXXX' messages and so I tried to add this
feature for ELF on Solaris 2.x and Linux. I implemented a simple
version which will work even without debugging but omits the line
number (based on the one in aoutx.h).
Then as I was about to embark on the full debug version, I realized
that using the .stabs section will work for Solaris and Linux but not
DWARF. In which file should one implement the stabs version? It
seems that elfcode.h is too general and elf32-{i386,sparc}.c are too
specific.
bfd ChangeLog:
Thu Jun 22 02:21:39 1995 Rick Sladkey <jrs@world.std.com>
* elfcode.h (elf_find_nearest_line): Handle the simple
case where there is no debugging information.
ld ChangeLog:
Thu Jun 22 02:21:39 1995 Rick Sladkey <jrs@world.std.com>
* ldmisc.c (undefined_symbol): Don't print the line number if
it isn't meaningful.
*** gas-950619/bfd/elfcode.h-dist Mon Jun 19 04:18:54 1995
--- gas-950619/bfd/elfcode.h Wed Jun 21 15:24:09 1995
***************
*** 3397,3403 ****
CONST char **functionname_ptr;
unsigned int *line_ptr;
{
! return false;
}
int
--- 3397,3450 ----
CONST char **functionname_ptr;
unsigned int *line_ptr;
{
! /* Run down the file looking for the filename and function. */
! asymbol **p;
! static char buffer[100];
! static char filename_buffer[200];
! CONST char *main_file_name = NULL;
!
! bfd_vma high_line_vma = ~0;
! bfd_vma low_func_vma = 0;
! asymbol *func = 0;
! *filename_ptr = abfd->filename;
! *functionname_ptr = 0;
! *line_ptr = 0;
! if (symbols != (asymbol **)NULL) {
! for (p = symbols; *p; p++) {
! elf_symbol_type *q = (elf_symbol_type *)(*p);
! next:
! switch (ELF_ST_TYPE(q->internal_elf_sym.st_info)){
! case STT_FILE:
! main_file_name = q->symbol.name;
! break;
!
! case STT_FUNC:
! {
! /* We'll keep this if it is nearer than the one we have already */
! if (q->symbol.value >= low_func_vma &&
! q->symbol.value <= offset) {
! low_func_vma = q->symbol.value;
! func = (asymbol *)q;
! }
! if (func) {
! CONST char *function = func->name;
! char *p;
! strncpy (buffer, function, sizeof (buffer) - 1);
! buffer[sizeof(buffer)-1] = 0;
! *functionname_ptr = buffer;
! goto done;
!
! }
! }
! break;
! }
! }
! }
!
! done:
! if (main_file_name)
! *filename_ptr = main_file_name;
! return true;
}
int
*** gas-950619/ld/ldmisc.c-dist Fri May 12 14:54:47 1995
--- gas-950619/ld/ldmisc.c Wed Jun 21 15:13:48 1995
***************
*** 297,303 ****
last_function = buystring (functionname);
}
discard_last = false;
! fprintf (fp, "%s:%u", filename, linenumber);
}
else if (linenumber != 0)
finfo (fp, "%B:%s:%u", abfd, filename, linenumber);
--- 297,306 ----
last_function = buystring (functionname);
}
discard_last = false;
! if (linenumber != 0)
! finfo (fp, "%s:%u", filename, linenumber);
! else
! finfo (fp, "%s(%s+0x%v)", filename, section->name, offset);
}
else if (linenumber != 0)
finfo (fp, "%B:%s:%u", abfd, filename, linenumber);