Skip to content

Commit

Permalink
aa64: move .rel* and .dyn* to the separate sections
Browse files Browse the repository at this point in the history
The previous commit(*) merged .rel* and .dyn* into .rodata. However,
this makes ld to generate the wrong section size for .rel* to cover
other unrelated sections. This commit moves .rel* and .dyn* out of
.rodata in the ld script. However, since the related variables, such
as _evrodata, _rodata_size, and _rodata_vsize, are moved, so the
crafted pe-coff section header for .rodata still covers our new
.rela and .dyn sections.

(*) 212ba30 ("arm/aa64 targets: put .rel* and .dyn* in .rodata")

Issue: rhboot#371

Signed-off-by: Gary Lin <[email protected]>
  • Loading branch information
lcp committed Jun 16, 2021
1 parent 05875f3 commit 686ff99
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ ifneq ($(OBJCOPY_GTE224),1)
endif
$(OBJCOPY) -D -j .text -j .sdata -j .data -j .data.ident \
-j .dynamic -j .rodata -j .rel* \
-j .rela* -j .reloc -j .eh_frame \
-j .rela* -j .dyn* -j .reloc -j .eh_frame \
-j .vendor_cert -j .sbat \
$(FORMAT) $< $@
./post-process-pe -vv $@
Expand Down
24 changes: 16 additions & 8 deletions elf_aarch64_efi.lds
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,29 @@ SECTIONS
.rodata :
{
_rodata = .;
*(.rela.dyn)
*(.rela.plt)
*(.rela.got)
*(.rela.data)
*(.rela.data*)

*(.rodata*)
*(.srodata)
*(.dynsym)
*(.dynstr)
. = ALIGN(16);
*(.note.gnu.build-id)
. = ALIGN(4096);
*(.vendor_cert)
*(.data.ident)
. = ALIGN(4096);
}
. = ALIGN(4096);
.rela :
{
*(.rela.dyn)
*(.rela.plt)
*(.rela.got)
*(.rela.data)
*(.rela.data*)
}
. = ALIGN(4096);
.dyn :
{
*(.dynsym)
*(.dynstr)
_evrodata = .;
. = ALIGN(4096);
}
Expand Down

0 comments on commit 686ff99

Please sign in to comment.