3

So basically when I am using objdump and readelf to disassemble some GNU Coreutils, I find a very weird situation like this:

readelf -s pr | grep bkm_scale

....
176: 08050620   118 FUNC    LOCAL  DEFAULT   13 bkm_scale
177: 080506a0    39 FUNC    LOCAL  DEFAULT   13 bkm_scale_by_power
181: 08050a60   173 FUNC    LOCAL  DEFAULT   13 bkm_scale
182: 08050b10    50 FUNC    LOCAL  DEFAULT   13 bkm_scale_by_power

and when I disassemble pr using objdump, I do see two definition of function bkm_scale and bkm_scale_by_power, and their disassembled asm code are different.

So does it indicate some disassemble error? If not, then why there are two FUNC symbols have the same name?

1 Answer 1

4

Looks like those are LOCAL definitions, perhaps defined in two places to allow slightly different versions to be used. They're not global functions, which would be constrained to only appear (or be defined) once.

Perhaps defined in several files, statically, so they're only used (or scoped to) in that particular file.

I don't see those functions in the output of readelf -s, or objdump on my system's installed 'pr'. I imagine you've compiled the coreutils yourself?

Since you're playing with the source code of 'pr', you could grep for bkm_scale and bkm_scale_by_power to see where they're used and defined.

Keep exploring! Keep learning!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.