[llvm-commits] Followon/Preceded-By reference support in lld

Shankar Easwaran shankare at codeaurora.org
Mon Nov 12 14:58:34 PST 2012


Thanks Nick.

Will not the current resolver throw an error, if any of the references 
are not satisfied ? I couldnt follow on why there is a need for a 
seperate pass ?

Also with the current changes, ReaderELF only creates a 
followon/preceded-by reference only for symbols that are Defined.

Thanks

Shankar Easwaran

+---
+atoms:
+    - name:              A
+      scope:             global
+      type:              code
+      section-choice:    custom-required
+      section-name:      .text
+

> Please change the ELF Reader and Writer so that the default section for type "code" is ".text".   The custom-required section is intended for user supplied sections like e.g. __attribute__((section(".foobar"))) not any of the standard sections.  This will reduce the "noise" and size of many test cases.
Ok.

>>   
>> +  enum {
>> +    FollowOn = -1,
>> +    PrecededBy = -2,
>> +    LayoutBefore = -3,
>> +    LayoutAfter = -4
>> +  };
>> +
> We only need two of these four.  I was suggesting that kindLayoutBefore and kindLayoutAfter are clearer names than follow-on and preceded-by.
>
Ok, will change it to LayoutBefore/LayoutAfter.
> +private: + std::map<int32_t, StringRef> _kindToString; + 
> std::map<StringRef, int32_t> _stringToKind; +}; } // namespace lld
> The mapping is the same for every Reference instance, so there is no need for a copy of the mapping in every object.  In other words, the mapping should be static.   And, for two entries a map is overkill.   Just make a static const array like was done in TestingKindMapping and walk the list looking for a match.
Sure, Will do this change.

>
> You also need to create a Pass which sorts atoms to ensure all "before" and "after" references are satisfied, and errors if unsatisfiable.

Will not, the current resolver throw up an error, if any of the 
references are unsatisfied ? Also with ReaderELF, the followon and 
preceded by reference are created only for DefinedAtoms.

Thanks

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-commits mailing list