Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:13:28+00:00 2026-06-03T07:13:28+00:00

here is some C++ test code: __attribute__((visibility(hidden))) void foo() { int fd = fopen(data1,

  • 0

here is some C++ test code:

__attribute__((visibility("hidden"))) void foo()
{
   int fd = fopen("data1", "rb");
   printf ("%d", fd);
}

And all other code don’t call function ‘foo’ and function ‘fopen’

Then I use gcc option -ffunction-sections to compile the code to a so file.

As I think, the function foo symbol and foo binary code has’t inlcuded in the so file.

But The problem is, I think the symbol ‘fopen’ should not be symbol table.
ps:I can make sure that only function ‘foo’ has use ‘fopen’.
And it actually is not, when I use command nm, I found ‘U’ type symbol of ‘fopen’.

How is the gcc work?
And has gcc other compile option to found that, symbol ‘fopen’ is not use, and remove ‘fopen’ symbol.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:13:29+00:00Added an answer on June 3, 2026 at 7:13 am

    The problem is, that the compiler does not know, wheter the symbols are used later.

    You can tell at compile time that you gave him the whole program, so that if your program isnt calling the function, nobody would.

    The compiling option is -fwhole-program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to test some of these code here http://ha.ckers.org/xss.html on my code.
Apparently, NSFileManager is unable to delete files created by mkstemp() . Here's some test
I'm new here. I'm developing some Asp.Net applications and i wanna test them on
Here is some code I made :) @echo off set source=R:\Contracts\ set destination=R:\Contracts\Sites\ ROBOCOPY
Here is some code I could not get to format properly in markdown, this
Here's some Ruby code: puts %x{ pstree #{$$} } # never forks puts %x{
Here's some code I saw once. Can you see what's wrong with it? [updated]
I'm test building a scraping site with django. For some reason the following code
Here is some PHP mixed with HTML, I apologize that it's quite messy. <div
Here is some simple Perl to count the number of times a value occurs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.