Skip to content

Commit

Permalink
Mark internal argp functions with attribute_hidden [BZ #18822]
Browse files Browse the repository at this point in the history
Mark internal argp functions with attribute_hidden to allow direct
access to them within libc.so and libc.a without using GOT nor PLT.

	[BZ #18822]
	* argp/argp-fmtstream.c: Include <argp-fmtstream.h>.
	* argp/argp-fs-xinl.c: Likewise.
	* argp/argp-help.c: Include <argp.h> and <argp-fmtstream.h>.
	* argp/argp-parse.c: Include <argp.h>.
	* argp/argp-xinl.c: Likewise.
	* include/argp-fmtstream.h: New file.
	* include/argp.h (__argp_error): Add attribute_hidden.
	(__argp_failure): Likewise.
	(__argp_input): Likewise.
	(__argp_state_help): Likewise.
  • Loading branch information
hjl-tools committed Oct 1, 2017
1 parent c26dd7c commit 8345a76
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 6 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2017-10-01 H.J. Lu <[email protected]>

[BZ #18822]
* argp/argp-fmtstream.c: Include <argp-fmtstream.h>.
* argp/argp-fs-xinl.c: Likewise.
* argp/argp-help.c: Include <argp.h> and <argp-fmtstream.h>.
* argp/argp-parse.c: Include <argp.h>.
* argp/argp-xinl.c: Likewise.
* include/argp-fmtstream.h: New file.
* include/argp.h (__argp_error): Add attribute_hidden.
(__argp_failure): Likewise.
(__argp_input): Likewise.
(__argp_state_help): Likewise.

2017-10-01 H.J. Lu <[email protected]>

[BZ #18822]
Expand Down
2 changes: 1 addition & 1 deletion argp/argp-fmtstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <stdarg.h>
#include <ctype.h>

#include "argp-fmtstream.h"
#include <argp-fmtstream.h>
#include "argp-namefrob.h"

#ifndef ARGP_FMTSTREAM_USE_LINEWRAP
Expand Down
2 changes: 1 addition & 1 deletion argp/argp-fs-xinl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define ARGP_FS_EI
#undef __OPTIMIZE__
#define __OPTIMIZE__ 1
#include "argp-fmtstream.h"
#include <argp-fmtstream.h>

#if 0
/* Not exported. */
Expand Down
4 changes: 2 additions & 2 deletions argp/argp-help.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ char *strerror (int errnum);
# endif
#endif

#include "argp.h"
#include "argp-fmtstream.h"
#include <argp.h>
#include <argp-fmtstream.h>
#include "argp-namefrob.h"

#ifndef SIZE_MAX
Expand Down
2 changes: 1 addition & 1 deletion argp/argp-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ char *alloca ();
# define N_(msgid) (msgid)
#endif

#include "argp.h"
#include <argp.h>
#include "argp-namefrob.h"

/* Getopt return values. */
Expand Down
2 changes: 1 addition & 1 deletion argp/argp-xinl.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define ARGP_EI
#undef __OPTIMIZE__
#define __OPTIMIZE__ 1
#include "argp.h"
#include <argp.h>

/* Add weak aliases. */
#if _LIBC - 0 && defined (weak_alias)
Expand Down
19 changes: 19 additions & 0 deletions include/argp-fmtstream.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef _ARGP_FMTSTREAM_H
#include <argp/argp-fmtstream.h>

#ifndef _ISOMAC
extern __typeof (__argp_fmtstream_ensure) __argp_fmtstream_ensure
attribute_hidden;
extern __typeof (__argp_fmtstream_free) __argp_fmtstream_free
attribute_hidden;
extern __typeof (__argp_fmtstream_printf) __argp_fmtstream_printf
attribute_hidden;
extern __typeof (__argp_fmtstream_update) __argp_fmtstream_update
attribute_hidden;
extern __typeof (__argp_fmtstream_write) __argp_fmtstream_write
attribute_hidden;
extern __typeof (__argp_make_fmtstream) __argp_make_fmtstream
attribute_hidden;
#endif

#endif
10 changes: 10 additions & 0 deletions include/argp.h
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#ifndef _ARGP_H
#include <argp/argp.h>

#ifndef _ISOMAC
extern __typeof (__argp_error) __argp_error attribute_hidden;
extern __typeof (__argp_failure) __argp_failure attribute_hidden;
extern __typeof (__argp_input) __argp_input attribute_hidden;
extern __typeof (__argp_state_help) __argp_state_help attribute_hidden;
#endif

#endif

0 comments on commit 8345a76

Please sign in to comment.