[PATCH] D75742: [Object] Support large archive members

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 18:05:31 PDT 2020


MaskRay accepted this revision.
MaskRay added a comment.

In D75742#1914799 <https://reviews.llvm.org/D75742#1914799>, @rupprecht wrote:

> In D75742#1912140 <https://reviews.llvm.org/D75742#1912140>, @jhenderson wrote:
>
> > Simplify size handling slightly.
> >
> > I've not deleted the test yet, but I will do so in due course before this gets committed. I'd like to see if we can come up with an alternative test option first, if we can. For the record, the test passes locally with my patch, but didn't without the fix (it was how I found the bug in the first place).
>
>
> I don't know if it's portable (you'd have to add requires for Linux/shell, or maybe do some lit configuration to detect if it's available), but you could try using `fallocate`:
>
>   $ time fallocate -l 3G test.large
>   fallocate -l 3G test.large  0.00s user 0.01s system 39% cpu 0.017 total
>   $ time cat test.large > /dev/null
>   cat test.large > /dev/null  0.01s user 1.18s system 99% cpu 1.193 total
>
>
> If you want to try that, I would still recommend keeping the unit test that runs on all platforms, and just having this lit one be an extra test.


Nice tip! Sparse files is even supported on ext2. So running it on Linux will be safe. However, if the disk cannot allocate 3G space (if the space is less 3G, then it surely cannot), fallocate(2) can fail with ENOSPC 28 No space left on device.

Additionally, if a test can take more than one second, I will still be hesitant..

`ld.lld -m elf_x86_64 -b binary test.large -o out` can take quite a few seconds. 2.5s in tmpfs with warn cache on my pc. It could be much slower with a different configuration.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75742/new/

https://reviews.llvm.org/D75742





More information about the llvm-commits mailing list