https://sourceware.org/bugzilla/show_bug.cgi?id=19526

--- Comment #8 from dave.anglin at bell dot net ---
On 2016-01-30, at 8:51 AM, sch...@linux-m68k.org wrote:

> https://sourceware.org/bugzilla/show_bug.cgi?id=19526
> 
> --- Comment #7 from Andreas Schwab <sch...@linux-m68k.org> ---
> The linker should not allow writing the output to a non-regular file in the
> first place.  Changing the behaviour depending on the type of output file 
> would
> be wrong.


Currently in bfd/opncls.c, there is the following code

  if (abfd->direction == write_direction
      && (abfd->flags & (EXEC_P | DYNAMIC)) != 0)
    {
      struct stat buf;

      if (stat (abfd->filename, &buf) == 0
          /* Do not attempt to change non-regular files.  This is
             here especially for configure scripts and kernel builds
             which run tests with "ld [...] -o /dev/null".  */
          && S_ISREG(buf.st_mode))
        {
          unsigned int mask = umask (0);

          umask (mask);
          chmod (abfd->filename,
                 (0777
                  & (buf.st_mode | ((S_IXUSR | S_IXGRP | S_IXOTH) &~ mask))));
        }
    }

to support "ld [...] -o /dev/null".

It seems to me we either have to match x86 behaviour, or the linker should not
allow writing
to a non-regular file.

Dave
--
John David Anglin       dave.ang...@bell.net

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to