Talk:Position-independent code

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Unnamed section[edit]

Note that although "position-independent code" is arguably more grammatical, common usage strongly favor the no-hyphen version, presumably because system programmers are only semi-literate. :-) Stan 14:15, 2 Apr 2004 (UTC)

Cesian programs[edit]

I noticed that Evan added a link to to question the following sentence: However, [PIC] can be generated automatically with a Cesian program. The text was added by User:Mirad, who has only a few contributions. I'm going to go out on a limb and say I think the term is bogus. -- Wmahan. 22:09, 13 October 2005 (UTC)[reply]

ELF[edit]

Though this article doesn't mention it, nearly all of the details are basically specific to ELF, aren't they? I think this should be made clearer.

MikeHearn 21:27, 14 May 2006 (UTC)[reply]

The ELF mechanisms are based on those used in SunOS 4.x, which used an a.out-based format. I think Mach-O in Mac OS X uses mechanisms that are similar in some ways, and perhaps the mechanisms used with 32-bit PA-RISC in HP-UX and used in Tru64 UNIX, and even the mechanisms used in AIX, are also similar, but, yes, the page should probably discuss that, perhaps giving terminological and technical differences between various UN*Xes. Guy Harris 22:06, 14 May 2006 (UTC)[reply]

Relocation Work Required[edit]

Although relocatable code requires much more fixup than does PIC, PIC still requires some fixup by the loader. For example when using a GOT, the GOT can contain absolute addresses that need to be fixed up based on where the module is loaded.

What functions are inherited?[edit]

As this page is linked from Library (computing) it should be somewhat more explicative.

In particular, the following sentence leaves much to be guessed:

This notably allows a shared library to inherit certain function calls from previously loaded libraries rather than e. g. using its own versions

Why is that an advantage? E.g., Can an executable that exports its own malloc() propagate it to loaded libraries? On the other hand, why can that inheritance be a problem? It may be useful to include a link to best programming practices or gotchas one should watch against. This is an example where Unix and Windows differ. Those differences are mentioned often, but is difficult to understand their semantic implications.

How does such inheritance propagate across the exec family of functions? In general, an executable can behave differently depending on which process loaded it, because the parent process can have a number of shared libraries already loaded in its address space. Where can one learn more about this topic?

194.243.254.190 11:44, 3 December 2006 (UTC)[reply]

History: TSS[edit]

I'd like to say something about the TSS/360 implementation of PIC which, to me, sounds a lot like current Linux implementations, but I'm not sure I have enough background. What earlier implementations existed? Peter Flass (talk) 11:43, 17 October 2013 (UTC)[reply]

PIC and operating systems[edit]

In "History" I eliminated the paragraph concerning the use of PIC to implement operating system overlays. For example OS/360 used SVC transient areas, but not necessarily PIC (type 1 and 2 SVCs). The Burroughs 5500 MCP falls into the category of segmented systems and was inherently PIC. Peter Flass (talk) 12:20, 17 October 2013 (UTC)[reply]

Windows[edit]

I removed some incorrect and irrelevant information about Windows and the relationship between PIC code and pre-linking. Pre-linking doesn't have much to do with PIC code. It has more to do with symbol resolution, which is for references that could potentially cross modules. PIC is more about references within a module.— Preceding unsigned comment added by 2001:4898:80e0:ee43::3 (talk) 00:06, 31 January 2015 (UTC)‎[reply]

Link only first use or also first in section?[edit]

Position-independent code#History has links for Multics and TSS/360. A recent edit by 70.92.191.178 added a second link for Multics, in the Multics section; there is no second link for TSS. Should I also link TSS/360 in the TSS section, or revert the edit? Shmuel (Seymour J.) Metz Username:Chatul (talk) 18:19, 6 July 2020 (UTC)[reply]

WP:NPOV[edit]

The section #Technical details describes a specific implementation, and as such should either be under the platform to which it applies or include the platform in the section name. In particular, not all implementations of PIC use a global offset table (GOT). --Shmuel (Seymour J.) Metz Username:Chatul (talk) 17:17, 6 September 2021 (UTC)[reply]

It's more of an over-specificity issue than a neutrality issue; it's not saying this is the only right way to do PIC, it's saying "this is the way PIC is done" rather than, more specifically, "this is the way PIC is done in systems implemented using the SunOS 4.0 style of PIC and dynamic linking" (SVR4's system was based on the SunOS 4.0 one, and other systems such as Linux and the *BSDs that adopted SVR4's ELF also adopted its dynamic linking system; some other UN*Xes also modeled their systems after the SunOS 4.0 system). Guy Harris (talk) 19:04, 6 September 2021 (UTC)[reply]

I think the endless disputes about how PIC works and what OSes are inferior and so on stem from conflating two terms/ideas under one command-line option (-fpic) in GCC: position independent code and interposition of symbols in ELF format. The later is used to make sure if a symbol is defined in multiple binaries then the earliest definition "wins" and a binary will use the winning definition even though the binary already contains its own implementation. Sadly the second concept has no page on the Wikipedia. And I do not think it is Wikipedia's job to untangle the misunderstanding. --Alvin-cs 17:53, 15 October 2021 (UTC)[reply]