Why ld is leaving a hole in memory?

Aperta
#367 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
c

Direzione di ricerca

Inizia da opensbi/firmware/fw_base.ldS e confronta l’espressione ALIGN con gli indirizzi segnalati di .rela.dyn e .data. Esamina l’output del linker o la mappa delle sezioni per determinare se il divario è causato dall’allineamento PMP a una potenza di due; il lavoro è completato quando il divario è spiegato e viene identificato se il layout può evitarlo in sicurezza.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi

opensbi using a large amount of memory now, and there is a memory hole, is there any way to avoid it?thanks.

opensbi/firmware/fw_base.ldS

PROVIDE(_rodata_end = .);

/* End of the read-only data sections */

/*
* PMP regions must be to be power-of-2. RX/RW will have separate
* regions, so ensure that the split is power-of-2.
*/
. = ALIGN(1 << LOG2CEIL((SIZEOF(.rodata) + SIZEOF(.text)
		+ SIZEOF(.dynsym) + SIZEOF(.rela.dyn))));

PROVIDE(_fw_rw_start = .);

Sections sample:
rela.dyn end 0x200674e8, data start 0x20080000, there is a 98K memory hole

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .text         000185a0  0000000020040000  0000000020040000  00001000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .rodata       000029a8  0000000020059000  0000000020059000  0001a000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynsym       00000210  00000000200658f8  00000000200658f8  000268f8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynstr       0000019f  000000002005b9a8  000000002005b9a8  0001c9a8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .hash         000000a4  000000002005bb48  000000002005bb48  0001cb48  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.hash     000000b4  000000002005bbf0  000000002005bbf0  0001cbf0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .eh_frame     00008bd4  000000002005bca8  000000002005bca8  0001cca8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .eh_frame_hdr 0000107c  000000002006487c  000000002006487c  0002587c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rela.dyn     000014e8  0000000020066000  0000000020066000  00027000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .data         00001398  0000000020080000  0000000020080000  00029000  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 10 .dynamic      00000110  0000000020081398  0000000020081398  0002a398  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 11 .got          000000a8  00000000200814a8  00000000200814a8  0002a4a8  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 12 .got.plt      00000010  0000000020081550  0000000020081550  0002a550  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 13 .bss          00002c90  0000000020082000  0000000020082000  0002a560  2**3
                  ALLOC
Lingua principale
C
Stelle
1.6k
Fork
734
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di riscv-software-src/opensbi

Tutte le issue di riscv-software-src/opensbi

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.