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

[elf2] implement __start_SECNAME and __stop_SECNAME #25562

Closed
silvasean opened this issue Oct 15, 2015 · 6 comments
Closed

[elf2] implement __start_SECNAME and __stop_SECNAME #25562

silvasean opened this issue Oct 15, 2015 · 6 comments
Labels
bugzilla Issues migrated from bugzilla lld

Comments

@silvasean
Copy link
Contributor

Bugzilla Link 25188
Resolution FIXED
Resolved on Oct 16, 2015 20:52
Version unspecified
OS All
Blocks #23588
CC @Bigcheese,@hfinkel,@rui314

Extended Description

This is required by D13329 (r250200).

In D13329, the following quote from Ian Taylor:

"When a section name is a valid C identifier, the linker automatically provides __start and __stop symbols set to the addresses of the beginning and end of the section. The symbols are __start_SECNAME and __stop_SECNAME where SECNAME is the name of the section.

This is not defined by the ELF ABI, but it is completely reliable on
GNU/Linux. In fact it is reliable on any ELF system except possibly
Solaris, and it probably works on Solaris too. This is definitely
what you should do instead of using a linker script. It's more
reliable and more efficient, and it's what everybody else does"

@rui314
Copy link
Member

rui314 commented Oct 15, 2015

It should be easy to implement that, but do you know any program that actually uses his feature?

@rui314
Copy link
Member

rui314 commented Oct 15, 2015

Ah, sorry, http://reviews.llvm.org/D13329 is the example as you wrote. I'll try to implement this.

@silvasean
Copy link
Contributor Author

Do you know if Ian is referring to "input sections" or "output sections" when he says "sections"?

@rui314
Copy link
Member

rui314 commented Oct 15, 2015

It seems that "section name" means "output section name". I can link this code with gold, but if I rename input section "foo" to "bar" using linker script, it failed to link because __{start,stop}_foo no longer exist.

.global _start
.text
_start:
call __start_foo
call __stop_foo

.section foo,"ax"
nop

@rui314
Copy link
Member

rui314 commented Oct 15, 2015

@rui314
Copy link
Member

rui314 commented Oct 15, 2015

Implemented in r250432.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lld
Projects
None yet
Development

No branches or pull requests

2 participants