Sergei Larin
2014-Oct-02 16:22 UTC
[LLVMdev] LTOModule::parseSymbols not handling GlobalAlias
Hello everyone, ...I should have used a different subject line in the first place... I've asked Rafael a question about GlobalAlias handling in LTOModule::parseSymbols, but he seems to be on vacation... Does anyone knows the answer? Thanks a lot! Sergei --- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation> -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Sergei Larin > Sent: Thursday, October 02, 2014 11:06 AM > To: 'Rafael Espíndola' > Cc: 'LLVM Developers Mailing List' > Subject: Re: [LLVMdev] [RFC] Exhaustive bitcode compatibility tests for IR > features > > > Hi Rafael, > > I have a quick question for you. First of all I am not very familiarwith this> code, so.... > > > Before this change: > > [llvm] r212349 - Implement LTOModule on top of IRObjectFile > http://comments.gmane.org/gmane.comp.compilers.llvm.cvs/195450 > > > LTOModule::parseSymbols used to explicitly add global aliases as defined > symbols: > > // add aliases > for (const auto &Alias : IRFile->aliases()) > addDefinedDataSymbol(Alias); > > After your patch I do not seem to see an explicit handling of aliases... Iwould> naively expect something like this: > > for (auto &Sym : IRFile->symbols()) { > ..... > if (isa<GlobalVariable>(GV)) { > addDefinedDataSymbol(Sym); > continue; > } > > if (isa<GlobalAlias>(GV)) { > addDefinedDataSymbol(Sym); > continue; > } > > } > > > Is this an oversight or a design decision? If this is the later,when/where> aliases should be handled? > Thanks a lot. > > Sergei > > > > > --- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > hosted by The Linux Foundation > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Shankar Easwaran
2014-Oct-02 16:35 UTC
[LLVMdev] LTOModule::parseSymbols not handling GlobalAlias
Hi, There is a genuine case that lto_module_get_num_symbols doesnot return all the symbols that are in the bitcode file. Test case:- cat > test.c << \! int bar() { return 0; } int foo() __attribute__ ((weak, alias ("bar"))); ! clang -c test.c -emit-llvm Use a program to list all the symbols using lto_module_get_num_symbols, and foo will be missing from the list. Thanks Shankar Easwaran On 10/2/2014 11:22 AM, Sergei Larin wrote:> Hello everyone, > > ...I should have used a different subject line in the first place... > > > I've asked Rafael a question about GlobalAlias handling in > LTOModule::parseSymbols, but he seems to be on vacation... > > > Does anyone knows the answer? > > Thanks a lot! > > Sergei > > > --- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by > The Linux Foundation > > >> -----Original Message----- >> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] >> On Behalf Of Sergei Larin >> Sent: Thursday, October 02, 2014 11:06 AM >> To: 'Rafael Espíndola' >> Cc: 'LLVM Developers Mailing List' >> Subject: Re: [LLVMdev] [RFC] Exhaustive bitcode compatibility tests for IR >> features >> >> >> Hi Rafael, >> >> I have a quick question for you. First of all I am not very familiar > with this >> code, so.... >> >> >> Before this change: >> >> [llvm] r212349 - Implement LTOModule on top of IRObjectFile >> http://comments.gmane.org/gmane.comp.compilers.llvm.cvs/195450 >> >> >> LTOModule::parseSymbols used to explicitly add global aliases as defined >> symbols: >> >> // add aliases >> for (const auto &Alias : IRFile->aliases()) >> addDefinedDataSymbol(Alias); >> >> After your patch I do not seem to see an explicit handling of aliases... I > would >> naively expect something like this: >> >> for (auto &Sym : IRFile->symbols()) { >> ..... >> if (isa<GlobalVariable>(GV)) { >> addDefinedDataSymbol(Sym); >> continue; >> } >> >> if (isa<GlobalAlias>(GV)) { >> addDefinedDataSymbol(Sym); >> continue; >> } >> >> } >> >> >> Is this an oversight or a design decision? If this is the later, > when/where >> aliases should be handled? >> Thanks a lot. >> >> Sergei >> >> >> >> >> --- >> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, >> hosted by The Linux Foundation >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
Rafael Espíndola
2014-Oct-07 13:00 UTC
[LLVMdev] LTOModule::parseSymbols not handling GlobalAlias
On 2 October 2014 12:35, Shankar Easwaran <shankare at codeaurora.org> wrote:> Hi, > > There is a genuine case that lto_module_get_num_symbols doesnot return all > the symbols that are in the bitcode file. > > Test case:- > > cat > test.c << \! > int bar() { return 0; } > int foo() __attribute__ ((weak, alias ("bar"))); > ! > > clang -c test.c -emit-llvm > > Use a program to list all the symbols using lto_module_get_num_symbols, and > foo will be missing from the list.I can't reproduce this. If a run llvm-lto -dso-symbol bar -dso-symbol foo test.o -o out.o I do get both symbols in the output. Setting a breakpoint in llvm-lto.cpp:154 also shows NumSyms being 2. Cheers, Rafael