dynamic-loading

How is the address of the text section of a PIE executable determined in Linux?

混江龙づ霸主 提交于 2019-11-30 05:31:46
First I tried to reverse engineer it a bit: printf ' #include <stdio.h> int main() { puts("hello world"); } ' > main.c gcc -std=c99 -pie -fpie -ggdb3 -o pie main.c echo 2 | sudo tee /proc/sys/kernel/randomize_va_space readelf -s ./pie | grep -E 'main$' gdb -batch -nh \ -ex 'set disable-randomization off' \ -ex 'start' -ex 'info line' \ -ex 'start' -ex 'info line' \ -ex 'set disable-randomization on' \ -ex 'start' -ex 'info line' \ -ex 'start' -ex 'info line' \ ./pie \ ; Output: 64: 000000000000063a 23 FUNC GLOBAL DEFAULT 14 main Temporary breakpoint 1, main () at main.c:4 4 puts("hello world")

Help with Haskell dynamic plugin load

自闭症网瘾萝莉.ら 提交于 2019-11-30 01:53:09
I'm a Haskell beginner, and I'm trying to use the dynamic loading in the 'plugins' package. I'm kind of lost. Here is a minimal program with two files. Main.hs: module Main (main) where import System.Plugins main :: IO () main = do putStrLn "Loading" mv <- dynload "Plug.o" [] [] "thing" -- also try 'load' here putStrLn "Loaded" case mv of LoadFailure msgs -> putStrLn "fail" >> print msgs LoadSuccess _ v -> putStrLn "success" >> print (v::Integer) And Plug.hs: module Plug (thing) where thing :: Integer thing = 1234000 I compile Plug with ghc -c Plug.hs which produces Plug.o. I then compile Main

load time relocation and virtual memory

為{幸葍}努か 提交于 2019-11-29 15:43:56
问题 I am wondering what load-time relocation actually means on a system with virtual memory support.I was thinking that in a system with virtual memory every executable will have addresses starting from zero and at run-time the addresses will be translated into physical addresses using page tables.Therefore the executable can be loaded anywhere in memory without the need of any relocation. However this article on shared libraries mentions that linker specifies an address in the executable where

Android dynamic loading list view onScrollListener issues

你说的曾经没有我的故事 提交于 2019-11-29 15:07:14
I have implemented a list view, every user scroll to bottom screen, it auto add new data to list view Once the scroll has completed, onScroll() call for every new item that enters the displaying view, from the beginning to the end of the scrolling. lv_best = (ListView) findViewById(R.id.lv_best); bestadapter = new LazyAdapter(this, lst_tab_best); lv_best.setAdapter(bestadapter); lv_best.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem,

Maintain scrollTop while inserting new sections above the current viewed elements (without glitching)

别来无恙 提交于 2019-11-29 12:45:04
问题 Here's one for the real JQuery UI geniuses: We have a extremely long form with sections loaded on demand (e.g. when an index/navigation is clicked, or as we scroll near the edges of the current section). When I load sections below the currently viewed section, this does not affect the current scrolling (i.e. scrollTop) position, but when I insert new sections above the current viewed section it of course pushes the viewed content down. We need to maintain the scrollTop position relative to

How is the address of the text section of a PIE executable determined in Linux?

ぃ、小莉子 提交于 2019-11-29 05:38:17
问题 First I tried to reverse engineer it a bit: printf ' #include <stdio.h> int main() { puts("hello world"); } ' > main.c gcc -std=c99 -pie -fpie -ggdb3 -o pie main.c echo 2 | sudo tee /proc/sys/kernel/randomize_va_space readelf -s ./pie | grep -E 'main$' gdb -batch -nh \ -ex 'set disable-randomization off' \ -ex 'start' -ex 'info line' \ -ex 'start' -ex 'info line' \ -ex 'set disable-randomization on' \ -ex 'start' -ex 'info line' \ -ex 'start' -ex 'info line' \ ./pie \ ; Output: 64:

How to specify (non-R) library path for dynamic library loading in R?

China☆狼群 提交于 2019-11-28 23:17:44
I keep getting the following error when attempting to install readxl or haven in R (both dependencies of tidyverse ) post-compilation, when the installer runs the loading test: ** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '<my_lib_Path>/readxl/libs/readxl.so': <my_lib_path>/readxl/libs/readxl.so: undefined symbol: libiconv Error loading failed I have libiconv.so in a local lib path (not for R packages) that is included in LD_LIBRARY_PATH and I've verified in my R session that Sys.getenv("LD_LIBRARY_PATH") has that

Implementing Plugin Architecture - Dynamic DLL loading

强颜欢笑 提交于 2019-11-28 10:37:20
I've an application which is basically a designer with preloaded controls where you can design your pages using the controls. I'm planning to release more and more controls in the future. I don't want to release a new build for newly added controls as it has its disadvantages. So I was thinking of addon/plugin kind of architecture where I just release the addon/plugin separately which they can install and get the controls inside the designer. Right now I'm using xml files as addons to specify the controls, its behaviors, its styles etc. Each xml (addon) represents a single control. But I'm

What exactly does `-rdynamic` do and when exactly is it needed?

巧了我就是萌 提交于 2019-11-28 04:54:06
What exactly does -rdynamic (or --export-dynamic at the linker level) do and how does it relate to symbol visibility as defined by the -fvisibility* flags or visibility pragma s and __attribute__ s? For --export-dynamic , ld(1) mentions: ... If you use "dlopen" to load a dynamic object which needs to refer back to the symbols defined by the program, rather than some other dynamic object, then you will probably need to use this option when linking the program itself. ... I'm not sure I completely understand this. Could you please provide an example that doesn't work without -rdynamic but does

Alternatives to dlsym() and dlopen() in C++

大憨熊 提交于 2019-11-28 03:51:59
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the LD_LIBRARY_PATH , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client would be having the library, in that case I want the application to leave a suitable error message also the independent part should work correctly. For this purpose I am using dlsym() and dlopen() to use the API in the shared library. The problem with this is if I have a lot of