[PATCH] D62718: [llvm-objcopy] Change handling of output file permissions

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 22:37:58 PDT 2019


MaskRay added a comment.

We have 3 choices.

1. cp -p semantics: perm(output) = perm(input)
2. cp semantics:    perm(output) = perm(input) & ~umask
3. GNU objcopy (also linker behavior): perm(output) = (ET_EXEC || ET_DYN ? 0777 : 0666) & ~umask

Respecting umask is nice, so I'll go with 2) or 3).

The argument for 2) is: if the input shared object does not have executable bit,
after llvm-objcopy, we do not have to fix up the permission bits.

I don't hate 3) as much as I did before, but still feel we can't do it cleanly. If it is a block/character special file, you probably don't want to change its permission (think: root does llvm-objcopy something /dev/null).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62718





More information about the llvm-commits mailing list