Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 4014 - CodeView debug type info not linked in from library #4051

Closed
wants to merge 3 commits into from

Conversation

rainers
Copy link
Member

@rainers rainers commented Oct 7, 2014

https://issues.dlang.org/show_bug.cgi?id=4014

This PR adds a relocation to S.init if S is referred to by the debug info. It assumes the debug info is found there and will be linked in if S.init is linked in.

Currently only implemented for Win32/Win64.

This is an alternative to #398

Advantages:

  • debug info doesn't have to be rebuilt every time it is referred to
  • small overhead in debug-section only

Disadvantages:

  • no debug info, if library is built without
  • assumes that S.init is found in the library, i.e. files with declarations only still need to be compiled (very much as proposed by Generate TypeInfo objects as in template instances #3958)
  • abuses S_LABEL32 debug record, maybe some other unrecognized record is better

@WalterBright
Copy link
Member

This PR adds a relocation to S.init if S is referred to by the debug info. It assumes the debug info is found there and will be linked in if S.init is linked in.

I am not understanding exactly what this is doing.

  1. debug info is where?
  2. where is s.init?
  3. what is going on with S_LABEL32? why not use normal references?

@rainers
Copy link
Member Author

rainers commented Oct 13, 2014

debug info is where?

It is written with the struct declaration https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L853

where is s.init?

s.init happens to be generated into the same object file as the debug info.

https://github.com/D-Programming-Language/dmd/blob/master/src/toobj.c#L875

what is going on with S_LABEL32? why not use normal references?

What do you mean by "normal reference"? Where would that be?

I just need a few bytes of data inside the debug info that are mostly ignored. These bytes are the target of a relocation to S.init that causes the debug info to be dragged in by the linker. (A cleaner approach is probably to add a PUBDEF symbol to the debug info and add the relocation to this).

S_LABEL32 is a record that seems unused by the debugger. As I mentioned in the description, defining our own ID that is unlikely to collide with exisitng records might be ignored even better. Unfortunately, the OEM records are only for types, not for symbols.

@rainers
Copy link
Member Author

rainers commented Nov 14, 2014

A cleaner approach is probably to add a PUBDEF symbol to the debug info and add the relocation to this

Quoting from #398: I changed my mind over this, it will cause a lot of link errors when building against a library witthout debug symbols. The init symbol still exists in the release library, so no harm done apart from being unable to debug that part of the application.

@MartinNowak
Copy link
Member

Concept makes sense, Istill have to look a bit closer at the implementation.

@rainers
Copy link
Member Author

rainers commented Jan 12, 2015

Fixed and rebased.

@rainers
Copy link
Member Author

rainers commented Mar 10, 2015

Rebased. I have now replaced S_LABEL32 with S_SKIP, this should remove possible side effects.

@rainers
Copy link
Member Author

rainers commented Jun 15, 2017

Closing in favor of #6908

@rainers rainers closed this Jun 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants