kamlesh kumar via llvm-dev
2021-Mar-29 17:07 UTC
[llvm-dev] clang emit Duplicate file entry on windows
Hi Devs, clang Emitting duplicate file entry when the input file given like this case-1: $./clang++ -g -c -o test.o /c/Users/HI/Documents/windworkspace/llvm-dev-build/bin/tests/test.cc -std=c++17 $./llvm-dwarfdump -debug-line test.o ----- file_names[ 52]: name: "test.cc" dir_index: 3 mod_time: 0x00000000 length: 0x00000000 file_names[ 53]: name: "test.cc" dir_index: 3 mod_time: 0x00000000 length: 0x00000000 -------- case-2: But when input file given like this It emit only one file entry $ ./clang C:\\Users\\HI\\Documents\\windworkspace\\llvm-dev-build\\bin\\tests\\test.cc -c -g -o test.o -std=c++17 $./llvm-dwarfdump -debug-line test.o ---- file_names[ 52]: name: "test.cc" dir_index: 3 mod_time: 0x00000000 length: 0x00000000 ---- duplicate entry in case-1 creates a problem while planting breakpoint(debugger says unresolved breakpoint, using a proprietary debugger). But case2 works fine because it has a single file entry. This problem can be observed with the relative path too. Like to know expert's thoughts on this weird behavior only observed on windows? Test(test.cc used above in command line is) $ cat tests/test.cc #include <iostream> #include <filesystem> namespace fs = std::filesystem; int main() { std::cout << "Current path is " << fs::current_path() << '\n'; // (1) fs::current_path(fs::temp_directory_path()); // (3) std::cout << "Current path is " << fs::current_path() << '\n'; } note: Above observation from mingw64 x86_64 msys2, latest clang(13.0) i.e. $ ./clang -v clang version 13.0.0 Target: x86_64-w64-windows-gnu Thread model: posix InstalledDir: C:\Users\HI\Documents\windworkspace\llvm-dev-build\bin clang was built by $ gcc -v Using built-in specs. COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-10.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --disable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev9, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\ -Wl,--stack,12582912' Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.0 (Rev9, Built by MSYS2 project) ./kamlesh
Is this https://bugs.llvm.org/show_bug.cgi?id=44170 which had a tentative patch at https://reviews.llvm.org/D71508 ? The original complaint wasn't for Windows, but the lack of filepath canonicalization seems like a common symptom. --paulr> -----Original Message----- > From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of kamlesh > kumar via llvm-dev > Sent: Monday, March 29, 2021 1:08 PM > To: Sanjoy Das via llvm-dev <llvm-dev at lists.llvm.org> > Subject: [llvm-dev] clang emit Duplicate file entry on windows > > Hi Devs, > clang Emitting duplicate file entry when the input file given like this > case-1: > $./clang++ -g -c -o test.o > /c/Users/HI/Documents/windworkspace/llvm-dev-build/bin/tests/test.cc > -std=c++17 > > $./llvm-dwarfdump -debug-line test.o > ----- > file_names[ 52]: > name: "test.cc" > dir_index: 3 > mod_time: 0x00000000 > length: 0x00000000 > file_names[ 53]: > name: "test.cc" > dir_index: 3 > mod_time: 0x00000000 > length: 0x00000000 > -------- > case-2: > But when input file given like this It emit only one file entry > $ ./clang C:\\Users\\HI\\Documents\\windworkspace\\llvm-dev- > build\\bin\\tests\\test.cc > -c -g -o test.o -std=c++17 > $./llvm-dwarfdump -debug-line test.o > ---- > file_names[ 52]: > name: "test.cc" > dir_index: 3 > mod_time: 0x00000000 > length: 0x00000000 > ---- > duplicate entry in case-1 creates a problem while planting > breakpoint(debugger says unresolved breakpoint, using a proprietary > debugger). > But case2 works fine because it has a single file entry. > This problem can be observed with the relative path too. > Like to know expert's thoughts on this weird behavior only observed on > windows? > > Test(test.cc used above in command line is) > $ cat tests/test.cc > #include <iostream> > #include <filesystem> > namespace fs = std::filesystem; > int main() > { > std::cout << "Current path is " << fs::current_path() << '\n'; // (1) > fs::current_path(fs::temp_directory_path()); // (3) > std::cout << "Current path is " << fs::current_path() << '\n'; > } > > note: Above observation from mingw64 x86_64 msys2, latest clang(13.0) > i.e. > $ ./clang -v > clang version 13.0.0 > Target: x86_64-w64-windows-gnu > Thread model: posix > InstalledDir: C:\Users\HI\Documents\windworkspace\llvm-dev-build\bin > clang was built by > $ gcc -v > > Using built-in specs. > COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe > COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64- > mingw32/10.2.0/lto-wrapper.exe > Target: x86_64-w64-mingw32 > Configured with: ../gcc-10.2.0/configure --prefix=/mingw64 > --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 > --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 > --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include > --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 > --with-tune=generic > --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit > --enable-shared --enable-static --enable-libatomic > --enable-threads=posix --enable-graphite --enable-fully-dynamic-string > --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes > --disable-libstdcxx-pch --disable-libstdcxx-debug > --disable-isl-version-check --enable-lto --enable-libgomp > --disable-multilib --enable-checking=release --disable-rpath > --disable-win32-registry --disable-nls --disable-werror > --disable-symvers --disable-plugin --with-libiconv --with-system-zlib > --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 > --with-isl=/mingw64 --with-pkgversion='Rev9, Built by MSYS2 project' > --with-bugurl=https://urldefense.com/v3/__https://github.com/msys2/MINGW- > packages/issues__;!!JmoZiZGBv3RvKRSx!sNo9vzG3u8UzUc- > TX__WUTwYUqhGVov3xqMG_hkrdO4ltWmnS0BmX-fl_sYk8bvdxA$ > --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe > -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high > -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' > 'LDFLAGS_FOR_TARGET=-pipe > -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high' > --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ > -static-libgcc\ -pipe\ > -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\ > -Wl,--stack,12582912' > Thread model: posix > Supported LTO compression algorithms: zlib zstd > gcc version 10.2.0 (Rev9, Built by MSYS2 project) > ./kamlesh > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://urldefense.com/v3/__https://lists.llvm.org/cgi- > bin/mailman/listinfo/llvm-dev__;!!JmoZiZGBv3RvKRSx!sNo9vzG3u8UzUc- > TX__WUTwYUqhGVov3xqMG_hkrdO4ltWmnS0BmX-fl_sZECZ7d3Q$