Extract a string variable from elf/obj file

Viewed 4398

I'm trying to extract a particular string variable (i.e. symbol) from a Linux program's elf file, or even from the .o it comes from. It's in the .rodata section, and obviously I know the symbol name. Is there a sequence of objdump-style commands and options I can use to dump out the string?

Update:

For example, the .map file includes:

.rodata.default_environment 0x000000001013f763 0x615 common/built-in.o
                            0x000000001013f763    default_environment

The variable itself - default_environment - is a standard null-terminated text string.

1 Answers
Related