Bug 1552018

Summary: annobin: Cannot generate function-specific annotations for functions with asm aliases
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: annobinAssignee: Nick Clifton <nickc>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fweimer, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: annobin-3.5-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-06 11:47:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1548438    

Description Florian Weimer 2018-03-06 10:45:47 UTC
This example:

void * foo_ifunc (void) __asm__ ("foo");
void *
__attribute__ ((__optimize__ ("-fno-stack-protector")))
foo_ifunc (void)
{
  return 0;
}

extracted from a glibc test results in:

ifuncmod1.s: Assembler messages:
ifuncmod1.s:122: Error: bad expression
ifuncmod1.s:122: Error: junk at end of line, first unrecognized character is `f'
ifuncmod1.s:123: Error: bad expression
ifuncmod1.s:123: Error: junk at end of line, first unrecognized character is `f'
ifuncmod1.s:126: Error: junk at end of line, first unrecognized character is `*'

when compiled with these flags:

gcc -c -O2 -fstack-protector-strong  -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 --save-temps

The assembler input looks like this:

        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        xorl    %eax, %eax
        ret
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .pushsection .gnu.build.attributes
        .dc.l 6         # size of name
        .dc.l 16        # descsz = sizeof (addresses)
        .dc.l 0x101     # type = FUNC
        .dc.b 0x47, 0x41, 0x2a, 0x2, 0, 0       # name (numeric: -fstack-protector status)
        .dc.b 0, 0      # Padding
        .quad *foo
        .quad *foo_end  # description (symbol name)
        .popsection

*foo_end:

Comment 1 Nick Clifton 2018-03-06 11:28:16 UTC
Hi Florian,

  Thanks for reporting this bug.  To be clear, the issue here is not
  that an ifunc resolver is involved, but rather than the asm() function
  attribute has been used to provide a specific assembler name.

  The new annobin-3.5 source release contains a patch that fixes this bug,
  and there should now be an annobin-3.5-1.fc29 rpm available.

Cheers
  Nick

Comment 2 Florian Weimer 2018-03-06 11:47:55 UTC
(In reply to Nick Clifton from comment #1)
>   Thanks for reporting this bug.  To be clear, the issue here is not
>   that an ifunc resolver is involved, but rather than the asm() function
>   attribute has been used to provide a specific assembler name.

Right, I reduced it past the IFUNC resolver.

>   The new annobin-3.5 source release contains a patch that fixes this bug,
>   and there should now be an annobin-3.5-1.fc29 rpm available.

Thanks for fixing it so quickly!