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

internalize zapping global constructors #1865

Closed
llvmbot opened this issue Jun 3, 2007 · 5 comments
Closed

internalize zapping global constructors #1865

llvmbot opened this issue Jun 3, 2007 · 5 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla ipo Interprocedural optimizations miscompilation

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 3, 2007

Bugzilla Link 1493
Resolution FIXED
Resolved on Feb 22, 2010 12:47
Version 1.9
OS Linux
Attachments Build and test script, C++ source with the std::map definition, C++ source with the main() function, Build and test script
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

See attached sources and build+test script.

The bug occurs only when compiling to bytecode and then linking the bytecode
into a single executable. When I use llvm-g++ to compile each C++ source to
native object files and link those, the executable runs fine.

Running the bytecode of the executable in lli also produces a segfault.

The std::map, although unused in the code, is essential for the segfault to
occur. Also, the segfault only occurs when I use two source files: when I put
this same code in a single C++ source file, it runs fine.

The std::map being part of the problem looks similar to bug 1491, but not
exactly the same:

  • this bug occurs when running the native executable, no errors while linking
  • this bug also occurs without -O2

I'm using LLVM 2.0 and its g++ front-end, compiled from source with GCC 4.1.3.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jun 3, 2007

assigned to @lattner

@asl
Copy link
Collaborator

asl commented Jun 3, 2007

Maarten, llvm-ld also runs optimizations. It seems, that static ctors/dtors were
deleted by llvm-ld (this can be due to #1863 ). Please use llvm-link as a
temporary workaround.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jun 5, 2007

I just retested after applying the fix for bug 1491 to LLVM and llvm-g++. The
resulting binary still segfaults, so it seems this is a separate bug.

Using llvm-link as a workaround indeed avoids the problem.

@lattner
Copy link
Collaborator

lattner commented Jun 6, 2007

taking a look

@lattner
Copy link
Collaborator

lattner commented Jun 6, 2007

Fixed, patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070604/050302.html

This was due to some legacy code that was used to support llvm-gcc3. The easiest thing to do is to zap it
entirely. Thanks for the report and the nice reduced testcase!

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 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 ipo Interprocedural optimizations miscompilation
Projects
None yet
Development

No branches or pull requests

3 participants