Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ctor = "0.2.4"
[lib]
name = "v8_rs"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

[features]
default = ["debug-server"]
Expand Down
6 changes: 3 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ fn main() {
"cargo:rustc-flags=-L{} -lv8 -lv8_monolith_{} -ldl -lc",
output_dir, *PROFILE
);
println!("cargo:rustc-cdylib-link-arg=-Wl,-Bstatic");
println!("cargo:rustc-cdylib-link-arg=-lstdc++");
println!("cargo:rustc-cdylib-link-arg=-Wl,-Bdynamic");
println!(
"cargo:rustc-link-lib=stdc++",

Choose a reason for hiding this comment

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

I believe this will prefer dynamic linking which is not what we want.

Copy link
Collaborator Author

@iddm iddm Nov 14, 2023

Choose a reason for hiding this comment

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

It can't prefer dynamic linking; since the artefact is a static library, it can only link static libraries into it:

❯ file target/debug/libv8_rs.rlib
target/debug/libv8_rs.rlib: current ar archive

❯ ldd target/debug/libv8_rs.rlib
ldd: warning: you do not have execution permission for `target/debug/libv8_rs.rlib'
	not a dynamic executable

The Rust Library crates are always statically linked.

If you want, I can be more specific and specify the static linkage explicitly:

cargo:rustc-link-lib=static=stdc++

The resulting Rust artefact is an .rlib file (ar archive) with the contents:

❯ ar t target/debug/libv8_rs.rlib
lib.rmeta
v8_rs-202d094763022048.10c567bojat7yq5m.rcgu.o
v8_rs-202d094763022048.10detpinemr7b7xd.rcgu.o
v8_rs-202d094763022048.12tu24li4izo8957.rcgu.o
v8_rs-202d094763022048.15kcvwr8botxu86b.rcgu.o
v8_rs-202d094763022048.1622jh1ptdj3zp3g.rcgu.o
v8_rs-202d094763022048.18wv5nlr3c8dyxor.rcgu.o
v8_rs-202d094763022048.1adgdvcmaov4nblh.rcgu.o
v8_rs-202d094763022048.1bsur4kwyszx7vsc.rcgu.o
v8_rs-202d094763022048.1btrxmkoz6h4otdf.rcgu.o
v8_rs-202d094763022048.1bvlqwdt8j8p8fvu.rcgu.o
v8_rs-202d094763022048.1d9uxemaivppuyjq.rcgu.o
v8_rs-202d094763022048.1ghxpet0wfsu1xta.rcgu.o
v8_rs-202d094763022048.1hh9g9067k4ooin5.rcgu.o
v8_rs-202d094763022048.1l317y8sy1upvw3d.rcgu.o
v8_rs-202d094763022048.1n3rh3me5v4yy3ch.rcgu.o
v8_rs-202d094763022048.1q9c1h5vqjizexyu.rcgu.o
v8_rs-202d094763022048.1qmvx59sm8m9cd2l.rcgu.o
v8_rs-202d094763022048.1rp8pleeqiaume10.rcgu.o
v8_rs-202d094763022048.1t5dyjmk923jbb4f.rcgu.o
v8_rs-202d094763022048.1toi2hcjzxc1kj9z.rcgu.o
v8_rs-202d094763022048.1ugytbzxwmoa9fcb.rcgu.o
v8_rs-202d094763022048.1uo9sbypckduyso2.rcgu.o
v8_rs-202d094763022048.1v6131469li63ede.rcgu.o
v8_rs-202d094763022048.1vm0ewghgvv69cfh.rcgu.o
v8_rs-202d094763022048.1vzedd507iz68xax.rcgu.o
v8_rs-202d094763022048.1xgoho4ofmg8dmy8.rcgu.o
v8_rs-202d094763022048.1z4p0oyn7zzzt3ks.rcgu.o
v8_rs-202d094763022048.20y7bwdy5io80j17.rcgu.o
v8_rs-202d094763022048.2391y3m0x37ne5yn.rcgu.o
v8_rs-202d094763022048.24yuw16l02s0ybs5.rcgu.o
v8_rs-202d094763022048.27d2z1kesftzxfdx.rcgu.o
v8_rs-202d094763022048.27lum3qkh9ucxwjy.rcgu.o
v8_rs-202d094763022048.29cgu2r9iqofiywc.rcgu.o
v8_rs-202d094763022048.29yeuo44etswigyz.rcgu.o
v8_rs-202d094763022048.2aelhbwsucfm1wd1.rcgu.o
v8_rs-202d094763022048.2atslv57ovfdk916.rcgu.o
v8_rs-202d094763022048.2ci6empileughw71.rcgu.o
v8_rs-202d094763022048.2elzhnzmf9hfgyv7.rcgu.o
v8_rs-202d094763022048.2iy09kjcy15vxtcj.rcgu.o
v8_rs-202d094763022048.2l1lh58fdpq4vzm0.rcgu.o
v8_rs-202d094763022048.2lp7sqxw5ghft390.rcgu.o
v8_rs-202d094763022048.2mjv04uak61yp3wm.rcgu.o
v8_rs-202d094763022048.2nqgfj38dmx6tnru.rcgu.o
v8_rs-202d094763022048.2oeqsvnoctzeycy9.rcgu.o
v8_rs-202d094763022048.2p45vj19yoq3sa71.rcgu.o
v8_rs-202d094763022048.2q9rxzcbb8hin5g.rcgu.o
v8_rs-202d094763022048.2rj0cn9din4amar3.rcgu.o
v8_rs-202d094763022048.2rlm850hwqz3rmyw.rcgu.o
v8_rs-202d094763022048.2uz3cibpwcv44o8r.rcgu.o
v8_rs-202d094763022048.2v2udf4ap38ek3vw.rcgu.o
v8_rs-202d094763022048.2voz1fh6yvxxjnfm.rcgu.o
v8_rs-202d094763022048.2wxufrf4q7lzeozb.rcgu.o
v8_rs-202d094763022048.2xa2m17xce5886zr.rcgu.o
v8_rs-202d094763022048.2zn2dqsdqkrdzs6.rcgu.o
v8_rs-202d094763022048.319j7m34ro3pm44j.rcgu.o
v8_rs-202d094763022048.329al1vll6brkhpa.rcgu.o
v8_rs-202d094763022048.32kluv5fuh4xl08a.rcgu.o
v8_rs-202d094763022048.33z9xc0hpdifchcu.rcgu.o
v8_rs-202d094763022048.346vnp89i4umar3l.rcgu.o
v8_rs-202d094763022048.35htr3bhef2gfhgs.rcgu.o
v8_rs-202d094763022048.365v46m9k1w5nlm.rcgu.o
v8_rs-202d094763022048.39afhp0b6jgk51qn.rcgu.o
v8_rs-202d094763022048.3aijzb57gz804t60.rcgu.o
v8_rs-202d094763022048.3b8gij1zp45gnro9.rcgu.o
v8_rs-202d094763022048.3c0u05kmq08usybb.rcgu.o
v8_rs-202d094763022048.3dwuxuay2wqx9rep.rcgu.o
v8_rs-202d094763022048.3dxvltletf26k8fa.rcgu.o
v8_rs-202d094763022048.3eo2zqphmhp7o6lz.rcgu.o
v8_rs-202d094763022048.3g50w0rglhtqapwf.rcgu.o
v8_rs-202d094763022048.3hypbsn0yucymep5.rcgu.o
v8_rs-202d094763022048.3jbeqhtlphubj9m4.rcgu.o
v8_rs-202d094763022048.3ktzm134486vi5f7.rcgu.o
v8_rs-202d094763022048.3lhyprrhbd78h0ad.rcgu.o
v8_rs-202d094763022048.3o9048r7sm7nuozb.rcgu.o
v8_rs-202d094763022048.3rnug7cwf1zg1rty.rcgu.o
v8_rs-202d094763022048.3s3x4f4v22tvygck.rcgu.o
v8_rs-202d094763022048.3si909z7tdh23z6m.rcgu.o
v8_rs-202d094763022048.3tce76r11zwixmaz.rcgu.o
v8_rs-202d094763022048.3tjfgjvw7m6c5qhv.rcgu.o
v8_rs-202d094763022048.3uvby1gi9iguikd.rcgu.o
v8_rs-202d094763022048.3y0wivneg7lx3ebz.rcgu.o
v8_rs-202d094763022048.40avm3vtlxnf7bg5.rcgu.o
v8_rs-202d094763022048.40wffc4ikc52iz4r.rcgu.o
v8_rs-202d094763022048.41133l5qdtrme2jk.rcgu.o
v8_rs-202d094763022048.43bt42k2uugpv4w.rcgu.o
v8_rs-202d094763022048.4614z9hxfaljg1u4.rcgu.o
v8_rs-202d094763022048.47btz7c8yiepstgx.rcgu.o
v8_rs-202d094763022048.49lr6vbyp4tqygh0.rcgu.o
v8_rs-202d094763022048.4a88zfuqez6byjug.rcgu.o
v8_rs-202d094763022048.4asfwfmwznts0l9c.rcgu.o
v8_rs-202d094763022048.4avrk0nf9g5pb584.rcgu.o
v8_rs-202d094763022048.4iwh6yjqu329u6xm.rcgu.o
v8_rs-202d094763022048.4jfj5ge6aquukdle.rcgu.o
v8_rs-202d094763022048.4kveyxz1mi3s6aa2.rcgu.o
v8_rs-202d094763022048.4lplrqxvnprcjylu.rcgu.o
v8_rs-202d094763022048.4nqngb05g6lo09r1.rcgu.o
v8_rs-202d094763022048.4nwzml05eedivn5s.rcgu.o
v8_rs-202d094763022048.4q5q02dl0pmyd5wh.rcgu.o
v8_rs-202d094763022048.4r6g8oj0eabq7kw.rcgu.o
v8_rs-202d094763022048.4saxrluwxp0ty0xb.rcgu.o
v8_rs-202d094763022048.4wsmrcjix5htgec.rcgu.o
v8_rs-202d094763022048.4xheirqna4q5fadc.rcgu.o
v8_rs-202d094763022048.4y5i8q6295oxtihc.rcgu.o
v8_rs-202d094763022048.4yabwjuzdlogds8b.rcgu.o
v8_rs-202d094763022048.4yq0jr85p56sx15n.rcgu.o
v8_rs-202d094763022048.4z0rhi11wbmofvc6.rcgu.o
v8_rs-202d094763022048.533y6lqpo77l22tm.rcgu.o
v8_rs-202d094763022048.55dfrzmimezuzlsd.rcgu.o
v8_rs-202d094763022048.575erz1pmbfsic16.rcgu.o
v8_rs-202d094763022048.578z76ky65rgabwj.rcgu.o
v8_rs-202d094763022048.5a8nvj4z6vengzoe.rcgu.o
v8_rs-202d094763022048.5alf2w2nsjxv424r.rcgu.o
v8_rs-202d094763022048.5bnhc0j6k439wzlg.rcgu.o
v8_rs-202d094763022048.5da1hats47wh4kpz.rcgu.o
v8_rs-202d094763022048.5ddweie16m1ztyhc.rcgu.o
v8_rs-202d094763022048.5v3mxjfdytudt8f.rcgu.o
v8_rs-202d094763022048.60oz1dz0e993umh.rcgu.o
v8_rs-202d094763022048.6iyhsnu655hd8ax.rcgu.o
v8_rs-202d094763022048.7f3ow8suhksfrpg.rcgu.o
v8_rs-202d094763022048.7u6v8dyo5xh56lx.rcgu.o
v8_rs-202d094763022048.8l7y3vtliib368l.rcgu.o
v8_rs-202d094763022048.9qmy6hehurwi1im.rcgu.o
v8_rs-202d094763022048.9xh4sk0q25hwdh3.rcgu.o
v8_rs-202d094763022048.dhc154la0ewi6e6.rcgu.o
v8_rs-202d094763022048.ecwmze1abokg4rq.rcgu.o
v8_rs-202d094763022048.ffeaaoe8wlu4asy.rcgu.o
v8_rs-202d094763022048.fkl5bi4xlpd6aac.rcgu.o
v8_rs-202d094763022048.fu2w0m1fpl2zoao.rcgu.o
v8_rs-202d094763022048.fx8wwworwct65gi.rcgu.o
v8_rs-202d094763022048.gc7of7wi09fls7e.rcgu.o
v8_rs-202d094763022048.hex5vt7aaxzi2pd.rcgu.o
v8_rs-202d094763022048.hgd1zzrv8izq9gc.rcgu.o
v8_rs-202d094763022048.hsqygsh7b1jny6a.rcgu.o
v8_rs-202d094763022048.i19ycmx8s9bjgr6.rcgu.o
v8_rs-202d094763022048.iv8gqwphj63aj9v.rcgu.o
v8_rs-202d094763022048.l8ps3l0u1xla3ss.rcgu.o
v8_rs-202d094763022048.ml12b4qwxtbgrhy.rcgu.o
v8_rs-202d094763022048.oud54tfvu8nmnev.rcgu.o
v8_rs-202d094763022048.uf9pkwcsnxy9y0u.rcgu.o
v8_rs-202d094763022048.upx9h5wm8hjd32s.rcgu.o
v8_rs-202d094763022048.uzkxhcr4or2t7fl.rcgu.o
v8_rs-202d094763022048.x0t9onq4rpmlgyc.rcgu.o
v8_rs-202d094763022048.xnpwbcyfkxy24yd.rcgu.o
v8_rs-202d094763022048.xxjd19kkzmq03zu.rcgu.o
v8_rs-202d094763022048.z0rikxj03veh2a3.rcgu.o
compatibility.o
compatibility-debug_list.o
compatibility-debug_list-2.o
compatibility-atomic-c++0x.o
compatibility-c++0x.o
compatibility-chrono.o
compatibility-condvar.o
compatibility-thread-c++0x.o
array_type_info.o
atexit_arm.o
atexit_thread.o
atomicity.o
bad_alloc.o
bad_array_length.o
bad_array_new.o
bad_cast.o
bad_typeid.o
class_type_info.o
cp-demangle.o
del_op.o
del_opa.o
del_opant.o
del_opnt.o
del_ops.o
del_opsa.o
del_opv.o
del_opva.o
del_opvant.o
del_opvnt.o
del_opvs.o
del_opvsa.o
dyncast.o
eh_alloc.o
eh_arm.o
eh_aux_runtime.o
eh_call.o
eh_catch.o
eh_exception.o
eh_globals.o
eh_personality.o
eh_ptr.o
eh_term_handler.o
eh_terminate.o
eh_throw.o
eh_tm.o
eh_type.o
eh_unex_handler.o
enum_type_info.o
function_type_info.o
fundamental_type_info.o
guard.o
guard_error.o
hash_bytes.o
nested_exception.o
new_handler.o
new_op.o
new_opa.o
new_opant.o
new_opnt.o
new_opv.o
new_opva.o
new_opvant.o
new_opvnt.o
pbase_type_info.o
pmem_type_info.o
pointer_type_info.o
pure.o
si_class_type_info.o
tinfo.o
tinfo2.o
vec.o
vmi_class_type_info.o
vterminate.o
allocator-inst.o
basic_file.o
bitmap_allocator.o
c++locale.o
codecvt.o
codecvt_members.o
collate_members.o
collate_members_cow.o
complex_io.o
concept-inst.o
cow-istream-string.o
ext-inst.o
globals_io.o
hash_tr1.o
hashtable_tr1.o
ios_failure.o
ios_init.o
ios_locale.o
istream-string.o
istream.o
list-aux-2.o
list-aux.o
list.o
list_associated-2.o
list_associated.o
locale.o
locale_facets.o
locale_init.o
localename.o
math_stubs_float.o
math_stubs_long_double.o
messages_members.o
messages_members_cow.o
misc-inst.o
monetary_members.o
monetary_members_cow.o
mt_allocator.o
numeric_members.o
numeric_members_cow.o
parallel_settings.o
pool_allocator.o
stdexcept.o
streambuf.o
strstream.o
time_members.o
tree.o
valarray.o
chrono.o
lt1-codecvt.o
condition_variable.o
cow-fstream-inst.o
cow-locale_init.o
cow-shim_facets.o
cow-sstream-inst.o
cow-stdexcept.o
cow-string-inst.o
cow-string-io-inst.o
cow-wstring-inst.o
cow-wstring-io-inst.o
ctype.o
ctype_configure_char.o
ctype_members.o
cxx11-hash_tr1.o
cxx11-ios_failure.o
cxx11-locale-inst.o
cxx11-shim_facets.o
cxx11-stdexcept.o
cxx11-wlocale-inst.o
debug.o
ext11-inst.o
fstream-inst.o
functexcept.o
functional.o
futex.o
future.o
hash_c++0x.o
hashtable_c++0x.o
ios-inst.o
ios.o
ios_errcat.o
iostream-inst.o
istream-inst.o
limits.o
locale-inst.o
mutex.o
ostream-inst.o
placeholders.o
random.o
regex.o
shared_ptr.o
snprintf_lite.o
sso_string.o
sstream-inst.o
streambuf-inst.o
string-inst.o
string-io-inst.o
system_error.o
thread.o
wlocale-inst.o
wstring-inst.o
wstring-io-inst.o
cow-fs_dir.o
cow-fs_ops.o
cow-fs_path.o
lt2-cow-string-inst.o
floating_from_chars.o
floating_to_chars.o
fs_dir.o
fs_ops.o
fs_path.o
memory_resource.o
lt3-ostream-inst.o
lt4-string-inst.o
lt5-sstream-inst.o
tzdb.o

As you can see, it contains many object files from libstdc++ inside of itself. The symbols are clearly marked as defined within this artefact.
For example, we can read the symbol table and find many C++ types and functions being present in the resulting archive:

0000000000000000 T std::chrono::reload_tzdb()
0000000000000000 t std::chrono::reload_tzdb() [clone .cold]
0000000000000000 T std::chrono::current_zone()
0000000000000000 t std::chrono::current_zone() [clone .cold]
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::ispanbuf::~ispanbuf()
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::ispanbuf::~ispanbuf()
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::ispanbuf::~ispanbuf()
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::tzdata_stream()
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::tzdata_stream() [clone .cold]
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::~tzdata_stream()
0000000000000000 t std::chrono::(anonymous namespace)::tzdata_stream::~tzdata_stream()

);
}
"macos" => {
println!(
Expand Down