浏览代码

rv32: put the symbols for I/O registers back in

Upstream binutils is fixing the bug in disassembling high addresses,
and so re-introduce the I/O register symbols. They can be absolute
symbols; no reason to complicate the ELF output by having a section
for them.
H. Peter Anvin 2 年之前
父节点
当前提交
84e666e703
共有 6 个文件被更改,包括 5 次插入93 次删除
  1. 2 1
      rv32/Makefile
  2. 2 2
      rv32/iodeva.h
  3. 0 73
      rv32/ioregs.pl
  4. 1 3
      rv32/ioregsa.pl
  5. 0 7
      rv32/jtagupd.ld
  6. 0 7
      rv32/max80.ld

+ 2 - 1
rv32/Makefile

@@ -22,7 +22,8 @@ LDFLAGS   = $(CFLAGS) \
 	    -Wl,--sort-section=alignment \
 	    -Wl,-z,common-page-size=16 \
 	    -Wl,-z,max-page-size=16 \
-	    -Wl,-z muldefs
+	    -Wl,-z muldefs \
+	    -Wl,--require-defined=IODEV_BASE
 
 gendeps   = -MD -MF $(@D)/.$(@F).d -MT $@
 

+ 2 - 2
rv32/iodeva.h

@@ -21,7 +21,7 @@
 #define IODEVB2(d,r)	IODEVA(d,r,2)
 #define IODEVB3(d,r)	IODEVA(d,r,3)
 #define IODEVH0(d,r)	IODEVA(d,r,0)
-#define IODEVH1(d,r)	IODEVA(d,r,1)
+#define IODEVH1(d,r)	IODEVA(d,r,2)
 #define IODEVL(d,r)	IODEVA(d,r,0)
 
 #define IODEVRV(d,r)	IODEVA(d,r,0)
@@ -30,7 +30,7 @@
 #define IODEVRB2(d,r)	IODEVA(d,r,2)
 #define IODEVRB3(d,r)	IODEVA(d,r,3)
 #define IODEVRH0(d,r)	IODEVA(d,r,0)
-#define IODEVRH1(d,r)	IODEVA(d,r,1)
+#define IODEVRH1(d,r)	IODEVA(d,r,2)
 #define IODEVRL(d,r)	IODEVA(d,r,0)
 
 #define PTR(x)	    x

+ 0 - 73
rv32/ioregs.pl

@@ -1,73 +0,0 @@
-#!/usr/bin/perl
-#
-# Parse ioregs.h into a .S file to export the register names
-# as actual symbols; this is highly useful for debugging.
-
-use strict;
-use integer;
-
-my($infile, $outfile) = @ARGV;
-
-unless (defined($outfile)) {
-    die "Usage: $0 infile outfile\n";
-}
-
-open(my $in, '<', $infile)
-    or die "$0: $infile: $!\n";
-open(my $out, '>', $outfile)
-    or die "$0: $outfile: $!\n";
-
-my %range = ();
-my %sizes = ('B' => 1, 'H' => 2, 'L' => 4);
-
-sub outsym($$$$) {
-    my($out, $sym, $dev, $size) = @_;
-
-    print $out ".globl $sym\n";
-    print $out "$sym = (. - XDEV_ADDR_BASE) + $dev\n";
-    print $out ".type $sym, \@object\n";
-    if ($size) {
-	print $out ".size $sym, $size\n";
-    }
-}
-
-print $out "\#include \"iodevs.h\"\n";
-print $out "\#include \"iodeva.h\"\n";
-print $out "\n";
-print $out "\.section \".ioregs\",\"aw\",\@nobits\n";
-
-print $out "XDEV_ADDR_BASE = .\n";
-
-while (my $l = <$in>) {
-    $l =~ s/^\s+//;
-    $l =~ s/\s+$//;
-
-    if ($l =~ /^\/\*\s*(\w+)\s*\=\s*([0-9]+)\s*(\.\.\.\s*([0-9]+))\s*\*\//) {
-	$range{$1} = [$2, $3 ? $4 : $2];
-    } elsif ($l =~ /^\/\*\s*(\w+)\s*\=\s*\*\//) {
-	undef $range{$1};
-    } elsif ($l =~ /^\#\s*define\s+(\w+)(\((\w+)\))?\s+(IODEVR?(\w).*)$/) {
-	my $sym = $1;
-	my $dev = $4;
-	my $size = $sizes{$5};
-
-	if ($2) {
-	    my $v = $3;
-	    my $r = $range{$v};
-	    next unless (defined($r));
-
-	    for (my $i = $r->[0]; $i <= $r->[1]; $i++) {
-		print $out "\#define $v $i\n";
-		outsym($out, $sym.$i, $dev, $size);
-		print $out "\#undef $v\n";
-		print $out "\n";
-	    }
-	} else {
-	    outsym($out, $sym, $dev, $size);
-	    print $out "\n";
-	}
-    }
-}
-
-close($in);
-close($out);

+ 1 - 3
rv32/ioregsa.pl

@@ -25,7 +25,7 @@ sub outsym($$$$) {
     my($out, $sym, $dev, $size) = @_;
 
     print $out ".globl $sym\n";
-    print $out "$sym = . + ($dev - XDEV_ADDR_BASE)\n";
+    print $out "$sym = $dev\n";
     if ($size) {
 	print $out ".type $sym, \@object\n";
 	print $out ".size $sym, $size\n";
@@ -36,8 +36,6 @@ print $out "\#include \"iodevs.h\"\n";
 print $out "\#include \"iodeva.h\"\n";
 print $out "\n";
 
-print $out "\.section \".iodevs\",\"aw\",\@nobits\n\n";
-
 outsym($out, 'IODEV_BASE', 'IODEV_ADDR_BASE', 0);
 outsym($out, 'XDEV_BASE', 'XDEV_ADDR_BASE', 0);
 

+ 0 - 7
rv32/jtagupd.ld

@@ -295,13 +295,6 @@ SECTIONS
 
 	__dram_end = .;
 
-	/* Dummy section containing I/O device symbols */
-	. = XDEV_ADDR_BASE;
-	.iodevs (NOLOAD) : {
-		. = .;		/* Force output */
-		KEEP(*(.iodevs))
-	}
-
 	/* Catch missing sections */
 	. = __dram_end;
 	__junk_start = .;

+ 0 - 7
rv32/max80.ld

@@ -323,13 +323,6 @@ SECTIONS
 
 	__dram_end = .;
 
-	/* Dummy section containing I/O device symbols */
-	. = XDEV_ADDR_BASE;
-	.iodevs (NOLOAD) : {
-		. = .;		/* Force output */
-		KEEP(*(.iodevs))
-	}
-
 	/* Catch missing sections */
 	. = __dram_end;
 	__junk_start = .;