lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Fri, Nov 23, 2018 at 6:48 AM Sean Conner <sean@conman.org> wrote:

> I interpret this to mean, "if the given object files do not include an object or function with external linkage, then said objects or functions can be pulled from a "library".

I cannot see how you reach this conclusion and this is exactly what the rest of your argument hinges on. I'd say this also exactly where the fundamental disagreement is.

5.1.1.2 #8 and 6.2.2 #2 that you quoted do not say that libraries are only consulted if something was not resolved in some "primary" translation units, and, as I said earlier, no such primacy is assigned to any translation units by the standard.

Nor do they say anything like "parts of libraries". An "entire program" includes full libraries. And here, you dismissed an important distinction between static libraries and shared libraries. Static libraries (archives) are typically just loose collections of object files not linked together. So (we kiss good-buy to portability and conformance at this point) it kind of makes sense to say that one of those object files can be pulled back from the archive "on demand" and linked to the program without pulling in other object files, so those other object files are kind of not really part of the program, so whatever external symbols they have is irrelevant. This behaviour is exactly what you and the other advocates of patchless patching exploit - where it works, and I have not seen any attempt to demonstrate that it works except with the GNU linker.

However, the whole point of patchless patching is about shared libraries, because it is not that difficult to modify a static library and link your application against this modified library. Shared libraries are not loose collections of object files. They are pre-linked executables and they most certainly bring with them all of their external symbols into the program. I explained how this could result in complications previously and won't repeat that. As far as I can see, no one in this entire thread has come up with a show case of patchless patching for a shared library, while claims like "the difference between [shared and static libraries] is not important for this disussion [sic]" have been made.

> Funny you mention that---I checked the C99 standard and found *nothing* about this.  It's not unspecified, it's not undefined, it's not implementation defined, its' not locale specific, *nothing*.

The very first message of mine in this thread explained how having multiple definitions of external linkage identifiers in an "entire program" is undefined behaviour, quoting the standard. Given your interpretation as to what an "entire program" is, you might indeed have difficulty seeing that.

Cheers,
V.