Repository navigation
Conversation
ea21439 to
0bdb2ff
Compare
bsdjhb
left a comment
There was a problem hiding this comment.
One further thought I had after we talked about this is if we should accept the archive name alone as the path? E.g. "libfoo.a" or "libfoo*.a" and match on those?
I also wonder if it would be less confusing if we required a scope for archive members. In this way, the globs more readily match against the arguments passed on the command line to lld.
A longer term idea I have is to permit archives to embed a policy file (using some specific filename?) and for such a policy file, it would implicitly only apply file matches to object files contained in the .a. I can think of a way to implement that, but it may not be trivial to ensure that such an embedded policy doesn't contain rules that affect other object files included in a link that aren't from the archive. Still, it might be nice if libc.a contained the policy so static binaries would honor it? (Granted, static binaries don't implement stack isolation today, so....)
This allows for matching only input files pulled in from a static library. In theory extending this to support :(/path/to/)bar.o to mean only files not from static libraries (i.e. on the command line or pulled in by linker scripts) could be useful, but the priority of the various combinations becomes less clear, as static libraries (by virtue of being ar archives) don't permit directories and sidestep that question; specifically, there is the question of whether :bar.o or /path/to/bar.o (without an explicit empty scope) is higher priority.
…ntax [ELF][Cheri] Require archive names in c18n policy syntax For object files which are archive members, require the path of a file specification to name the archive (static library) rather than the individual object file. An archive name can be followed by an optional suffix (prefixed with a colon) with a glob pattern for archive members.
0bdb2ff to
02c7277
Compare
|
So the squash commit makes the changes I suggested of requiring the archive name leaving the member name as an optional suffix. I also ran into a weird issue with scopedPath.str() seeming to be a UAF locally that I resolved by just using a local std::string to "hold" the backing store for a plain StringRef while doing the per-file checks. The priority I use for archive members is "full archive path:" -> "full archive path" -> "base archive path:" -> "base archive path" in decreasing priority. The order of the middle two is debatable, that is a full path more important than fully-scoped or vice versa. |
This allows for matching only input files pulled in from a static
library.
In theory extending this to support :(/path/to/)bar.o to mean only files
not from static libraries (i.e. on the command line or pulled in by
linker scripts) could be useful, but the priority of the various
combinations becomes less clear, as static libraries (by virtue of being
ar archives) don't permit directories and sidestep that question;
specifically, there is the question of whether :bar.o or /path/to/bar.o
(without an explicit empty scope) is higher priority.