Skip to contentSkip to conversation

Question about .opd section

Linux-ia64 Wichmann, Mats D 3 participants 3 messages Feb 3, 2003

lore
Share & tools
lore
#0 lore raw

The gnu toolchain (well, binutils) emits a .opd section for architectures which use function descriptors - it's not unique to Itanium.

But I can't find much information about it. Google has been unhelpful (to me, anyway) on this one. It's described as holding function descriptors, but I'm not clear who uses this information - is this used at runtime?

Is this section considered normal/required for Linux/ia64? I'm asking because it wasn't in the Itanium psABI, and thus didn't make it into the current version of the Itanium LSB spec; our application checker tool is flagging this as an unknown section.

Thanks,

Mats

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Mats D

Mats> The gnu toolchain (well, binutils) emits a .opd section Mats> for architectures which use function descriptors - Mats> it's not unique to Itanium.

As far as I know, this is an HPism (originally coming from HP-UX PA-RISC). "opd" stands for "official procedure descriptor". the "official" is in the sense that the address of each descriptor serves as the canonical "address" of the function it's describing; i.e., this is what makes function-pointer comparisons work.

Mats> But I can't find much information about it. Google has been Mats> unhelpful (to me, anyway) on this one. It's described as Mats> holding function descriptors, but I'm not clear who uses this Mats> information - is this used at runtime?

Nothing at run-time directly references the .opd section, but of course whenever you call a function through a pointer, you'll end up loading the function's global-pointer and it's entry point from a descriptor. The main program's descriptor are stored in .opd (for shared objects, the function descriptors are created at runtime, by the runtime loader).

Mats> Is this section considered normal/required for Mats> Linux/ia64? I'm asking because it wasn't in the Mats> Itanium psABI, and thus didn't make it into the Mats> current version of the Itanium LSB spec; our Mats> application checker tool is flagging this as an Mats> unknown section.

It might be good to document it in the LSB. There might be tools out there that assume that .opd contains nothing but function descriptors, so if someone put something else in there, things might go wrong badly (which reeminds me: the ptrace-support in libunwind accesses .opd as a fallback-mechanism to determine the global-pointer of the main program; so there is at least one library out there that would break if .opd contained other stuff).

	--david
#2 lore raw
In reply to Wichmann, Mats D

[email protected] is a better place to ask questions like this. This is where the binutils experts hang out.

I found a comment in the IA-64 bfd support that says .opd contains "official procedure descriptors". I don't know where the terminology came from though.

The function descriptors are required for executing IA-64 code, so this is definitely a normal section when using the GNU tools. The section is required if present. The section is created by the linker, if one of the object files being linked uses a relocation type that requires that a function descriptor be created, e.g. LTOFF_FPTR22. The 2-word function descriptor goes in the .opd section, the address of the descriptor goes in the GOT, and the gcc generated code loads the address from the GOT.

I don't have easy access to any other IA-64 compiler, so I can't comment on how other compilers handle this.

Jim