[LLVMdev] LTOModule::parseSymbols not handling GlobalAlias (original) (raw)

Sergei Larin slarin at codeaurora.org
Tue Oct 7 07:54:34 PDT 2014


Rafael,

This was triggered by my original question... Can you please take a look? Thanks.

Sergei

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(GV)) { addDefinedDataSymbol(Sym); continue; } if (isa(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

-----Original Message----- From: Rafael EspĂ­ndola [mailto:rafael.espindola at gmail.com] Sent: Tuesday, October 07, 2014 8:01 AM To: Shankar Easwaran Cc: Sergei Larin; LLVM Developers Mailing List Subject: Re: [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 ltomodulegetnumsymbols 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 > ltomodulegetnumsymbols, 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



More information about the llvm-dev mailing list