[llvm-dev] lld: sigbus error handling

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 30 17:32:47 PDT 2017


Rui Ueyama <ruiu at google.com> writes:

> On Mon, Oct 30, 2017 at 4:31 PM, Rafael Avila de Espindola <
> rafael.espindola at gmail.com> wrote:
>
>> Rui Ueyama <ruiu at google.com> writes:
>>
>> > But that would disable mmap IO on systems that don't support fallocate.
>> I'm
>> > not sure if OpenBSD people are for example happy about that.
>>
>> Only for output. It is hard to guess the preference of others, but if it
>> was the system I was using I would prefer a more reliable linker until
>> something like fallocate was provided by the file system.
>>
>> I remember trying to switch lld to always use an anonymous buffer, and
>> it was really not that bad.
>>
>
> Fair. I'll try to do that first before exploring the idea of setting a
> signal handler.

And if the performance of always using an anonymous buffer is too low,
we could use an abstraction like:

  class OutputBuffer {
        // allocate FD to Size if it is supported by the filesystem and
        // mmap it. If pre allocation fails, get an anonymous memory
        // buffer of Size bytes.
        MMapOutput(int FD, size_t Size);

        // Return the mmaped or anonymous buffer.
        void *getBuffer();
        private:
        // The buffer if we could not pre allocated the file.
        std::unique_ptr<void *> Buffer;
  };

Cheers,
Rafael


More information about the llvm-dev mailing list