<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Ruiu,<br>
<br>
I am not sure if you looked at this thread
(<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-October/066155.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-October/066155.html</a>)<br>
<br>
let me know if you still have questions.<br>
<br>
As a short summary, we dont verify the architecture of files that
are being read. We could very well be passed in a hexagon input
file while the target specified was x86_64. we got to reject the
input file as the user has chosen the architecture to be x86_64.<br>
<br>
Thanks<br>
<br>
Shankar Easwaran<br>
<br>
On 4/1/2014 11:34 PM, Rui Ueyama wrote:<br>
</div>
<blockquote
cite="mid:CAJENXgty_Ojwyv0Jh7Yb8kLKZp7+LVLf0iD10rGo-YU=YszmSA@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
<div dir="ltr">Could you elaborate a bit about the issue that you
are trying to solve with this suggestion?</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Apr 1, 2014 at 9:27 PM, Shankar
Easwaran <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote">Hi Nick, Bigcheese,<br>
<br>
Resurrecting a old thread.<br>
<br>
Now since we have a Registry that models Readers, do we want
to have a function in the Registry that evaluates whether a
file should be parsed into atoms (or) raise an appropriate
error ?<br>
<br>
I would think the output architecture could be chosen from
the first file that was parsed, I think each flavor's
LinkingContext should store a field pointing to the
architecture of the first input file that was tried to be
parsed.<br>
<br>
Thanks<span class="HOEnZb"><br>
<br>
Shankar Easwaran</span>
<div class="HOEnZb">
<div class="h5"><br>
<br>
On 10/7/2013 3:50 PM, Shankar Easwaran wrote:<br>
<blockquote class="gmail_quote">
On 10/7/2013 3:23 PM, Nick Kledzik wrote:<br>
<blockquote class="gmail_quote">
On Oct 4, 2013, at 8:50 PM, Shankar Easwaran <<a
moz-do-not-send="true"
href="mailto:shankare@codeaurora.org"
target="_blank">shankare@codeaurora.org</a>>
wrote:<br>
<blockquote class="gmail_quote">
It is needed that lld verifies the input to the
linker.<br>
<br>
For example : a x86 ELF file can be given to lld
when the target is x86_64. Similiarly with other
flavors.<br>
<br>
I was thinking to have a varargs function in the
LinkingContext that would be overridden by each of
the LinkingContexts to verify files after being
read.<br>
<br>
The reader would call the varargs function in the
LinkingContext and raise an error if the input is
not suitable with the current link mode.<br>
</blockquote>
Yes. We need a way to error out if there is an
architecture mismatch. But there are some
interesting scenarios we need to support.<br>
</blockquote>
Ok. will create a varArg function (verifyArch ?)<br>
<br>
I am trying to see if variadic functions would be
another alternative too.<br>
<br>
<blockquote class="gmail_quote">
* If linking with a static library, you may not know
until you actually need to load one of the members
if the architecture is wrong, and it may not be an
error if the architecture is wrong, but nothing is
loaded.<br>
<br>
* It might be a warning instead of an error to link
against a shared library of the wrong architecture.
That is, the linker may need to ignore (and warn)
but continue and try to complete the link without
it.<br>
<br>
* The mach-o linker also allows you to not specify
the architecture on the command line. Instead the
linker infers the architecture by looking at the
first object file. This is mostly used in -r mode.
So, where the check is done to see that the arch is
correct, may actually cause the architecture in the
LinkingContext to be set.<br>
</blockquote>
For lld, I think the flavor also would need to be
inferred from the first object, isnt it ?<br>
<blockquote class="gmail_quote">
<br>
* mach-o also has “fat” files which can contain
multiple architectures. So, the reader needs to
know the arch to even try to parse. In other words,
if the Reader is told the intended arch, the Reader
could error out if the file is not of that arch (and
for mach-o the Reader would select the right slice
in a fat file).<br>
</blockquote>
Since all of the code ends up within the parseFile
function in the Reader, we should be able to query
LinkingContext and return an actual error/warning on a
need basis and only on valid scenarios.<br>
<br>
Thanks<br>
<br>
Shankar Easwaran<br>
<br>
</blockquote>
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code
Aurora Forum, hosted by the Linux Foundation<br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre>
</body>
</html>