Browse Source

Added -n flag

ceriel 27 years ago
parent
commit
56033dc0c1
3 changed files with 16 additions and 1 deletions
  1. 1 0
      util/led/const.h
  2. 6 0
      util/led/led.6
  3. 9 1
      util/led/main.c

+ 1 - 0
util/led/const.h

@@ -15,6 +15,7 @@ typedef int		bool;
 #define RFLAG		0x01		/* -r flag given.		*/
 #define SFLAG		0x02		/* -s flag given.		*/
 #define CFLAG		0x04		/* -c flag given.		*/
+#define NFLAG		0x08		/* -n flag given.		*/
 
 #define PLAIN		0		/* Input file is a normal file.	*/
 #define ARCHIVE		1		/* Input file is an archive.	*/

+ 6 - 0
util/led/led.6

@@ -102,6 +102,12 @@ be resolved.
 This may be useful for machines that need a last relocation step
 at load time. This flag disables the \fB\-r\fP flag.
 .TP
+.B \-n
+Usually, after linking, a value in the namelist represents an absolute
+address. Sometimes, particularly when using the \fB\-c\fR flag, it may be
+useful to have as value the offset with respect to the beginning of the
+corresponding section. The \fB\-n\fR flag enables this.
+.TP
 .B  \-s
 `Strip' the output, that is, remove the name table
 and relocation information to save space (but impair the

+ 9 - 1
util/led/main.c

@@ -175,6 +175,14 @@ first_pass(argv)
 			DEB = 1;
 			break;
 #endif
+		case 'n':
+			/* In the resulting name list, leave offsets with
+			   respect to the beginning of the section instead
+			   of absolute addresses.
+			*/
+			flagword |= NFLAG;
+			break;
+
 		case 'o':
 			/*
 			 * The `name' argument after -o is used as name
@@ -367,7 +375,7 @@ evaluate()
 {
 	norm_commons();
 	complete_sections();
-	if (!(flagword&RFLAG))
+	if (!(flagword&(RFLAG|NFLAG)))
 		change_names();
 }