简体   繁体   中英

Is there an equivalent to the GNU linker “--just-symbols” option for non-GNU linkers?

-R filename

--just-symbols=filename

Read symbol names and their addresses from filename , but do not relocate it or include it in the output. This allows your output file to refer symbolically to absolute locations of memory defined in other programs. You may use this option more than once.

For example, on my Mac, ld -R libsomething.a or even gcc -Wl,-R,libsomething.a doesn't work.

Since you're talking about "your mac", I assume we are talking about OS X operating systems.

On UNIX-based systems the linker " ld " (with -R option) is used most of the times (see also: ELF ). In contrast OS X Systems use the Mach-O binary format and the tool dyld for linking. OS X doesn't provide the same features for libraries as UNIX does. Try otool -L on a binary to see where the libraries are expected. You may also want to try setting DYLD_LIBRARY_PATH ( man dyld ) for your binaries but keep in mind the security risk (this could be used to inject code like LD_LIBRARY_PATH on UNIX-systems).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM