diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-01-12 19:20:47 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-01-12 19:20:47 +0000 |
commit | 7f70559bc47877bafc6dfa92b7df6b64650445fb (patch) | |
tree | 35e2a9f532175fdf23d0253f970ff2132448e5d9 /lib/Target/CBackend | |
parent | ab7752c1496c2913793305ba4b989a551c5617e1 (diff) | |
download | external_llvm-7f70559bc47877bafc6dfa92b7df6b64650445fb.zip external_llvm-7f70559bc47877bafc6dfa92b7df6b64650445fb.tar.gz external_llvm-7f70559bc47877bafc6dfa92b7df6b64650445fb.tar.bz2 |
* PIC codegen for X86/Linux has been implemented
* PIC-aware internal structures in X86 Codegen have been refactored
* Visibility (default/weak) has been added
* Docs fixes (external weak linkage, visibility, formatting)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index a0b4ceb..1346acb 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1290,6 +1290,11 @@ static void generateCompilerSpecificCode(std::ostream& Out) { << "#define __ATTRIBUTE_WEAK__\n" << "#endif\n\n"; + // Add hidden visibility support. FIXME: APPLE_CC? + Out << "#if defined(__GNUC__)\n" + << "#define __HIDDEN__ __attribute__((visibility(\"hidden\")))\n" + << "#endif\n\n"; + // Define NaN and Inf as GCC builtins if using GCC, as 0 otherwise // From the GCC documentation: // @@ -1500,6 +1505,8 @@ bool CWriter::doInitialization(Module &M) { Out << " __ATTRIBUTE_CTOR__"; if (StaticDtors.count(I)) Out << " __ATTRIBUTE_DTOR__"; + if (I->hasHiddenVisibility()) + Out << " __HIDDEN__"; if (I->hasName() && I->getName()[0] == 1) Out << " LLVM_ASM(\"" << I->getName().c_str()+1 << "\")"; @@ -1531,6 +1538,8 @@ bool CWriter::doInitialization(Module &M) { Out << " __ATTRIBUTE_WEAK__"; else if (I->hasExternalWeakLinkage()) Out << " __EXTERNAL_WEAK__"; + if (I->hasHiddenVisibility()) + Out << " __HIDDEN__"; Out << ";\n"; } } @@ -1559,6 +1568,9 @@ bool CWriter::doInitialization(Module &M) { else if (I->hasWeakLinkage()) Out << " __ATTRIBUTE_WEAK__"; + if (I->hasHiddenVisibility()) + Out << " __HIDDEN__"; + // If the initializer is not null, emit the initializer. If it is null, // we try to avoid emitting large amounts of zeros. The problem with // this, however, occurs when the variable has weak linkage. In this |