Skip to content

druntime: Test core.elf refactoring#2875

Closed
kinke wants to merge 1 commit intoldc-developers:masterfrom
kinke:elf
Closed

druntime: Test core.elf refactoring#2875
kinke wants to merge 1 commit intoldc-developers:masterfrom
kinke:elf

Conversation

@kinke
Copy link
Member

@kinke kinke commented Oct 14, 2018

Also testing whether all CI services support testing submodule PRs from non-official repos. Edit: Okay, CircleCI doesn't support it, so nope, definitely not an option.

@kinke
Copy link
Member Author

kinke commented Oct 14, 2018

Btw, from what I gathered, file I/O seems to be mandatory when looking up ELF sections. That's costly, so I gave up the original plan of replacing the magic linker symbols for the .minfo section.

@joakim-noah
Copy link
Contributor

How costly can it be? If it's only done once when initializing druntime, it can't be that bad, can it?

@kinke
Copy link
Member Author

kinke commented Oct 14, 2018

I haven't measured it, but opening the file for each D binary plus (quite) a bunch of mmap and munmap calls, all syscalls, and string comparisons (for each section, until we finally find the matching one) etc. doesn't seem very nice.
ELF seems to be fully segments-oriented and very sections-unfriendly.

@kinke
Copy link
Member Author

kinke commented Oct 14, 2018

What is it again that you need for Android TLS? The .tdata section range, right? Does the linker not support the magic __{start,stop}_<sectionName> symbols?
Edit: Looking at rt.sections_android, the magic symbols are supported. Is the leading dot a problem? If so, the section name could be changed from .t{bss,data} to __t{bss,data} or so - requiring an LLVM change, I know.

@joakim-noah
Copy link
Contributor

The .tdata range and the .tbss size are needed for emulated TLS. ld.bfd puts out start and stop delimiters for the .bss and __minfo sections, that's about it.

@joakim-noah
Copy link
Contributor

Yeah, I thought of changing the section name in LLVM when responding now too, I'll see how bad it'd be to patch.

@kinke
Copy link
Member Author

kinke commented Oct 14, 2018

__minfo is a custom section of ours, so the magic symbols should be generically supported. If they are missing for default .t{bss,data}, the simplest variant seems to rename them in LLVM (maybe ldc-developers/llvm@ecba7c7#diff-9fe0c35cacea033b04fa1786dfb46a45R503 is enough).

@kinke
Copy link
Member Author

kinke commented Oct 14, 2018

Btw we could also get rid of the current LDC-specifics in rt.sections_android by using minfo instead of __minfo for Android (on the LDC side).

@dnadlinger
Copy link
Member

Those symbols are indeed generic, but support varies across platforms – I'd advise looking at the linker source code if in doubt.

@kinke
Copy link
Member Author

kinke commented Oct 14, 2018

Now upstream: dlang/druntime#2330

@kinke
Copy link
Member Author

kinke commented Mar 8, 2020

An updated version of this has landed in branch ldc-merge-2.091.

@kinke kinke closed this Mar 8, 2020
@kinke kinke deleted the elf branch March 8, 2020 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants