|
Home > Archive > Unix Programming > December 2007 > Cutting from nm command
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cutting from nm command
|
|
| Henrik Goldman 2007-12-09, 7:21 pm |
| As a part of a linker step for an application we're building we need to use
objcopy to hide the symbols which should be marked private (to avoid
confusion with other libraries).
For most platforms this has been a static list which we've had in a
textfile.
However for hp-ux 11.11 there are a number of symbols starting with
_GLOBAL__ which needs to be unmarked as hidden.
Viewing the output from nm we get the following:
bash-3.2# nm temp/hpux_hppa_ilp32/lmxrtw.o | grep _GLOBAL__
_GLOBAL__D__Z30XMHAVHVMSAPHZKJRRGAOBYPAC
BAMKTP4FILE| 33552|static|entry
|$CODE$
_GLOBAL__D___cxa_get_globals_fast| 336312|static|entry |$CODE$
_GLOBAL__F_.._.._.._.._libstdc___v3_src_string_inst. cc_35A49152_BB9F5F62|1073818500|static|d
ata
|$DATA$
_GLOBAL__F__Z30XMHAVHVMSAPHZKJRRGAOBYPAC
BAMKTP4FILE_74692525|1073786448|static|d
ata
|$DATA$
_GLOBAL__F__ZN10__cxxabiv111__terminateE
PFvvE_B1D5CE00|1073831536|static|data
|$DATA$
....
In thise cases we would need to cut away the part starting from the first
'|' and transform it into a single line as: -G symbol1 -G symbol2 -G etc. to
satisfy the commandline of objcopy.
Which command would be appropriate for cutting anyway anything from the
first '|' char?
Thanks.
-- Henrik
| |
| Paul Pluzhnikov 2007-12-09, 7:21 pm |
| "Henrik Goldman" <henrik_goldman@mail.tele.dk> writes:
> Which command would be appropriate for cutting anyway anything from the
> first '|' char?
$ echo 'abc|def|ghi' | cut -d'|' -f1
abc
$
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
| |
| William Pursell 2007-12-10, 1:42 am |
| On 9 Dec, 21:41, "Henrik Goldman" <henrik_gold...@mail.tele.dk> wrote:
> As a part of a linker step for an application we're building we need to use
> objcopy to hide the symbols which should be marked private (to avoid
> confusion with other libraries).
Forgive me if this is a stupid question, or perhaps
just really gnu-centric, but why not use
__attribute__((visibility("hidden"))) ? Is
that completely gnu specific?
| |
| Paul Pluzhnikov 2007-12-10, 1:42 am |
| William Pursell <bill.pursell@gmail.com> writes:
> Forgive me if this is a stupid question, or perhaps
> just really gnu-centric, but why not use
> __attribute__((visibility("hidden"))) ? Is
> that completely gnu specific?
The whole __attribute__ business is completely GNU-specific, but
that's not the problem, since Henrik is using g++.
Rather, the problem is that 'hidden' (or any other) visibility
is only supported on ELF platforms, and HP-UX 11.11 for PA-RISC
doesn't use ELF objects in 32-bit mode.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
|
|
|
|
|