On Wed, Apr 28, 2021 at 4:27 AM Waldemar Kozaczuk <jwkozac...@gmail.com>
wrote:

> Some ELF files define global variables symbols with STT_NOTYPE
> like in this example:
>
>  13030: 000000000243b390     0 NOTYPE  GLOBAL DEFAULT   13
> v8_Default_embedded_blob_size_
>  13136: 0000000002d09db8     0 NOTYPE  GLOBAL DEFAULT   24
> v8_Default_embedded_blob_
>
> Currently OSv dynamic linker will resolve such symbols at the relative
> offset as specified by st_value and cause page fault. This patch fixes
> this logic by correctly adding the base of the ELF to the st_value.
>
> This patch effectively makes it possibly to run latest Node.JS 12 and 14
> on OSv.
>
> Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
> ---
>  core/elf.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/core/elf.cc b/core/elf.cc
> index 94e14b07..7c63bbfc 100644
> --- a/core/elf.cc
> +++ b/core/elf.cc
> @@ -91,7 +91,7 @@ void* symbol_module::relocated_addr() const
>      }
>      switch (symbol_type(*symbol)) {
>      case STT_NOTYPE:
> -        return reinterpret_cast<void*>(symbol->st_value);
> +        return reinterpret_cast<void*>(base + symbol->st_value);
>

So, is this exactly the same as STT_OBJECT and STT_FUNC below? I think the
reinterpret_cast doesn't change anything.
So can you merge it with the STT_OBJECT / STT_FUNC below?

         break;
>      case STT_OBJECT:
>      case STT_FUNC:
> --
> 2.30.2
>
> --
> You received this message because you are subscribed to the Google Groups
> "OSv Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osv-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osv-dev/20210428012738.789556-1-jwkozaczuk%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/CANEVyjtuLi5aUcUF3RP0rw2Tk3Shd5%3DpOojbrqz0U0n%2Bvbhswg%40mail.gmail.com.

Reply via email to