fix user.ld to get read-only text with riscv64-linux-gnu-ld 2.41
This commit is contained in:
		
							parent
							
								
									dd2574bc10
								
							
						
					
					
						commit
						fe940f4d63
					
				
					 4 changed files with 12 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -55,7 +55,7 @@ start()
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// arrange to receive timer interrupts.
 | 
			
		||||
// they will arrive in machine mode at
 | 
			
		||||
// they will arrive in machine mode
 | 
			
		||||
// at timervec in kernelvec.S,
 | 
			
		||||
// which turns them into software interrupts for
 | 
			
		||||
// devintr() in trap.c.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,8 +68,8 @@ usertrap(void)
 | 
			
		|||
  } else if((which_dev = devintr()) != 0){
 | 
			
		||||
    // ok
 | 
			
		||||
  } else {
 | 
			
		||||
    printf("usertrap(): unexpected scause %lx pid=%d\n", r_scause(), p->pid);
 | 
			
		||||
    printf("            sepc=%lx stval=%lx\n", r_sepc(), r_stval());
 | 
			
		||||
    printf("usertrap(): unexpected scause 0x%lx pid=%d\n", r_scause(), p->pid);
 | 
			
		||||
    printf("            sepc=0x%lx stval=0x%lx\n", r_sepc(), r_stval());
 | 
			
		||||
    setkilled(p);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -145,8 +145,8 @@ kerneltrap()
 | 
			
		|||
    panic("kerneltrap: interrupts enabled");
 | 
			
		||||
 | 
			
		||||
  if((which_dev = devintr()) == 0){
 | 
			
		||||
    printf("scause %lx\n", scause);
 | 
			
		||||
    printf("sepc=%lx stval=%lx\n", r_sepc(), r_stval());
 | 
			
		||||
    printf("scause 0x%lx\n", scause);
 | 
			
		||||
    printf("sepc=0x%lx stval=0x%lx\n", r_sepc(), r_stval());
 | 
			
		||||
    panic("kerneltrap");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,9 +15,14 @@ SECTIONS
 | 
			
		|||
    *(.srodata .srodata.*) /* do not need to distinguish this from .rodata */
 | 
			
		||||
    . = ALIGN(16);
 | 
			
		||||
    *(.rodata .rodata.*)
 | 
			
		||||
    . = ALIGN(0x1000);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .eh_frame : {
 | 
			
		||||
       *(.eh_frame)
 | 
			
		||||
       *(.eh_frame.*)
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
  . = ALIGN(0x1000);
 | 
			
		||||
  .data : {
 | 
			
		||||
    . = ALIGN(16);
 | 
			
		||||
    *(.sdata .sdata.*) /* do not need to distinguish this from .data */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2666,7 +2666,7 @@ bigdir(char *s)
 | 
			
		|||
    name[2] = '0' + (i % 64);
 | 
			
		||||
    name[3] = '\0';
 | 
			
		||||
    if(link("bd", name) != 0){
 | 
			
		||||
      printf("%s: bigdir link(bd, %s) failed\n", s, name);
 | 
			
		||||
      printf("%s: bigdir i=%d link(bd, %s) failed\n", s, i, name);
 | 
			
		||||
      exit(1);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue