[Bug ld/24678] RISC-V pcrel relocs and abs global pointer variable

2023-06-08 Thread palmer at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24678

Palmer Dabbelt  changed:

   What|Removed |Added

 CC||palmer at gcc dot gnu.org

--- Comment #2 from Palmer Dabbelt  ---
https://inbox.sourceware.org/binutils/20230608155214.32435-1-pal...@rivosinc.com/T/#u

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/24678] RISC-V pcrel relocs and abs global pointer variable

2022-08-19 Thread pinskia at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24678

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://sourceware.org/bugz
   ||illa/show_bug.cgi?id=24983

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/24678] RISC-V pcrel relocs and abs global pointer variable

2019-06-13 Thread wilson at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24678

--- Comment #1 from Jim Wilson  ---
The section for linker script defined variables is set in set_sym_sections, via
update_definedness, which uses section_for_dot.

Since we are computing the __global_pointer$ value near the end of the linker
script, after the last output section, and after an expression that sets dot,
it must be assigned to the next output section but there is no next output
section so it gets the default abs section.

Also, rel_from_abs needs to be set, which is only set if it explicitly uses
dot.

Moving the expression a little earlier in the linker script, and rewriting to
explicitly mention dot seems to work.  Completely untested patch that works for
a simple testcase, putting __global_pointer$ in the .bss section.

The change probably should have a comment to explain the details.

diff --git a/ld/emulparams/elf32lriscv-defs.sh
b/ld/emulparams/elf32lriscv-defs.sh
index 5ac3b6023d..dd1183bb53 100644
--- a/ld/emulparams/elf32lriscv-defs.sh
+++ b/ld/emulparams/elf32lriscv-defs.sh
@@ -43,6 +43,6 @@
INITIAL_READONLY_SECTIONS="${RELOCATING+${CREATE_SHLIB-${INITIAL_READONLY_SECTIO
 # the program as possible.  But we can't allow gp to cover any of rodata, as
 # the address of variables in rodata may change during relaxation, so we start
 # from data in that case.
-OTHER_END_SYMBOLS="${CREATE_SHLIB-__BSS_END__ = .;
+OTHER_BSS_END_SYMBOLS="${CREATE_SHLIB-__BSS_END__ = .;
 __global_pointer$ = MIN(__SDATA_BEGIN__ + 0x800,
-   MAX(__DATA_BEGIN__ + 0x800, __BSS_END__ -
0x800));}"
+   MAX(__DATA_BEGIN__ + 0x800, . - 0x800));}"

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/24678] RISC-V pcrel relocs and abs global pointer variable

2019-06-13 Thread wilson at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24678

Jim Wilson  changed:

   What|Removed |Added

 Target||riscv*-*-*

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils