[PATCH] objdump: Use the SEC_CODE bit only for the section symbol

Jan Beulich jbeulich@suse.com
Tue Sep 9 07:00:36 GMT 2025


On 09.09.2025 08:43, Alan Modra wrote:
> On Tue, Sep 09, 2025 at 08:12:26AM +0200, Jan Beulich wrote:
>> On 09.09.2025 00:24, H.J. Lu wrote:
>>> .got section on Powerpc contains both code and data:
>>>
>>> Disassembly of section .got:
>>>
>>> 000101f0 <.got>:
>>>    101f0:	02 00 00 00 	.long 0x2
>>> 	...
>>>    10200:	21 00 80 4e 	blrl
>>>
>>> 00010204 <_GLOBAL_OFFSET_TABLE_>:
>>>    10204:	70 01 01 00 00 00 00 00 00 00 00 00                 p...........
>>>
>>> Use the SEC_CODE bit only if the symbol address matches the section start
>>> address:
>>
>> Hmm, that's not very helpful. After all ...
>>
>>> Disassembly of section .plt:
>>>
>>> 00000000000002c0 <_PROCEDURE_LINKAGE_TABLE_>:
>>
>> ... this is a symbol which could easily be stripped off an executable without
>> harming its functionality, aiui. Do we need targets to convey certain
>> properties?
>>
>> What I find also irritating - above you're talking of .got, yet here you're
>> showing .plt. This will want clarifying.
> 
> I think commit 6b27a220321e should be reverted.  The place HJ was
> patching is all about symbols so testing a section flag just looks
> wrong.  SEC_CODE is tested elsewhere.  If _PROCEDURE_LINKAGE_TABLE_
> or _GLOBAL_OFFSET_TABLE_ are causing a problem then do something
> about those particular symbols.

Yes, seeing the tweak here (which I expect wouldn't be the last one), I
agree (and in hindsight I probably shouldn't have approved the change).

> Hmm, why are we checking for gnu_compiled and gcc2_compiled here and
> in compare_symbols?  Wouldn't it be better to handle them once in
> remove_useless_symbols?

I, too, was wondering about that.

Jan


More information about the Binutils mailing list