Skip to content

Option --thinlto-emit-index-files potentially generates huge filenames #149091

@tarcisiofischer

Description

@tarcisiofischer

While building chromium with lld_emit_indexes_and_imports=true (That's converted into -Wl,--thinlto-emit-index-files), I'm getting

ld.lld: error: cannot open obj/third_party/rust/serde_json_lenient/v0_2/wrapper/libthird_uparty_srust_sserde_ujson_ulenient_sv0_u2_swrapper_cwrapper.rlib(libthird_uparty_srust_sserde_ujson_ulenient_sv0_u2_swrapper_cw
rapper.third_uparty_srust_sserde_ujson_ulenient_sv0_u2_swrapper_cwrapper.6e3eaf7b964e238a-cgu.0.rcgu.o at 67896).thinlto.bc: File name too long

On my linux with BTRFS. This is due to (1) The name mangling mechanism in Chromium: https://source.chromium.org/chromium/chromium/src/+/main:build/rust/rust_target.gni;l=44;drc=15d204f8bf5cc292f592792948823a2bbd77d82c and (2) Lack of handling of files with long filenames in LLVM:

raw_fd_ostream OS(NewModulePath + ".thinlto.bc", EC,
sys::fs::OpenFlags::OF_None);
if (EC)
return createFileError("cannot open " + NewModulePath + ".thinlto.bc", EC);

I've created an issue on Chromium's issue tracker and fix proposals in a CL there. But we are wondering if it'd be possible to change code in LLVM's side in a way that it creates shorter file names in the first place. Please see the discussion in the issue tracker on Chromium further information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LTOLink time optimization (regular/full LTO or ThinLTO)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions