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

wrapgen: Fix address resolution in dynamic section #1355

Merged
merged 1 commit into from
May 1, 2023

Conversation

zhaofengli
Copy link
Contributor

The values are virtual addresses which aren't necessarily equal to file offsets. For example, this is what my libavcodec.so looks like:

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x000000000006e188 0x000000000006e188  R      0x1000
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  LOAD           0x000000000006f000 0x000000000006f000 0x000000000006f000
                 0x00000000009c17b1 0x00000000009c17b1  R E    0x1000
  LOAD           0x0000000000a31000 0x0000000000a31000 0x0000000000a31000
                 0x0000000000454548 0x0000000000454548  R      0x1000
  GNU_EH_FRAME   0x0000000000dcf6a0 0x0000000000dcf6a0 0x0000000000dcf6a0
                 0x0000000000014114 0x0000000000014114  R      0x4
  LOAD           0x0000000000e86470 0x0000000000e86470 0x0000000000e86470
                 0x0000000000068400 0x00000000004c66c0  RW     0x1000
  GNU_RELRO      0x0000000000e86470 0x0000000000e86470 0x0000000000e86470
                 0x0000000000066b90 0x0000000000066b90  R      0x1
  DYNAMIC        0x0000000000eeb920 0x0000000000eeb920 0x0000000000eeb920
                 0x0000000000000360 0x0000000000000360  RW     0x8
  LOAD           0x0000000000fc2000 0x000000000134d000 0x000000000134d000
                 0x0000000000004ff0 0x0000000000004ff0  RW     0x1000

(The dynamic section is loaded in the last segment)

The values are addresses which aren't necessarily equal to file
offsets.
Copy link
Member

@facekapow facekapow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bugaevc
Copy link
Member

bugaevc commented May 1, 2023

Makes sense to me too

@facekapow facekapow merged commit 565f963 into darlinghq:master May 1, 2023
@zhaofengli zhaofengli deleted the fix-wrapgen-vaddr branch May 1, 2023 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants