summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-09-21 12:03:13 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-09-21 12:03:13 +0000
commit040fb24214fb9b5e2778b89b257da26465d64379 (patch)
treeb6a0f89e1feaa1e7f99fdacabdb81b9485116ba9
parent983310d4d8ab79c1555fe3e3f054f494ef15846f (diff)
Trim down RRS text relocation warnings, no need to see 1000 of them
each time.
-rw-r--r--gnu/usr.bin/ld/ld.c10
-rw-r--r--gnu/usr.bin/ld/ld.h3
-rw-r--r--gnu/usr.bin/ld/rrs.c18
3 files changed, 24 insertions, 7 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index 2c417153627..a0a49abbf0e 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.c,v 1.16 2000/09/20 22:57:20 espie Exp $ */
+/* $OpenBSD: ld.c,v 1.17 2000/09/21 12:03:12 espie Exp $ */
/* $NetBSD: ld.c,v 1.52 1998/02/20 03:12:51 jonathan Exp $ */
/*-
@@ -285,6 +285,9 @@ main(argc, argv)
char *argv[];
{
+ if (atexit(cleanup))
+ err(1, "atexit");
+
/* Added this to stop ld core-dumping on very large .o files. */
#ifdef RLIMIT_STACK
/* Get rid of any avoidable limit on stack size. */
@@ -2632,9 +2635,6 @@ write_output()
if (outstream == NULL)
err(1, "open: %s", output_filename);
- if (atexit(cleanup))
- err(1, "atexit");
-
if (fstat(fileno(outstream), &statbuf) < 0)
err(1, "fstat: %s", output_filename);
@@ -3815,6 +3815,8 @@ cleanup()
{
struct stat statbuf;
+ rrs_summarize_warnings();
+
if (outstream == 0)
return;
diff --git a/gnu/usr.bin/ld/ld.h b/gnu/usr.bin/ld/ld.h
index 9eb86a3f806..e0d6c66d732 100644
--- a/gnu/usr.bin/ld/ld.h
+++ b/gnu/usr.bin/ld/ld.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.h,v 1.5 2000/04/24 03:33:27 form Exp $ */
+/* $OpenBSD: ld.h,v 1.6 2000/09/21 12:03:12 espie Exp $ */
/*-
* This code is derived from software copyrighted by the Free Software
@@ -680,6 +680,7 @@ void claim_rrs_segment_reloc __P((struct file_entry *, struct relocation_info *)
void consider_rrs_section_lengths __P((void));
void relocate_rrs_addresses __P((void));
void write_rrs __P((void));
+void rrs_summarize_warnings __P((void));
/* In <md>.c */
void md_init_header __P((struct exec *, int, int));
diff --git a/gnu/usr.bin/ld/rrs.c b/gnu/usr.bin/ld/rrs.c
index e24c766f13d..b76c4e9dd4a 100644
--- a/gnu/usr.bin/ld/rrs.c
+++ b/gnu/usr.bin/ld/rrs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rrs.c,v 1.6 1999/08/25 07:42:06 niklas Exp $*/
+/* $OpenBSD: rrs.c,v 1.7 2000/09/21 12:03:12 espie Exp $*/
/*
* Copyright (c) 1993 Paul Kranenburg
* All rights reserved.
@@ -301,6 +301,19 @@ rrs_next_reloc()
return r;
}
+/* don't warn more than n times for text relocations */
+#define TEXT_RELOC_THRESHOLD 3
+static unsigned long total_text_relocs = 0;
+
+/* called at cleanup time */
+void
+rrs_summarize_warnings()
+{
+ if (total_text_relocs >= TEXT_RELOC_THRESHOLD)
+ warnx("Total: %lu RRS text relocations",
+ total_text_relocs);
+}
+
/*
* Claim a RRS relocation as a result of a regular (ie. non-PIC)
* relocation record in a rel file.
@@ -318,7 +331,8 @@ claim_rrs_reloc(entry, rp, sp, relocation)
{
struct relocation_info *r = rrs_next_reloc();
- if (rp->r_address < text_start + text_size)
+ if (rp->r_address < text_start + text_size &&
+ ++total_text_relocs < TEXT_RELOC_THRESHOLD)
warnx("%s: RRS text relocation at %#x for \"%s\"",
get_file_name(entry), rp->r_address, sp->name);