Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Global Pointer问题 #1

Closed
GeneKong opened this issue Sep 19, 2018 · 3 comments
Closed

关于Global Pointer问题 #1

GeneKong opened this issue Sep 19, 2018 · 3 comments
Labels
area-arch enhancement New feature or request
Milestone

Comments

@GeneKong
Copy link

RISC V的全局指针在linker里面是一个特殊的字符,应该为__global_pointer$,这个是linker决定的,目前linker脚本给的是_gp,此指针主要用于优化全局变量的操作;
这里crt.S

  la gp, _gp

和kendryte.ld

  .data :
  {
    /* Writable data segment (.data segment) */
    *(.data .data.*)
    *(.gnu.linkonce.d.*)
    /* Have _gp point to middle of sdata/sbss to maximize displacement range */
    . = ALIGN(8);
    PROVIDE( _gp = ABSOLUTE(.) + 0x800);

可以同步下.

@sunnycase sunnycase added area-arch enhancement New feature or request labels Sep 19, 2018
@sunnycase sunnycase added this to the 0.2.0 milestone Sep 19, 2018
@sunnycase
Copy link
Member

sunnycase commented Sep 19, 2018

RV 官方工具链确实已将 _gp 更新为 __global_pointer$。riscvarchive/riscv-binutils-gdb#56

@manageryzy
Copy link

8

@ly0
Copy link
Contributor

ly0 commented Sep 19, 2018

The issue is closed since #2 fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-arch enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants