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

syntax for coff associative sections is ambiguous #20334

Closed
llvmbot opened this issue Jun 5, 2014 · 4 comments
Closed

syntax for coff associative sections is ambiguous #20334

llvmbot opened this issue Jun 5, 2014 · 4 comments
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 5, 2014

Bugzilla Link 19960
Resolution FIXED
Resolved on Jun 06, 2014 14:32
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @rnk

Extended Description

When creating an associative section the syntax looks like

.section name,flags,associative assoc_name, comdat_sym

the problem is that we can have multiple sections named assoc_name.

A general but fairly disruptive change would be to have something like

%foo = .section ....

where %foo would be token that can be used to refer to the section.

A less general but simpler option would be so do the reference with

.section name,flags,associative assoc_name, assoc_comdat, comdat_sym

but given that assoc_comdat is in a section, we could also simplify this to

.section name,flags,associative assoc_comdat, comdat_sym

and in the object writer map the assoc_comdat to the assoc section number.

@rnk
Copy link
Collaborator

rnk commented Jun 6, 2014

I think you can go further. The comdat_sym of an associative section is meaningless. Recall that in the object file, the comdat_sym is completely implicit: it's merely the first symbol in the table that references the section. It's possible to have a section that contains no symbols, and hence has no comdat symbol. Therefore, why not parse the comdat symbol, but have it mean something else for associative sections. The comdat symbol is looked up, and its section number is emitted into the Number field.

We did some experiments with obj2yaml and the MSVC tools and this works.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jun 6, 2014

I think you can go further. The comdat_sym of an associative section is
meaningless. Recall that in the object file, the comdat_sym is completely
implicit: it's merely the first symbol in the table that references the
section. It's possible to have a section that contains no symbols, and
hence has no comdat symbol. Therefore, why not parse the comdat symbol, but
have it mean something else for associative sections. The comdat symbol is
looked up, and its section number is emitted into the Number field.

We did some experiments with obj2yaml and the MSVC tools and this works.

Something like

.section	.foo,"bw",discard, "sym"
.section	.bar,"rd",associative, "sym"

where .bar gets associated with .foo?

I like it. Giving it a try.

@rnk
Copy link
Collaborator

rnk commented Jun 6, 2014

Something like

.section .foo,"bw",discard, "sym"
.section .bar,"rd",associative, "sym"

where .bar gets associated with .foo?

I like it. Giving it a try.

Yep! So long as sym is defined in this instance of .foo, things work out.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jun 6, 2014

Fixed in r210367.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 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 mc Machine (object) code
Projects
None yet
Development

No branches or pull requests

2 participants