JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.43k stars 5.45k forks source link

lldb is unhappy when we load an empty package #48831

Open vtjnash opened 1 year ago

vtjnash commented 1 year ago
julia> using DataValueInterfaces
warning: (x86_64) /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Jameson:julia jameson$ du -sh /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib*
 32K    /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib
 20K    /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib.dSYM
Jameson:julia jameson$ ./usr/tools/llvm-size -A /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib
/Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib  :
section              size    addr
__text                 72    1600
__stubs                18    1672
__stub_helper          46    1692
__const               152    1744
__unwind_info        4168    1896
__eh_frame            184    6064
__got                   8    8192
__const                 8    8200
__la_symbol_ptr        24   12288
__data              14224   12352
Total               18904

Jameson:julia jameson$ ./usr/tools/llvm-size -A /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib.dSYM/Contents/Resources/DWARF/9Lpkp_uJHo7.dylib 
/Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib.dSYM/Contents/Resources/DWARF/9Lpkp_uJHo7.dylib  :
section               size    addr
__text                  72    1600
__stubs                 18    1672
__stub_helper           46    1692
__const                152    1744
__unwind_info         4168    1896
__eh_frame             184    6064
__got                    8    8192
__const                  8    8200
__la_symbol_ptr         24   12288
__data               12446   12352
__debug_abbrev           1   32768
__debug_str              1   32769
__apple_names           36   32770
__apple_namespac        36   32806
__apple_types           48   32842
__apple_objc            36   32890
Total                17284

Jameson:julia jameson$ nm /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib
0000000000000650 t ___extendhfsf2
0000000000000660 t ___gnu_f2h_ieee
0000000000000640 t ___gnu_h2f_ieee
0000000000000680 t ___truncdfhf2
0000000000000670 t ___truncsfhf2
00000000000067c8 d __dyld_private
                 U _jl_RTLD_DEFAULT_handle
0000000000002008 S _jl_RTLD_DEFAULT_handle_pointer
0000000000000758 S _jl_dispatch_fvars_idxs
000000000000075c S _jl_dispatch_fvars_offsets
0000000000000754 S _jl_dispatch_reloc_slots
00000000000006e0 S _jl_dispatch_target_ids
00000000000006d0 S _jl_sysimg_fvars_offsets
00000000000006d4 S _jl_sysimg_gvars_offsets
0000000000003040 D _jl_system_image_data
0000000000000760 S _jl_system_image_size
                 U _julia__gnu_f2h_ieee
                 U _julia__gnu_h2f_ieee
                 U _julia__truncdfhf2
                 U dyld_stub_binder
gbaraldi commented 1 year ago

What does dwarfdump show for the .dSYM file?

vtjnash commented 1 year ago
$ dwarfdump /Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib
/Users/jameson/.julia/compiled/v1.10/DataValueInterfaces/9Lpkp_uJHo7.dylib: file format Mach-O 64-bit x86-64

.debug_info contents:
gbaraldi commented 1 year ago

So it generates everything, but the .debug_info section contains nothing. That's really odd.

vtjnash commented 1 year ago

The .dylib is also empty, since we did not generate any code. It is not that odd.

gbaraldi commented 1 year ago

Oh, I didn't catch that. Then I'm confused about what the actual issue is. Is it that warning?

vtjnash commented 1 year ago

Yes, that warning is distracting

gbaraldi commented 1 year ago

Can you reproduce it outside of Julia? Not sure how hard making an empty dylib is. If so then I imagine an upstream issue that adds a check if there is code before throwing the warning.

giordano commented 1 year ago

Not sure how hard making an empty dylib is.

It depends on how empty you want it to be, but echo | cc -shared -o libfoo.so -x c - should successfully produce a shared library.