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

size missing in mergeable section #5022

Closed
llvmbot opened this issue Jul 30, 2009 · 7 comments
Closed

size missing in mergeable section #5022

llvmbot opened this issue Jul 30, 2009 · 7 comments
Labels
bugzilla Issues migrated from bugzilla llvm:codegen

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 30, 2009

Bugzilla Link 4650
Resolution FIXED
Resolved on Mar 06, 2010 13:59
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @lattner

Extended Description

Compiling

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-unknown-linux-gnu"
@​foo = weak_odr constant [1 x i8] c"\01"

produces
.section .gnu.linkonce.r.foo,"aM",@progbits

Before revision 77184 it would produce

.section .gnu.linkonce.r.foo,"a",@progbits

This causes the gnu assembler to produce the warning:

Warning: entity size for SHF_MERGE not specified

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 30, 2009

FYI, gcc uses "aG".

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 31, 2009

A c++ testcase:


class foo {
public:
void test() {
static const char v[1] = { 1 };
}
};
void foobar() {
foo rep;
rep.test();
}

gcc produces

.weak _ZZN3foo4testEvE1v
.section .rodata._ZZN3foo4testEvE1v,"aG",@progbits,_ZZN3foo4testEvE1v,comdat
.type _ZZN3foo4testEvE1v, @​object
.size _ZZN3foo4testEvE1v, 1
_ZZN3foo4testEvE1v:
.byte 1

we produce

.type _ZZN3foo4testEvE1v,@object
.section .gnu.linkonce.r._ZZN3foo4testEvE1v,"aM",@progbits
.weak _ZZN3foo4testEvE1v
_ZZN3foo4testEvE1v: # _ZZN3foo4testEvE1v
.size _ZZN3foo4testEvE1v, 1
.ascii "\001"

I now think that the correct fix is to print a ", 1" in the section line after
@​progbits (or to use comdat as gcc does).

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 31, 2009

A hack that fixes the bug
The attached patch is a hack, but it fixes the bug and "make check" has no regressions.

What is the proper way to do this? Should I remove MergeableConst{4,8,16}?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 31, 2009

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jul 31, 2009

Just bumping up severity a bit, since this can also cause linker errors, not just warnings.

@lattner
Copy link
Collaborator

lattner commented Jul 31, 2009

I'm sorry, I missed this bug. Taking a look now, sorry!

@lattner
Copy link
Collaborator

lattner commented Jul 31, 2009

I opted to go for the simple fix:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090727/083081.html

This returns us back to previous behavior. I'd like to get further along with the section selection refactoring stuff before making it more complex.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this issue Aug 1, 2022
[apinotes][cxx-interop] Add support for namespaces, nested tags, and methods.
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 llvm:codegen
Projects
None yet
Development

No branches or pull requests

2 participants